How chapa-et/chapa-woocommerce works
Project type and purpose
• This is a WordPress plugin that implements a WooCommerce payment gateway for “Chapa” (an Ethiopian payment provider).
• It extends WooCommerce at checkout to accept telebirr, CBE Birr, PayPal, Visa, Mastercard, Amex, bank transfers, etc.
File structure
• Top-level plugin bootstrap: woo-chapa.php (WordPress plugin header, init hooks).
• includes/
• class-waf-wc-chapa-gateway.php – PHP class that registers the gateway with WooCommerce, handles payment requests, callbacks, order status updates.
• blocks/
– class-wc-chapa-payments-blocks.php – PHP class to register Gutenberg blocks for payment UI.
• assets/js/blocks.js + blocks.asset.php – compiled block script and metadata loaded in the WP admin/editor.
• src/*.js + webpack.config.js – source for any custom JS (e.g., button.js, index.js) that get bundled into assets/js.
• uninstall.php – cleanup logic on plugin removal.
• package.json/package-lock.json – JS build dependencies (e.g. webpack, Babel).
• assets/images – static assets for UI or block previews.
• README.md/readme.txt – user-facing documentation and changelog.
README for additional insights
• Describes supported payment methods and features.
• Outlines installation, settings (Secret/Public Key), enabling/disabling the gateway.
• Mentions Gutenberg block support since v1.0.2.
• Core components (WP + WooCommerce)
• Plugin modules (PHP classes, JS bundles)
• External services (Chapa API)
• Actors (Admin, Customer)
• Hook registration (plugin → WP/WC)
• Data flow (Checkout UI → Plugin → Chapa API → Plugin → Order DB)
• Build flow (src → webpack → assets/js)