Changeset 2906082
- Timestamp:
- 04/29/2023 11:59:21 AM (3 years ago)
- Location:
- rave-woocommerce-payment-gateway
- Files:
-
- 2 added
- 22 edited
- 1 copied
-
tags/2.3.2-alpha (copied) (copied from rave-woocommerce-payment-gateway/trunk)
-
tags/2.3.2-alpha/assets/img/flutterwave-full.svg (added)
-
tags/2.3.2-alpha/build/index.asset.php (modified) (1 diff)
-
tags/2.3.2-alpha/build/index.js (modified) (1 diff)
-
tags/2.3.2-alpha/client/blocks/payment-method/index.js (modified) (3 diffs)
-
tags/2.3.2-alpha/client/blocks/utils.js (modified) (1 diff)
-
tags/2.3.2-alpha/i18n/languages/woocommerce-rave.pot (modified) (9 diffs)
-
tags/2.3.2-alpha/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php (modified) (5 diffs)
-
tags/2.3.2-alpha/includes/class-flutterwave.php (modified) (5 diffs)
-
tags/2.3.2-alpha/includes/class-flw-wc-payment-gateway.php (modified) (10 diffs)
-
tags/2.3.2-alpha/includes/client/class-flw-wc-payment-gateway-request.php (modified) (2 diffs)
-
tags/2.3.2-alpha/readme.txt (modified) (6 diffs)
-
tags/2.3.2-alpha/woocommerce-rave.php (modified) (1 diff)
-
trunk/assets/img/flutterwave-full.svg (added)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/client/blocks/payment-method/index.js (modified) (3 diffs)
-
trunk/client/blocks/utils.js (modified) (1 diff)
-
trunk/i18n/languages/woocommerce-rave.pot (modified) (9 diffs)
-
trunk/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php (modified) (5 diffs)
-
trunk/includes/class-flutterwave.php (modified) (5 diffs)
-
trunk/includes/class-flw-wc-payment-gateway.php (modified) (10 diffs)
-
trunk/includes/client/class-flw-wc-payment-gateway-request.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (6 diffs)
-
trunk/woocommerce-rave.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/build/index.asset.php
r2904114 r2906082 1 <?php return array('dependencies' => array('wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => ' c57a0a431e70035733b2');1 <?php return array('dependencies' => array('wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'e346740b0995dddaec6c'); -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/build/index.js
r2904114 r2906082 1 (()=>{"use strict";const e=window.wc.wcBlocksRegistry,t=window.wp.element, n=window.wp.i18n,a=window.wp.htmlEntities,l="rave",i=window.wc.wcSettings,r=()=>{const e=(0,i.getSetting)("flutterwave_data",null);if(!e)throw new Error("Flutterwave initialization data is not available");return e};var o,c;const w=()=>(0,t.createElement)("div",null,(0,a.decodeEntities)(r()?.description||" lorem ipsum ")),s=null!==(o=r()?.asset_url)&&void 0!==o?o:null,d={name:l,label:(0,t.createElement)("img",{src:`${s}/img/rave.png`,alt:(0,a.decodeEntities)(settings.title||(0,n.__)("Flutterwave","woocommerce-rave"))}),placeOrderButtonLabel:(0,n.__)("Proceed to Flutterwave","woocommerce-rave"),ariaLabel:(0,a.decodeEntities)(r()?.title||(0,n.__)("Payment via Flutterwave","woocommerce-rave")),canMakePayment:()=>!0,content:(0,t.createElement)(w,null),edit:(0,t.createElement)(w,null),savedTokenComponent:(0,t.createElement)("div",null,"Flutterwave 3"),paymentMethodId:l,supports:{features:null!==(c=r()?.supports)&&void 0!==c?c:[]}};(0,e.registerPaymentMethod)(d)})();1 (()=>{"use strict";const e=window.wc.wcBlocksRegistry,t=window.wp.element,l=window.wp.i18n,a=window.wp.htmlEntities,r="rave",n=window.wc.wcSettings,o=()=>{const e=(0,n.getSetting)("rave_data",null);if(!e)throw new Error("Flutterwave initialization data is not available");return e};var i,c;const w=()=>(0,t.createElement)("div",null,(0,a.decodeEntities)(o()?.description||(0,l.__)("You may be redirected to a secure page to complete your payment.","woocommerce-rave"))),m=null!==(i=o()?.asset_url)&&void 0!==i?i:null,d={name:r,label:(0,t.createElement)("div",{style:{display:"flex",flexDirection:"row",rowGap:".5em"}},(0,t.createElement)("img",{src:`${m}/img/flutterwave-full.svg`,alt:(0,a.decodeEntities)(o()?.title||(0,l.__)("Flutterwave","woocommerce-rave"))}),(0,t.createElement)("b",null,(0,t.createElement)("h4",null,"Flutterwave"))),placeOrderButtonLabel:(0,l.__)("Proceed to Flutterwave","woocommerce-rave"),ariaLabel:(0,a.decodeEntities)(o()?.title||(0,l.__)("Payment via Flutterwave","woocommerce-rave")),canMakePayment:()=>!0,content:(0,t.createElement)(w,null),edit:(0,t.createElement)(w,null),paymentMethodId:r,supports:{features:null!==(c=o()?.supports)&&void 0!==c?c:[]}};(0,e.registerPaymentMethod)(d)})(); -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/client/blocks/payment-method/index.js
r2904114 r2906082 17 17 */ 18 18 const Content = () => { 19 return <div>{ decodeEntities( getBlocksConfiguration()?.description || ' lorem ipsum ') }</div>;19 return <div>{ decodeEntities( getBlocksConfiguration()?.description || __('You may be redirected to a secure page to complete your payment.', 'woocommerce-rave') ) }</div>; 20 20 }; 21 21 … … 26 26 name: PAYMENT_METHOD_NAME, 27 27 label: ( 28 <img 29 src={ `${ FLW_ASSETS }/img/rave.png` } 28 <div style={{ display: 'flex', flexDirection: 'row', rowGap: '.5em'}}> 29 <img 30 src={ `${ FLW_ASSETS }/img/flutterwave-full.svg` } 30 31 alt={ decodeEntities( 31 settings.title || __( 'Flutterwave', 'woocommerce-rave' )32 getBlocksConfiguration()?.title || __( 'Flutterwave', 'woocommerce-rave' ) 32 33 ) } 33 /> 34 /> 35 <b><h4>Flutterwave</h4></b> 36 </div> 34 37 ), 35 38 placeOrderButtonLabel: __( … … 44 47 content: <Content />, 45 48 edit: <Content />, 46 savedTokenComponent: <div>Flutterwave 3</div>,47 49 paymentMethodId: PAYMENT_METHOD_NAME, 48 50 supports: { -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/client/blocks/utils.js
r2904114 r2906082 5 5 6 6 export const getBlocksConfiguration = () => { 7 const flutterwaveServerData = getSetting( ' flutterwave_data', null );7 const flutterwaveServerData = getSetting( 'rave_data', null ); 8 8 9 9 if ( ! flutterwaveServerData ) { -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/i18n/languages/woocommerce-rave.pot
r2904114 r2906082 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023-04-2 5T22:00:34+00:00\n"12 "POT-Creation-Date: 2023-04-29T11:59:03+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.7.1\n" … … 37 37 msgstr "" 38 38 39 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 6439 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:137 40 40 msgid "Visa" 41 41 msgstr "" 42 42 43 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 6843 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:141 44 44 msgid "American Express" 45 45 msgstr "" 46 46 47 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 7247 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:145 48 48 msgid "Mastercard" 49 49 msgstr "" 50 50 51 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 7951 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:152 52 52 msgctxt "Name of credit card" 53 53 msgid "Discover" 54 54 msgstr "" 55 55 56 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 8356 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:156 57 57 msgid "JCB" 58 58 msgstr "" 59 59 60 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 8760 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:160 61 61 msgid "Diners" 62 62 msgstr "" … … 164 164 165 165 #: includes/class-flw-wc-payment-gateway.php:247 166 msgid " Ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard"166 msgid "Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard" 167 167 msgstr "" 168 168 … … 181 181 182 182 #: includes/class-flw-wc-payment-gateway.php:263 183 msgid " RaveTest Public Key"183 msgid "Test Public Key" 184 184 msgstr "" 185 185 … … 189 189 190 190 #: includes/class-flw-wc-payment-gateway.php:269 191 msgid " RaveTest Secret Key"191 msgid "Test Secret Key" 192 192 msgstr "" 193 193 … … 197 197 198 198 #: includes/class-flw-wc-payment-gateway.php:275 199 msgid " RaveLive Public Key"199 msgid "Live Public Key" 200 200 msgstr "" 201 201 … … 205 205 206 206 #: includes/class-flw-wc-payment-gateway.php:281 207 msgid " RaveLive Secret Key"207 msgid "Live Secret Key" 208 208 msgstr "" 209 209 … … 331 331 332 332 #. translators: %s: url 333 #: includes/class-flw-wc-payment-gateway.php:4 18333 #: includes/class-flw-wc-payment-gateway.php:429 334 334 msgid "Flutterwave is enabled, but the API keys are not set. Please <a href=\"%s\">set your Flutterwave API keys</a> to be able to accept payments." 335 335 msgstr "" 336 336 337 #: includes/class-flw-wc-payment-gateway.php: 495337 #: includes/class-flw-wc-payment-gateway.php:506 338 338 msgid "Order Payment" 339 339 msgstr "" 340 340 341 #: includes/client/class-flw-wc-payment-gateway-request.php:1 14341 #: includes/client/class-flw-wc-payment-gateway-request.php:126 342 342 msgid "Payment for order %s" 343 343 msgstr "" … … 366 366 msgstr "" 367 367 368 #: client/blocks/payment-method/index.js:31 368 #: client/blocks/payment-method/index.js:19 369 msgid "You may be redirected to a secure page to complete your payment." 370 msgstr "" 371 372 #: client/blocks/payment-method/index.js:32 369 373 msgid "Flutterwave" 370 374 msgstr "" 371 375 372 #: client/blocks/payment-method/index.js:3 5376 #: client/blocks/payment-method/index.js:38 373 377 msgid "Proceed to Flutterwave" 374 378 msgstr "" 375 379 376 #: client/blocks/payment-method/index.js:4 1380 #: client/blocks/payment-method/index.js:44 377 381 msgid "Payment via Flutterwave" 378 382 msgstr "" -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php
r2904114 r2906082 12 12 */ 13 13 14 defined( 'ABSPATH' ) || exit; 15 14 16 use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; 15 16 defined( 'ABSPATH' ) || exit;17 17 18 18 /** … … 34 34 * Settings from the WP options table 35 35 * 36 * @var WC_Payment_Gateway |null36 * @var WC_Payment_Gateway 37 37 */ 38 protected ?WC_Payment_Gateway $gateway = null;38 protected WC_Payment_Gateway $gateway; 39 39 40 40 /** … … 45 45 public function initialize() { 46 46 $this->settings = get_option( 'woocommerce_rave_settings', array() ); 47 $gateways = WC()->payment_gateways()->payment_gateways(); 48 $this->gateway = $gateways[ $this->name ]; 47 $this->gateway = new FLW_WC_Payment_Gateway(); 49 48 } 50 49 … … 95 94 wp_register_script( 96 95 'wc-flutterwave-blocks', 97 dirname( FLW_WC_PLUGIN_FILE ). '/build/index.js',96 FLW_WC_URL . '/build/index.js', 98 97 array_merge( array( 'flutterwave' ), $dependencies ), 99 98 $version, … … 116 115 */ 117 116 public function get_payment_method_data(): array { 118 // We need to call array_merge_recursive so the blocks 'button' setting doesn't overwrite. 119 // what's provided from the gateway or payment request configuration. 120 return array_replace_recursive( 121 $this->get_gateway_javascript_params(), 122 // Blocks-specific options. 123 array( 124 'icons' => $this->get_icons(), 125 'supports' => $this->get_supported_features(), 126 'isAdmin' => is_admin(), 127 ) 128 ); 129 } 130 131 /** 132 * Returns the Flutterwave Payment Gateway JavaScript configuration object. 133 * 134 * @return mixed the JS configuration from the Flutterwave. 135 */ 136 private function get_gateway_javascript_params() { 137 $js_configuration = array(); 138 139 $gateways = WC()->payment_gateways()->get_available_payment_gateways(); 140 if ( isset( $gateways[ $this->name ] ) ) { 141 $js_configuration = $gateways[ $this->name ]->javascript_params(); 142 } 143 144 /** 145 * Filter the JS configuration. 146 * 147 * @since 2.3.2 148 */ 149 return apply_filters( 150 'wc_rave_params', 151 $js_configuration 117 return array( 118 'icons' => $this->get_icons(), 119 'supports' => array_filter( $this->get_supported_features(), array( $this->gateway, 'supports' ) ), 120 'isAdmin' => is_admin(), 121 'public_key' => ( 'yes' === $this->settings['go_live'] ) ? $this->settings['live_public_key'] : $this->settings['test_public_key'], 122 'asset_url' => plugins_url( 'assets', FLW_WC_PLUGIN_FILE ), 123 'title' => $this->settings['title'], 124 'description' => $this->settings['description'], 152 125 ); 153 126 } -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/class-flutterwave.php
r2904114 r2906082 76 76 $this->define( 'FLW_WC_VERSION', $this->version ); 77 77 $this->define( 'FLW_WC_MIN_WC_VER', '7.1' ); 78 $this->define( 'FLW_WC_URL', trailingslashit( plugins_url( '/', FLW_WC_PLUGIN_FILE ) ) ); 78 79 } 79 80 … … 104 105 // Check if WooCommerce is active. 105 106 if ( ! class_exists( 'WooCommerce' ) ) { 107 106 108 add_action( 'admin_notices', array( $notices, 'woocommerce_not_installed' ) ); 109 return; 107 110 } 108 111 … … 121 124 $this->register_payment_gateway(); 122 125 123 // add woocommerce block support.124 add_action( 'woocommerce_blocks_loaded', array( $this, 'flutterwave_woocommerce_blocks_support' ) );125 126 } 126 127 … … 143 144 */ 144 145 public function includes() { 146 // Include classes that can run on WP Freely. 145 147 include_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/notices/class-flw-wc-payment-gateway-notices.php'; 146 require_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php';147 148 } 148 149 … … 219 220 220 221 } 221 222 /**223 * Register the Flutterwave payment gateway for WooCommerce Blocks.224 *225 * @return void226 */227 protected function flutterwave_woocommerce_blocks_support() {228 if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {229 add_action(230 'woocommerce_blocks_payment_method_type_registration',231 function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {232 $container = Automattic\WooCommerce\Blocks\Package::container();233 // registers as shared instance.234 $container->register(235 Flutterwave_WC_Gateway_Blocks_Support::class,236 function() {237 return new Flutterwave_WC_Gateway_Blocks_Support();238 }239 );240 241 $payment_method_registry->register( new Flutterwave_WC_Gateway_Blocks_Support() );242 }243 );244 }245 }246 222 } -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/class-flw-wc-payment-gateway.php
r2904114 r2906082 245 245 'title' => __( 'Enter Secret Hash', 'woocommerce-rave' ), 246 246 'type' => 'text', 247 'description' => __( ' Ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard', 'woocommerce-rave' ),247 'description' => __( 'Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard', 'woocommerce-rave' ), 248 248 'default' => hash( 'sha256', 'Rave-Secret-Hash' ), 249 249 ), … … 261 261 ), 262 262 'test_public_key' => array( 263 'title' => __( ' RaveTest Public Key', 'woocommerce-rave' ),263 'title' => __( 'Test Public Key', 'woocommerce-rave' ), 264 264 'type' => 'text', 265 265 'description' => __( 'Required! Enter your Flutterwave test public key here', 'woocommerce-rave' ), … … 267 267 ), 268 268 'test_secret_key' => array( 269 'title' => __( ' RaveTest Secret Key', 'woocommerce-rave' ),269 'title' => __( 'Test Secret Key', 'woocommerce-rave' ), 270 270 'type' => 'password', 271 271 'description' => __( 'Required! Enter your Flutterwave test secret key here', 'woocommerce-rave' ), … … 273 273 ), 274 274 'live_public_key' => array( 275 'title' => __( ' RaveLive Public Key', 'woocommerce-rave' ),275 'title' => __( 'Live Public Key', 'woocommerce-rave' ), 276 276 'type' => 'text', 277 277 'description' => __( 'Required! Enter your Flutterwave live public key here', 'woocommerce-rave' ), … … 279 279 ), 280 280 'live_secret_key' => array( 281 'title' => __( ' RaveLive Secret Key', 'woocommerce-rave' ),281 'title' => __( 'Live Secret Key', 'woocommerce-rave' ), 282 282 'type' => 'password', 283 283 'description' => __( 'Required! Enter your Flutterwave live secret key here', 'woocommerce-rave' ), … … 382 382 include_once dirname( __FILE__ ) . '/client/class-flw-wc-payment-gateway-request.php'; 383 383 384 $order = wc_get_order( $order_id ); 385 $flutterwave_request = ( new FLW_WC_Payment_Gateway_Request() )->get_prepared_payload( $order, $this->get_secret_key() ); 386 $sdk = $this->sdk->set_event_handler( new FlwEventHandler( $order ) ); 384 $order = wc_get_order( $order_id ); 385 386 try { 387 $flutterwave_request = ( new FLW_WC_Payment_Gateway_Request() )->get_prepared_payload( $order, $this->get_secret_key() ); 388 } catch ( \InvalidArgumentException $flw_e ) { 389 wc_add_notice( $flw_e, 'error' ); 390 // redirect user to check out page. 391 return array( 392 'result' => 'fail', 393 'redirect' => $order->get_checkout_payment_url( true ), 394 ); 395 } 396 397 $sdk = $this->sdk->set_event_handler( new FlwEventHandler( $order ) ); 387 398 388 399 $response = $sdk->get_client()->request( $this->sdk::$standard_inline_endpoint, 'POST', $flutterwave_request ); … … 558 569 559 570 if ( $signature !== $local_signature ) { 560 echo 'Access Denied Hash does not match'; 561 exit(); 571 $msg = wp_json_encode( 572 array( 573 'status' => 'error', 574 'message' => 'Access Denied Hash does not match', 575 ) 576 ); 577 die( $msg ); //phpcs:ignore 562 578 } 563 579 … … 565 581 $event = json_decode( $event ); 566 582 583 if ( 'test_assess' === $event->event ) { 584 $msg = wp_json_encode( 585 array( 586 'status' => 'error', 587 'message' => 'Test Webhook Successful', 588 ) 589 ); 590 die( $msg ); //phpcs:ignore 591 } 592 567 593 if ( 'charge.completed' === $event->event ) { 568 594 sleep( 6 ); … … 572 598 573 599 $txn_ref = sanitize_text_field( $event_data->tx_ref ); 574 $o = explode( '_', sanitize_text_field( $txn_ref ));600 $o = explode( '_', $txn_ref ); 575 601 $order_id = intval( $o[1] ); 576 602 $order = wc_get_order( $order_id ); … … 604 630 $sdk->set_event_handler( new FlwEventHandler( $order ) )->webhook_verify( $event_type, $event_data ); 605 631 } 632 633 wp_safe_redirect( home_url() ); 634 exit(); 606 635 } 607 636 -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/client/class-flw-wc-payment-gateway-request.php
r2904114 r2906082 75 75 * @param \WC_Order $order Order object. 76 76 * @param string $secret_key APi key. 77 * @param bool $testing is ci. 78 * @throws \InvalidArgumentException When the secret key is not spplied. 77 79 * 78 80 * @return array 79 81 */ 80 public function get_prepared_payload( \WC_Order $order, $secret_key ): array { 81 $order_id = $order->get_id(); 82 $txnref = 'WOOC_' . $order_id . '_' . time(); 83 $amount = $order->get_total(); 84 $currency = $order->get_currency(); 85 $email = $order->get_billing_email(); 82 public function get_prepared_payload( \WC_Order $order, string $secret_key, bool $testing ): array { 83 $order_id = $order->get_id(); 84 $txnref = 'WOOC_' . $order_id . '_' . time(); 85 $amount = $order->get_total(); 86 $currency = $order->get_currency(); 87 $email = $order->get_billing_email(); 88 89 if ( $testing ) { 90 $txnref = 'WOOC_' . $order_id . '_TEST'; 91 } 92 93 if ( empty( $secret_key ) ) { 94 // let admin know that the secret key is not set. 95 throw new \InvalidArgumentException( 'This Payment Method is current unavailable as Administrator is yet to Configure it.Please contact Administrator for more information.' ); 96 } 97 86 98 $data_to_hash = array( 87 99 'amount' => $amount, … … 99 111 'payment_options' => 'card', 100 112 'redirect_url' => $this->notify_url . '?order_id=' . $order_id, 101 ' checkout_hash'=> $checkout_hash,113 'payload_hash' => $checkout_hash, 102 114 'customer' => array( 103 115 'email' => $email, -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/readme.txt
r2904114 r2906082 1 1 === Flutterwave WooCommerce === 2 2 Contributors: theflutterwave 3 Tags: rave,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa3 Tags: fintech,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa 4 4 Requires at least: 3.1 5 5 Tested up to: 6.1 6 6 Stable tag: 2.3.2 7 7 License: MIT 8 License URI: https://github.com/Flutterwave/ rave-woocommerce/blob/master/LICENSE8 License URI: https://github.com/Flutterwave/Woocommerce/blob/master/LICENSE 9 9 10 10 The WooCommerce Plugin makes it very easy and quick to add Flutterwave Payment option on Checkout for your online store. Accept Credit card, Debit card and Bank account payment directly on your store with the Flutterwave Plugin for WooCommerce. … … 24 24 1. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication) 25 25 2. [WooCommerce](https://woocommerce.com/) 26 3. [WooCommerce Shipping & Tax](https://wordpress.org/plugins/woocommerce-services/) 27 4. [Facebook for WooCommerce](https://wordpress.org/plugins/facebook-for-woocommerce/) 28 5. [Google Ads & Marketing by Kliken](https://wordpress.org/plugins/kliken-marketing-for-google/) 29 6. Supported PHP version: 5.6.0 - 8.1.0 26 6. Supported PHP version: 7.4.0 - 8.1.0 30 27 31 28 == Installation == … … 39 36 * Activate the plugin. 40 37 * Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab. 41 * Click on the __ Rave__ link from the available Checkout Options38 * Click on the __Flutterwave__ link from the available Checkout Options 42 39 * Configure your __Flutterwave Woocommerce__ settings accordingly. 43 40 … … 48 45 4. Activate the plugin. 49 46 5. Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab. 50 6. Click on the __ Rave__ link from the available Checkout Options47 6. Click on the __Flutterwave__ link from the available Checkout Options 51 48 7. Configure your __Flutterwave WooCommerce__ settings accordingly. 52 49 … … 54 51 55 52 = Configure the plugin = 56 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __ Rave__.53 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Flutterwave__. 57 54 58 * __Enable/Disable__ - check the box to enable Rave Payment Gateway.59 * __Pay Button Public Key__ - Enter your public key which can be retrieved from the "Pay Buttons" page on your Rave account dashboard.60 * __Modal Title__ - (Optional) customize the title of the Pay Modal. Default is Rave.55 * __Enable/Disable__ - check the box to enable Flutterwave WooCommerce. 56 * __Pay Button Public Key__ - Enter your public key which can be retrieved from the "Pay Buttons" page on your Flutterwave account dashboard. 57 * __Modal Title__ - (Optional) customize the title of the Pay Modal. Default is Flutterwave. 61 58 * Click __Save Changes__ to save your changes. 62 59 … … 100 97 101 98 == Changelog == 99 = 2.3.2 = 100 * Added: Support for WooCommerce Blocks. 101 * Updated: WooCommerce Checkout Process. 102 102 = 2.3.0 = 103 103 * Fix: Handled MobileMoney Payment Handler Error. -
rave-woocommerce-payment-gateway/tags/2.3.2-alpha/woocommerce-rave.php
r2904114 r2906082 40 40 41 41 /** 42 * Register the Flutterwave payment gateway for WooCommerce Blocks. 43 * 44 * @return void 45 */ 46 function flutterwave_woocommerce_blocks_support() { 47 if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) { 48 require_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php'; 49 add_action( 50 'woocommerce_blocks_payment_method_type_registration', 51 function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) { 52 53 $payment_method_registry->register( new Flutterwave_WC_Gateway_Blocks_Support() ); 54 } 55 ); 56 } 57 } 58 59 // add woocommerce block support. 60 add_action( 'woocommerce_blocks_loaded', 'flutterwave_woocommerce_blocks_support' ); 61 62 /** 42 63 * Add the Settings link to the plugin 43 64 * -
rave-woocommerce-payment-gateway/trunk/build/index.asset.php
r2904114 r2906082 1 <?php return array('dependencies' => array('wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => ' c57a0a431e70035733b2');1 <?php return array('dependencies' => array('wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'e346740b0995dddaec6c'); -
rave-woocommerce-payment-gateway/trunk/build/index.js
r2904114 r2906082 1 (()=>{"use strict";const e=window.wc.wcBlocksRegistry,t=window.wp.element, n=window.wp.i18n,a=window.wp.htmlEntities,l="rave",i=window.wc.wcSettings,r=()=>{const e=(0,i.getSetting)("flutterwave_data",null);if(!e)throw new Error("Flutterwave initialization data is not available");return e};var o,c;const w=()=>(0,t.createElement)("div",null,(0,a.decodeEntities)(r()?.description||" lorem ipsum ")),s=null!==(o=r()?.asset_url)&&void 0!==o?o:null,d={name:l,label:(0,t.createElement)("img",{src:`${s}/img/rave.png`,alt:(0,a.decodeEntities)(settings.title||(0,n.__)("Flutterwave","woocommerce-rave"))}),placeOrderButtonLabel:(0,n.__)("Proceed to Flutterwave","woocommerce-rave"),ariaLabel:(0,a.decodeEntities)(r()?.title||(0,n.__)("Payment via Flutterwave","woocommerce-rave")),canMakePayment:()=>!0,content:(0,t.createElement)(w,null),edit:(0,t.createElement)(w,null),savedTokenComponent:(0,t.createElement)("div",null,"Flutterwave 3"),paymentMethodId:l,supports:{features:null!==(c=r()?.supports)&&void 0!==c?c:[]}};(0,e.registerPaymentMethod)(d)})();1 (()=>{"use strict";const e=window.wc.wcBlocksRegistry,t=window.wp.element,l=window.wp.i18n,a=window.wp.htmlEntities,r="rave",n=window.wc.wcSettings,o=()=>{const e=(0,n.getSetting)("rave_data",null);if(!e)throw new Error("Flutterwave initialization data is not available");return e};var i,c;const w=()=>(0,t.createElement)("div",null,(0,a.decodeEntities)(o()?.description||(0,l.__)("You may be redirected to a secure page to complete your payment.","woocommerce-rave"))),m=null!==(i=o()?.asset_url)&&void 0!==i?i:null,d={name:r,label:(0,t.createElement)("div",{style:{display:"flex",flexDirection:"row",rowGap:".5em"}},(0,t.createElement)("img",{src:`${m}/img/flutterwave-full.svg`,alt:(0,a.decodeEntities)(o()?.title||(0,l.__)("Flutterwave","woocommerce-rave"))}),(0,t.createElement)("b",null,(0,t.createElement)("h4",null,"Flutterwave"))),placeOrderButtonLabel:(0,l.__)("Proceed to Flutterwave","woocommerce-rave"),ariaLabel:(0,a.decodeEntities)(o()?.title||(0,l.__)("Payment via Flutterwave","woocommerce-rave")),canMakePayment:()=>!0,content:(0,t.createElement)(w,null),edit:(0,t.createElement)(w,null),paymentMethodId:r,supports:{features:null!==(c=o()?.supports)&&void 0!==c?c:[]}};(0,e.registerPaymentMethod)(d)})(); -
rave-woocommerce-payment-gateway/trunk/client/blocks/payment-method/index.js
r2904114 r2906082 17 17 */ 18 18 const Content = () => { 19 return <div>{ decodeEntities( getBlocksConfiguration()?.description || ' lorem ipsum ') }</div>;19 return <div>{ decodeEntities( getBlocksConfiguration()?.description || __('You may be redirected to a secure page to complete your payment.', 'woocommerce-rave') ) }</div>; 20 20 }; 21 21 … … 26 26 name: PAYMENT_METHOD_NAME, 27 27 label: ( 28 <img 29 src={ `${ FLW_ASSETS }/img/rave.png` } 28 <div style={{ display: 'flex', flexDirection: 'row', rowGap: '.5em'}}> 29 <img 30 src={ `${ FLW_ASSETS }/img/flutterwave-full.svg` } 30 31 alt={ decodeEntities( 31 settings.title || __( 'Flutterwave', 'woocommerce-rave' )32 getBlocksConfiguration()?.title || __( 'Flutterwave', 'woocommerce-rave' ) 32 33 ) } 33 /> 34 /> 35 <b><h4>Flutterwave</h4></b> 36 </div> 34 37 ), 35 38 placeOrderButtonLabel: __( … … 44 47 content: <Content />, 45 48 edit: <Content />, 46 savedTokenComponent: <div>Flutterwave 3</div>,47 49 paymentMethodId: PAYMENT_METHOD_NAME, 48 50 supports: { -
rave-woocommerce-payment-gateway/trunk/client/blocks/utils.js
r2904114 r2906082 5 5 6 6 export const getBlocksConfiguration = () => { 7 const flutterwaveServerData = getSetting( ' flutterwave_data', null );7 const flutterwaveServerData = getSetting( 'rave_data', null ); 8 8 9 9 if ( ! flutterwaveServerData ) { -
rave-woocommerce-payment-gateway/trunk/i18n/languages/woocommerce-rave.pot
r2904114 r2906082 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023-04-2 5T22:00:34+00:00\n"12 "POT-Creation-Date: 2023-04-29T11:59:03+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.7.1\n" … … 37 37 msgstr "" 38 38 39 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 6439 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:137 40 40 msgid "Visa" 41 41 msgstr "" 42 42 43 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 6843 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:141 44 44 msgid "American Express" 45 45 msgstr "" 46 46 47 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 7247 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:145 48 48 msgid "Mastercard" 49 49 msgstr "" 50 50 51 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 7951 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:152 52 52 msgctxt "Name of credit card" 53 53 msgid "Discover" 54 54 msgstr "" 55 55 56 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 8356 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:156 57 57 msgid "JCB" 58 58 msgstr "" 59 59 60 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:1 8760 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:160 61 61 msgid "Diners" 62 62 msgstr "" … … 164 164 165 165 #: includes/class-flw-wc-payment-gateway.php:247 166 msgid " Ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard"166 msgid "Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard" 167 167 msgstr "" 168 168 … … 181 181 182 182 #: includes/class-flw-wc-payment-gateway.php:263 183 msgid " RaveTest Public Key"183 msgid "Test Public Key" 184 184 msgstr "" 185 185 … … 189 189 190 190 #: includes/class-flw-wc-payment-gateway.php:269 191 msgid " RaveTest Secret Key"191 msgid "Test Secret Key" 192 192 msgstr "" 193 193 … … 197 197 198 198 #: includes/class-flw-wc-payment-gateway.php:275 199 msgid " RaveLive Public Key"199 msgid "Live Public Key" 200 200 msgstr "" 201 201 … … 205 205 206 206 #: includes/class-flw-wc-payment-gateway.php:281 207 msgid " RaveLive Secret Key"207 msgid "Live Secret Key" 208 208 msgstr "" 209 209 … … 331 331 332 332 #. translators: %s: url 333 #: includes/class-flw-wc-payment-gateway.php:4 18333 #: includes/class-flw-wc-payment-gateway.php:429 334 334 msgid "Flutterwave is enabled, but the API keys are not set. Please <a href=\"%s\">set your Flutterwave API keys</a> to be able to accept payments." 335 335 msgstr "" 336 336 337 #: includes/class-flw-wc-payment-gateway.php: 495337 #: includes/class-flw-wc-payment-gateway.php:506 338 338 msgid "Order Payment" 339 339 msgstr "" 340 340 341 #: includes/client/class-flw-wc-payment-gateway-request.php:1 14341 #: includes/client/class-flw-wc-payment-gateway-request.php:126 342 342 msgid "Payment for order %s" 343 343 msgstr "" … … 366 366 msgstr "" 367 367 368 #: client/blocks/payment-method/index.js:31 368 #: client/blocks/payment-method/index.js:19 369 msgid "You may be redirected to a secure page to complete your payment." 370 msgstr "" 371 372 #: client/blocks/payment-method/index.js:32 369 373 msgid "Flutterwave" 370 374 msgstr "" 371 375 372 #: client/blocks/payment-method/index.js:3 5376 #: client/blocks/payment-method/index.js:38 373 377 msgid "Proceed to Flutterwave" 374 378 msgstr "" 375 379 376 #: client/blocks/payment-method/index.js:4 1380 #: client/blocks/payment-method/index.js:44 377 381 msgid "Payment via Flutterwave" 378 382 msgstr "" -
rave-woocommerce-payment-gateway/trunk/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php
r2904114 r2906082 12 12 */ 13 13 14 defined( 'ABSPATH' ) || exit; 15 14 16 use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; 15 16 defined( 'ABSPATH' ) || exit;17 17 18 18 /** … … 34 34 * Settings from the WP options table 35 35 * 36 * @var WC_Payment_Gateway |null36 * @var WC_Payment_Gateway 37 37 */ 38 protected ?WC_Payment_Gateway $gateway = null;38 protected WC_Payment_Gateway $gateway; 39 39 40 40 /** … … 45 45 public function initialize() { 46 46 $this->settings = get_option( 'woocommerce_rave_settings', array() ); 47 $gateways = WC()->payment_gateways()->payment_gateways(); 48 $this->gateway = $gateways[ $this->name ]; 47 $this->gateway = new FLW_WC_Payment_Gateway(); 49 48 } 50 49 … … 95 94 wp_register_script( 96 95 'wc-flutterwave-blocks', 97 dirname( FLW_WC_PLUGIN_FILE ). '/build/index.js',96 FLW_WC_URL . '/build/index.js', 98 97 array_merge( array( 'flutterwave' ), $dependencies ), 99 98 $version, … … 116 115 */ 117 116 public function get_payment_method_data(): array { 118 // We need to call array_merge_recursive so the blocks 'button' setting doesn't overwrite. 119 // what's provided from the gateway or payment request configuration. 120 return array_replace_recursive( 121 $this->get_gateway_javascript_params(), 122 // Blocks-specific options. 123 array( 124 'icons' => $this->get_icons(), 125 'supports' => $this->get_supported_features(), 126 'isAdmin' => is_admin(), 127 ) 128 ); 129 } 130 131 /** 132 * Returns the Flutterwave Payment Gateway JavaScript configuration object. 133 * 134 * @return mixed the JS configuration from the Flutterwave. 135 */ 136 private function get_gateway_javascript_params() { 137 $js_configuration = array(); 138 139 $gateways = WC()->payment_gateways()->get_available_payment_gateways(); 140 if ( isset( $gateways[ $this->name ] ) ) { 141 $js_configuration = $gateways[ $this->name ]->javascript_params(); 142 } 143 144 /** 145 * Filter the JS configuration. 146 * 147 * @since 2.3.2 148 */ 149 return apply_filters( 150 'wc_rave_params', 151 $js_configuration 117 return array( 118 'icons' => $this->get_icons(), 119 'supports' => array_filter( $this->get_supported_features(), array( $this->gateway, 'supports' ) ), 120 'isAdmin' => is_admin(), 121 'public_key' => ( 'yes' === $this->settings['go_live'] ) ? $this->settings['live_public_key'] : $this->settings['test_public_key'], 122 'asset_url' => plugins_url( 'assets', FLW_WC_PLUGIN_FILE ), 123 'title' => $this->settings['title'], 124 'description' => $this->settings['description'], 152 125 ); 153 126 } -
rave-woocommerce-payment-gateway/trunk/includes/class-flutterwave.php
r2904114 r2906082 76 76 $this->define( 'FLW_WC_VERSION', $this->version ); 77 77 $this->define( 'FLW_WC_MIN_WC_VER', '7.1' ); 78 $this->define( 'FLW_WC_URL', trailingslashit( plugins_url( '/', FLW_WC_PLUGIN_FILE ) ) ); 78 79 } 79 80 … … 104 105 // Check if WooCommerce is active. 105 106 if ( ! class_exists( 'WooCommerce' ) ) { 107 106 108 add_action( 'admin_notices', array( $notices, 'woocommerce_not_installed' ) ); 109 return; 107 110 } 108 111 … … 121 124 $this->register_payment_gateway(); 122 125 123 // add woocommerce block support.124 add_action( 'woocommerce_blocks_loaded', array( $this, 'flutterwave_woocommerce_blocks_support' ) );125 126 } 126 127 … … 143 144 */ 144 145 public function includes() { 146 // Include classes that can run on WP Freely. 145 147 include_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/notices/class-flw-wc-payment-gateway-notices.php'; 146 require_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php';147 148 } 148 149 … … 219 220 220 221 } 221 222 /**223 * Register the Flutterwave payment gateway for WooCommerce Blocks.224 *225 * @return void226 */227 protected function flutterwave_woocommerce_blocks_support() {228 if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {229 add_action(230 'woocommerce_blocks_payment_method_type_registration',231 function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {232 $container = Automattic\WooCommerce\Blocks\Package::container();233 // registers as shared instance.234 $container->register(235 Flutterwave_WC_Gateway_Blocks_Support::class,236 function() {237 return new Flutterwave_WC_Gateway_Blocks_Support();238 }239 );240 241 $payment_method_registry->register( new Flutterwave_WC_Gateway_Blocks_Support() );242 }243 );244 }245 }246 222 } -
rave-woocommerce-payment-gateway/trunk/includes/class-flw-wc-payment-gateway.php
r2904114 r2906082 245 245 'title' => __( 'Enter Secret Hash', 'woocommerce-rave' ), 246 246 'type' => 'text', 247 'description' => __( ' Ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard', 'woocommerce-rave' ),247 'description' => __( 'Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard', 'woocommerce-rave' ), 248 248 'default' => hash( 'sha256', 'Rave-Secret-Hash' ), 249 249 ), … … 261 261 ), 262 262 'test_public_key' => array( 263 'title' => __( ' RaveTest Public Key', 'woocommerce-rave' ),263 'title' => __( 'Test Public Key', 'woocommerce-rave' ), 264 264 'type' => 'text', 265 265 'description' => __( 'Required! Enter your Flutterwave test public key here', 'woocommerce-rave' ), … … 267 267 ), 268 268 'test_secret_key' => array( 269 'title' => __( ' RaveTest Secret Key', 'woocommerce-rave' ),269 'title' => __( 'Test Secret Key', 'woocommerce-rave' ), 270 270 'type' => 'password', 271 271 'description' => __( 'Required! Enter your Flutterwave test secret key here', 'woocommerce-rave' ), … … 273 273 ), 274 274 'live_public_key' => array( 275 'title' => __( ' RaveLive Public Key', 'woocommerce-rave' ),275 'title' => __( 'Live Public Key', 'woocommerce-rave' ), 276 276 'type' => 'text', 277 277 'description' => __( 'Required! Enter your Flutterwave live public key here', 'woocommerce-rave' ), … … 279 279 ), 280 280 'live_secret_key' => array( 281 'title' => __( ' RaveLive Secret Key', 'woocommerce-rave' ),281 'title' => __( 'Live Secret Key', 'woocommerce-rave' ), 282 282 'type' => 'password', 283 283 'description' => __( 'Required! Enter your Flutterwave live secret key here', 'woocommerce-rave' ), … … 382 382 include_once dirname( __FILE__ ) . '/client/class-flw-wc-payment-gateway-request.php'; 383 383 384 $order = wc_get_order( $order_id ); 385 $flutterwave_request = ( new FLW_WC_Payment_Gateway_Request() )->get_prepared_payload( $order, $this->get_secret_key() ); 386 $sdk = $this->sdk->set_event_handler( new FlwEventHandler( $order ) ); 384 $order = wc_get_order( $order_id ); 385 386 try { 387 $flutterwave_request = ( new FLW_WC_Payment_Gateway_Request() )->get_prepared_payload( $order, $this->get_secret_key() ); 388 } catch ( \InvalidArgumentException $flw_e ) { 389 wc_add_notice( $flw_e, 'error' ); 390 // redirect user to check out page. 391 return array( 392 'result' => 'fail', 393 'redirect' => $order->get_checkout_payment_url( true ), 394 ); 395 } 396 397 $sdk = $this->sdk->set_event_handler( new FlwEventHandler( $order ) ); 387 398 388 399 $response = $sdk->get_client()->request( $this->sdk::$standard_inline_endpoint, 'POST', $flutterwave_request ); … … 558 569 559 570 if ( $signature !== $local_signature ) { 560 echo 'Access Denied Hash does not match'; 561 exit(); 571 $msg = wp_json_encode( 572 array( 573 'status' => 'error', 574 'message' => 'Access Denied Hash does not match', 575 ) 576 ); 577 die( $msg ); //phpcs:ignore 562 578 } 563 579 … … 565 581 $event = json_decode( $event ); 566 582 583 if ( 'test_assess' === $event->event ) { 584 $msg = wp_json_encode( 585 array( 586 'status' => 'error', 587 'message' => 'Test Webhook Successful', 588 ) 589 ); 590 die( $msg ); //phpcs:ignore 591 } 592 567 593 if ( 'charge.completed' === $event->event ) { 568 594 sleep( 6 ); … … 572 598 573 599 $txn_ref = sanitize_text_field( $event_data->tx_ref ); 574 $o = explode( '_', sanitize_text_field( $txn_ref ));600 $o = explode( '_', $txn_ref ); 575 601 $order_id = intval( $o[1] ); 576 602 $order = wc_get_order( $order_id ); … … 604 630 $sdk->set_event_handler( new FlwEventHandler( $order ) )->webhook_verify( $event_type, $event_data ); 605 631 } 632 633 wp_safe_redirect( home_url() ); 634 exit(); 606 635 } 607 636 -
rave-woocommerce-payment-gateway/trunk/includes/client/class-flw-wc-payment-gateway-request.php
r2904114 r2906082 75 75 * @param \WC_Order $order Order object. 76 76 * @param string $secret_key APi key. 77 * @param bool $testing is ci. 78 * @throws \InvalidArgumentException When the secret key is not spplied. 77 79 * 78 80 * @return array 79 81 */ 80 public function get_prepared_payload( \WC_Order $order, $secret_key ): array { 81 $order_id = $order->get_id(); 82 $txnref = 'WOOC_' . $order_id . '_' . time(); 83 $amount = $order->get_total(); 84 $currency = $order->get_currency(); 85 $email = $order->get_billing_email(); 82 public function get_prepared_payload( \WC_Order $order, string $secret_key, bool $testing ): array { 83 $order_id = $order->get_id(); 84 $txnref = 'WOOC_' . $order_id . '_' . time(); 85 $amount = $order->get_total(); 86 $currency = $order->get_currency(); 87 $email = $order->get_billing_email(); 88 89 if ( $testing ) { 90 $txnref = 'WOOC_' . $order_id . '_TEST'; 91 } 92 93 if ( empty( $secret_key ) ) { 94 // let admin know that the secret key is not set. 95 throw new \InvalidArgumentException( 'This Payment Method is current unavailable as Administrator is yet to Configure it.Please contact Administrator for more information.' ); 96 } 97 86 98 $data_to_hash = array( 87 99 'amount' => $amount, … … 99 111 'payment_options' => 'card', 100 112 'redirect_url' => $this->notify_url . '?order_id=' . $order_id, 101 ' checkout_hash'=> $checkout_hash,113 'payload_hash' => $checkout_hash, 102 114 'customer' => array( 103 115 'email' => $email, -
rave-woocommerce-payment-gateway/trunk/readme.txt
r2904114 r2906082 1 1 === Flutterwave WooCommerce === 2 2 Contributors: theflutterwave 3 Tags: rave,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa3 Tags: fintech,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa 4 4 Requires at least: 3.1 5 5 Tested up to: 6.1 6 6 Stable tag: 2.3.2 7 7 License: MIT 8 License URI: https://github.com/Flutterwave/ rave-woocommerce/blob/master/LICENSE8 License URI: https://github.com/Flutterwave/Woocommerce/blob/master/LICENSE 9 9 10 10 The WooCommerce Plugin makes it very easy and quick to add Flutterwave Payment option on Checkout for your online store. Accept Credit card, Debit card and Bank account payment directly on your store with the Flutterwave Plugin for WooCommerce. … … 24 24 1. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication) 25 25 2. [WooCommerce](https://woocommerce.com/) 26 3. [WooCommerce Shipping & Tax](https://wordpress.org/plugins/woocommerce-services/) 27 4. [Facebook for WooCommerce](https://wordpress.org/plugins/facebook-for-woocommerce/) 28 5. [Google Ads & Marketing by Kliken](https://wordpress.org/plugins/kliken-marketing-for-google/) 29 6. Supported PHP version: 5.6.0 - 8.1.0 26 6. Supported PHP version: 7.4.0 - 8.1.0 30 27 31 28 == Installation == … … 39 36 * Activate the plugin. 40 37 * Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab. 41 * Click on the __ Rave__ link from the available Checkout Options38 * Click on the __Flutterwave__ link from the available Checkout Options 42 39 * Configure your __Flutterwave Woocommerce__ settings accordingly. 43 40 … … 48 45 4. Activate the plugin. 49 46 5. Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab. 50 6. Click on the __ Rave__ link from the available Checkout Options47 6. Click on the __Flutterwave__ link from the available Checkout Options 51 48 7. Configure your __Flutterwave WooCommerce__ settings accordingly. 52 49 … … 54 51 55 52 = Configure the plugin = 56 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __ Rave__.53 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Flutterwave__. 57 54 58 * __Enable/Disable__ - check the box to enable Rave Payment Gateway.59 * __Pay Button Public Key__ - Enter your public key which can be retrieved from the "Pay Buttons" page on your Rave account dashboard.60 * __Modal Title__ - (Optional) customize the title of the Pay Modal. Default is Rave.55 * __Enable/Disable__ - check the box to enable Flutterwave WooCommerce. 56 * __Pay Button Public Key__ - Enter your public key which can be retrieved from the "Pay Buttons" page on your Flutterwave account dashboard. 57 * __Modal Title__ - (Optional) customize the title of the Pay Modal. Default is Flutterwave. 61 58 * Click __Save Changes__ to save your changes. 62 59 … … 100 97 101 98 == Changelog == 99 = 2.3.2 = 100 * Added: Support for WooCommerce Blocks. 101 * Updated: WooCommerce Checkout Process. 102 102 = 2.3.0 = 103 103 * Fix: Handled MobileMoney Payment Handler Error. -
rave-woocommerce-payment-gateway/trunk/woocommerce-rave.php
r2904114 r2906082 40 40 41 41 /** 42 * Register the Flutterwave payment gateway for WooCommerce Blocks. 43 * 44 * @return void 45 */ 46 function flutterwave_woocommerce_blocks_support() { 47 if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) { 48 require_once dirname( FLW_WC_PLUGIN_FILE ) . '/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php'; 49 add_action( 50 'woocommerce_blocks_payment_method_type_registration', 51 function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) { 52 53 $payment_method_registry->register( new Flutterwave_WC_Gateway_Blocks_Support() ); 54 } 55 ); 56 } 57 } 58 59 // add woocommerce block support. 60 add_action( 'woocommerce_blocks_loaded', 'flutterwave_woocommerce_blocks_support' ); 61 62 /** 42 63 * Add the Settings link to the plugin 43 64 *
Note: See TracChangeset
for help on using the changeset viewer.