Plugin Directory

Changeset 2906082


Ignore:
Timestamp:
04/29/2023 11:59:21 AM (3 years ago)
Author:
flutterwave
Message:

Update to version 2.3.2-alpha from GitHub

Location:
rave-woocommerce-payment-gateway
Files:
2 added
22 edited
1 copied

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  
    1717 */
    1818const 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>;
    2020};
    2121
     
    2626    name: PAYMENT_METHOD_NAME,
    2727    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` }
    3031            alt={ decodeEntities(
    31                 settings.title || __( 'Flutterwave', 'woocommerce-rave' )
     32                getBlocksConfiguration()?.title || __( 'Flutterwave', 'woocommerce-rave' )
    3233            ) }
    33         />
     34            />
     35            <b><h4>Flutterwave</h4></b>
     36        </div>
    3437    ),
    3538    placeOrderButtonLabel: __(
     
    4447    content: <Content />,
    4548    edit: <Content />,
    46     savedTokenComponent: <div>Flutterwave 3</div>,
    4749    paymentMethodId: PAYMENT_METHOD_NAME,
    4850    supports: {
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/client/blocks/utils.js

    r2904114 r2906082  
    55
    66export const getBlocksConfiguration = () => {
    7     const flutterwaveServerData = getSetting( 'flutterwave_data', null );
     7    const flutterwaveServerData = getSetting( 'rave_data', null );
    88
    99    if ( ! flutterwaveServerData ) {
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/i18n/languages/woocommerce-rave.pot

    r2904114 r2906082  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2023-04-25T22:00:34+00:00\n"
     12"POT-Creation-Date: 2023-04-29T11:59:03+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.7.1\n"
     
    3737msgstr ""
    3838
    39 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:164
     39#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:137
    4040msgid "Visa"
    4141msgstr ""
    4242
    43 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:168
     43#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:141
    4444msgid "American Express"
    4545msgstr ""
    4646
    47 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:172
     47#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:145
    4848msgid "Mastercard"
    4949msgstr ""
    5050
    51 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:179
     51#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:152
    5252msgctxt "Name of credit card"
    5353msgid "Discover"
    5454msgstr ""
    5555
    56 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:183
     56#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:156
    5757msgid "JCB"
    5858msgstr ""
    5959
    60 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:187
     60#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:160
    6161msgid "Diners"
    6262msgstr ""
     
    164164
    165165#: 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"
     166msgid "Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard"
    167167msgstr ""
    168168
     
    181181
    182182#: includes/class-flw-wc-payment-gateway.php:263
    183 msgid "Rave Test Public Key"
     183msgid "Test Public Key"
    184184msgstr ""
    185185
     
    189189
    190190#: includes/class-flw-wc-payment-gateway.php:269
    191 msgid "Rave Test Secret Key"
     191msgid "Test Secret Key"
    192192msgstr ""
    193193
     
    197197
    198198#: includes/class-flw-wc-payment-gateway.php:275
    199 msgid "Rave Live Public Key"
     199msgid "Live Public Key"
    200200msgstr ""
    201201
     
    205205
    206206#: includes/class-flw-wc-payment-gateway.php:281
    207 msgid "Rave Live Secret Key"
     207msgid "Live Secret Key"
    208208msgstr ""
    209209
     
    331331
    332332#. translators: %s: url
    333 #: includes/class-flw-wc-payment-gateway.php:418
     333#: includes/class-flw-wc-payment-gateway.php:429
    334334msgid "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."
    335335msgstr ""
    336336
    337 #: includes/class-flw-wc-payment-gateway.php:495
     337#: includes/class-flw-wc-payment-gateway.php:506
    338338msgid "Order Payment"
    339339msgstr ""
    340340
    341 #: includes/client/class-flw-wc-payment-gateway-request.php:114
     341#: includes/client/class-flw-wc-payment-gateway-request.php:126
    342342msgid "Payment for order %s"
    343343msgstr ""
     
    366366msgstr ""
    367367
    368 #: client/blocks/payment-method/index.js:31
     368#: client/blocks/payment-method/index.js:19
     369msgid "You may be redirected to a secure page to complete your payment."
     370msgstr ""
     371
     372#: client/blocks/payment-method/index.js:32
    369373msgid "Flutterwave"
    370374msgstr ""
    371375
    372 #: client/blocks/payment-method/index.js:35
     376#: client/blocks/payment-method/index.js:38
    373377msgid "Proceed to Flutterwave"
    374378msgstr ""
    375379
    376 #: client/blocks/payment-method/index.js:41
     380#: client/blocks/payment-method/index.js:44
    377381msgid "Payment via Flutterwave"
    378382msgstr ""
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php

    r2904114 r2906082  
    1212 */
    1313
     14defined( 'ABSPATH' ) || exit;
     15
    1416use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
    15 
    16 defined( 'ABSPATH' ) || exit;
    1717
    1818/**
     
    3434     * Settings from the WP options table
    3535     *
    36      * @var WC_Payment_Gateway|null
     36     * @var WC_Payment_Gateway
    3737     */
    38     protected ?WC_Payment_Gateway $gateway = null;
     38    protected WC_Payment_Gateway $gateway;
    3939
    4040    /**
     
    4545    public function initialize() {
    4646        $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();
    4948    }
    5049
     
    9594        wp_register_script(
    9695            'wc-flutterwave-blocks',
    97             dirname( FLW_WC_PLUGIN_FILE ) . '/build/index.js',
     96            FLW_WC_URL . '/build/index.js',
    9897            array_merge( array( 'flutterwave' ), $dependencies ),
    9998            $version,
     
    116115     */
    117116    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'],
    152125        );
    153126    }
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/class-flutterwave.php

    r2904114 r2906082  
    7676        $this->define( 'FLW_WC_VERSION', $this->version );
    7777        $this->define( 'FLW_WC_MIN_WC_VER', '7.1' );
     78        $this->define( 'FLW_WC_URL', trailingslashit( plugins_url( '/', FLW_WC_PLUGIN_FILE ) ) );
    7879    }
    7980
     
    104105        // Check if WooCommerce is active.
    105106        if ( ! class_exists( 'WooCommerce' ) ) {
     107
    106108            add_action( 'admin_notices', array( $notices, 'woocommerce_not_installed' ) );
     109            return;
    107110        }
    108111
     
    121124        $this->register_payment_gateway();
    122125
    123         // add woocommerce block support.
    124         add_action( 'woocommerce_blocks_loaded', array( $this, 'flutterwave_woocommerce_blocks_support' ) );
    125126    }
    126127
     
    143144     */
    144145    public function includes() {
     146        // Include classes that can run on WP Freely.
    145147        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';
    147148    }
    148149
     
    219220
    220221    }
    221 
    222     /**
    223      * Register the Flutterwave payment gateway for WooCommerce Blocks.
    224      *
    225      * @return void
    226      */
    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     }
    246222}
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/class-flw-wc-payment-gateway.php

    r2904114 r2906082  
    245245                'title'       => __( 'Enter Secret Hash', 'woocommerce-rave' ),
    246246                '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' ),
    248248                'default'     => hash( 'sha256', 'Rave-Secret-Hash' ),
    249249            ),
     
    261261            ),
    262262            'test_public_key'    => array(
    263                 'title'       => __( 'Rave Test Public Key', 'woocommerce-rave' ),
     263                'title'       => __( 'Test Public Key', 'woocommerce-rave' ),
    264264                'type'        => 'text',
    265265                'description' => __( 'Required! Enter your Flutterwave test public key here', 'woocommerce-rave' ),
     
    267267            ),
    268268            'test_secret_key'    => array(
    269                 'title'       => __( 'Rave Test Secret Key', 'woocommerce-rave' ),
     269                'title'       => __( 'Test Secret Key', 'woocommerce-rave' ),
    270270                'type'        => 'password',
    271271                'description' => __( 'Required! Enter your Flutterwave test secret key here', 'woocommerce-rave' ),
     
    273273            ),
    274274            'live_public_key'    => array(
    275                 'title'       => __( 'Rave Live Public Key', 'woocommerce-rave' ),
     275                'title'       => __( 'Live Public Key', 'woocommerce-rave' ),
    276276                'type'        => 'text',
    277277                'description' => __( 'Required! Enter your Flutterwave live public key here', 'woocommerce-rave' ),
     
    279279            ),
    280280            'live_secret_key'    => array(
    281                 'title'       => __( 'Rave Live Secret Key', 'woocommerce-rave' ),
     281                'title'       => __( 'Live Secret Key', 'woocommerce-rave' ),
    282282                'type'        => 'password',
    283283                'description' => __( 'Required! Enter your Flutterwave live secret key here', 'woocommerce-rave' ),
     
    382382        include_once dirname( __FILE__ ) . '/client/class-flw-wc-payment-gateway-request.php';
    383383
    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 ) );
    387398
    388399        $response = $sdk->get_client()->request( $this->sdk::$standard_inline_endpoint, 'POST', $flutterwave_request );
     
    558569
    559570        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
    562578        }
    563579
     
    565581        $event = json_decode( $event );
    566582
     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
    567593        if ( 'charge.completed' === $event->event ) {
    568594            sleep( 6 );
     
    572598
    573599            $txn_ref  = sanitize_text_field( $event_data->tx_ref );
    574             $o        = explode( '_', sanitize_text_field( $txn_ref ) );
     600            $o        = explode( '_', $txn_ref );
    575601            $order_id = intval( $o[1] );
    576602            $order    = wc_get_order( $order_id );
     
    604630            $sdk->set_event_handler( new FlwEventHandler( $order ) )->webhook_verify( $event_type, $event_data );
    605631        }
     632
     633        wp_safe_redirect( home_url() );
     634        exit();
    606635    }
    607636
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/includes/client/class-flw-wc-payment-gateway-request.php

    r2904114 r2906082  
    7575     * @param \WC_Order $order Order object.
    7676     * @param string    $secret_key APi key.
     77     * @param bool      $testing is ci.
     78     * @throws \InvalidArgumentException When the secret key is not spplied.
    7779     *
    7880     * @return array
    7981     */
    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
    8698        $data_to_hash  = array(
    8799            'amount'     => $amount,
     
    99111            'payment_options' => 'card',
    100112            'redirect_url'    => $this->notify_url . '?order_id=' . $order_id,
    101             'checkout_hash'   => $checkout_hash,
     113            'payload_hash'    => $checkout_hash,
    102114            'customer'        => array(
    103115                'email'        => $email,
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/readme.txt

    r2904114 r2906082  
    11=== Flutterwave WooCommerce ===
    22Contributors: theflutterwave
    3 Tags: rave,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa
     3Tags: fintech,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa
    44Requires at least: 3.1
    55Tested up to: 6.1
    66Stable tag: 2.3.2
    77License: MIT
    8 License URI: https://github.com/Flutterwave/rave-woocommerce/blob/master/LICENSE
     8License URI: https://github.com/Flutterwave/Woocommerce/blob/master/LICENSE
    99
    1010The 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.
     
    24241. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication)
    25252. [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
     266. Supported PHP version: 7.4.0 - 8.1.0
    3027
    3128== Installation ==
     
    3936*   Activate the plugin.
    4037*   Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab.
    41 *   Click on the __Rave__ link from the available Checkout Options
     38*   Click on the __Flutterwave__ link from the available Checkout Options
    4239*   Configure your __Flutterwave Woocommerce__ settings accordingly.
    4340
     
    48454.  Activate the plugin.
    49465.  Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab.
    50 6.  Click on the __Rave__ link from the available Checkout Options
     476.  Click on the __Flutterwave__ link from the available Checkout Options
    51487. Configure your __Flutterwave WooCommerce__ settings accordingly.
    5249
     
    5451
    5552= Configure the plugin =
    56 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Rave__.
     53To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Flutterwave__.
    5754
    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.
    6158* Click __Save Changes__ to save your changes.
    6259
     
    10097
    10198== Changelog ==
     99= 2.3.2 =
     100* Added: Support for WooCommerce Blocks.
     101* Updated: WooCommerce Checkout Process.
    102102= 2.3.0 =
    103103* Fix: Handled MobileMoney Payment Handler Error.
  • rave-woocommerce-payment-gateway/tags/2.3.2-alpha/woocommerce-rave.php

    r2904114 r2906082  
    4040
    4141/**
     42 * Register the Flutterwave payment gateway for WooCommerce Blocks.
     43 *
     44 * @return void
     45 */
     46function 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.
     60add_action( 'woocommerce_blocks_loaded', 'flutterwave_woocommerce_blocks_support' );
     61
     62/**
    4263 * Add the Settings link to the plugin
    4364 *
  • 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  
    1717 */
    1818const 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>;
    2020};
    2121
     
    2626    name: PAYMENT_METHOD_NAME,
    2727    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` }
    3031            alt={ decodeEntities(
    31                 settings.title || __( 'Flutterwave', 'woocommerce-rave' )
     32                getBlocksConfiguration()?.title || __( 'Flutterwave', 'woocommerce-rave' )
    3233            ) }
    33         />
     34            />
     35            <b><h4>Flutterwave</h4></b>
     36        </div>
    3437    ),
    3538    placeOrderButtonLabel: __(
     
    4447    content: <Content />,
    4548    edit: <Content />,
    46     savedTokenComponent: <div>Flutterwave 3</div>,
    4749    paymentMethodId: PAYMENT_METHOD_NAME,
    4850    supports: {
  • rave-woocommerce-payment-gateway/trunk/client/blocks/utils.js

    r2904114 r2906082  
    55
    66export const getBlocksConfiguration = () => {
    7     const flutterwaveServerData = getSetting( 'flutterwave_data', null );
     7    const flutterwaveServerData = getSetting( 'rave_data', null );
    88
    99    if ( ! flutterwaveServerData ) {
  • rave-woocommerce-payment-gateway/trunk/i18n/languages/woocommerce-rave.pot

    r2904114 r2906082  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2023-04-25T22:00:34+00:00\n"
     12"POT-Creation-Date: 2023-04-29T11:59:03+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.7.1\n"
     
    3737msgstr ""
    3838
    39 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:164
     39#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:137
    4040msgid "Visa"
    4141msgstr ""
    4242
    43 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:168
     43#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:141
    4444msgid "American Express"
    4545msgstr ""
    4646
    47 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:172
     47#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:145
    4848msgid "Mastercard"
    4949msgstr ""
    5050
    51 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:179
     51#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:152
    5252msgctxt "Name of credit card"
    5353msgid "Discover"
    5454msgstr ""
    5555
    56 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:183
     56#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:156
    5757msgid "JCB"
    5858msgstr ""
    5959
    60 #: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:187
     60#: includes/blocks/class-flutterwave-wc-gateway-blocks-support.php:160
    6161msgid "Diners"
    6262msgstr ""
     
    164164
    165165#: 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"
     166msgid "Please change from default hash and ensure that <b>SECRET HASH</b> is the same with the one on your Flutterwave dashboard"
    167167msgstr ""
    168168
     
    181181
    182182#: includes/class-flw-wc-payment-gateway.php:263
    183 msgid "Rave Test Public Key"
     183msgid "Test Public Key"
    184184msgstr ""
    185185
     
    189189
    190190#: includes/class-flw-wc-payment-gateway.php:269
    191 msgid "Rave Test Secret Key"
     191msgid "Test Secret Key"
    192192msgstr ""
    193193
     
    197197
    198198#: includes/class-flw-wc-payment-gateway.php:275
    199 msgid "Rave Live Public Key"
     199msgid "Live Public Key"
    200200msgstr ""
    201201
     
    205205
    206206#: includes/class-flw-wc-payment-gateway.php:281
    207 msgid "Rave Live Secret Key"
     207msgid "Live Secret Key"
    208208msgstr ""
    209209
     
    331331
    332332#. translators: %s: url
    333 #: includes/class-flw-wc-payment-gateway.php:418
     333#: includes/class-flw-wc-payment-gateway.php:429
    334334msgid "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."
    335335msgstr ""
    336336
    337 #: includes/class-flw-wc-payment-gateway.php:495
     337#: includes/class-flw-wc-payment-gateway.php:506
    338338msgid "Order Payment"
    339339msgstr ""
    340340
    341 #: includes/client/class-flw-wc-payment-gateway-request.php:114
     341#: includes/client/class-flw-wc-payment-gateway-request.php:126
    342342msgid "Payment for order %s"
    343343msgstr ""
     
    366366msgstr ""
    367367
    368 #: client/blocks/payment-method/index.js:31
     368#: client/blocks/payment-method/index.js:19
     369msgid "You may be redirected to a secure page to complete your payment."
     370msgstr ""
     371
     372#: client/blocks/payment-method/index.js:32
    369373msgid "Flutterwave"
    370374msgstr ""
    371375
    372 #: client/blocks/payment-method/index.js:35
     376#: client/blocks/payment-method/index.js:38
    373377msgid "Proceed to Flutterwave"
    374378msgstr ""
    375379
    376 #: client/blocks/payment-method/index.js:41
     380#: client/blocks/payment-method/index.js:44
    377381msgid "Payment via Flutterwave"
    378382msgstr ""
  • rave-woocommerce-payment-gateway/trunk/includes/blocks/class-flutterwave-wc-gateway-blocks-support.php

    r2904114 r2906082  
    1212 */
    1313
     14defined( 'ABSPATH' ) || exit;
     15
    1416use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
    15 
    16 defined( 'ABSPATH' ) || exit;
    1717
    1818/**
     
    3434     * Settings from the WP options table
    3535     *
    36      * @var WC_Payment_Gateway|null
     36     * @var WC_Payment_Gateway
    3737     */
    38     protected ?WC_Payment_Gateway $gateway = null;
     38    protected WC_Payment_Gateway $gateway;
    3939
    4040    /**
     
    4545    public function initialize() {
    4646        $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();
    4948    }
    5049
     
    9594        wp_register_script(
    9695            'wc-flutterwave-blocks',
    97             dirname( FLW_WC_PLUGIN_FILE ) . '/build/index.js',
     96            FLW_WC_URL . '/build/index.js',
    9897            array_merge( array( 'flutterwave' ), $dependencies ),
    9998            $version,
     
    116115     */
    117116    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'],
    152125        );
    153126    }
  • rave-woocommerce-payment-gateway/trunk/includes/class-flutterwave.php

    r2904114 r2906082  
    7676        $this->define( 'FLW_WC_VERSION', $this->version );
    7777        $this->define( 'FLW_WC_MIN_WC_VER', '7.1' );
     78        $this->define( 'FLW_WC_URL', trailingslashit( plugins_url( '/', FLW_WC_PLUGIN_FILE ) ) );
    7879    }
    7980
     
    104105        // Check if WooCommerce is active.
    105106        if ( ! class_exists( 'WooCommerce' ) ) {
     107
    106108            add_action( 'admin_notices', array( $notices, 'woocommerce_not_installed' ) );
     109            return;
    107110        }
    108111
     
    121124        $this->register_payment_gateway();
    122125
    123         // add woocommerce block support.
    124         add_action( 'woocommerce_blocks_loaded', array( $this, 'flutterwave_woocommerce_blocks_support' ) );
    125126    }
    126127
     
    143144     */
    144145    public function includes() {
     146        // Include classes that can run on WP Freely.
    145147        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';
    147148    }
    148149
     
    219220
    220221    }
    221 
    222     /**
    223      * Register the Flutterwave payment gateway for WooCommerce Blocks.
    224      *
    225      * @return void
    226      */
    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     }
    246222}
  • rave-woocommerce-payment-gateway/trunk/includes/class-flw-wc-payment-gateway.php

    r2904114 r2906082  
    245245                'title'       => __( 'Enter Secret Hash', 'woocommerce-rave' ),
    246246                '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' ),
    248248                'default'     => hash( 'sha256', 'Rave-Secret-Hash' ),
    249249            ),
     
    261261            ),
    262262            'test_public_key'    => array(
    263                 'title'       => __( 'Rave Test Public Key', 'woocommerce-rave' ),
     263                'title'       => __( 'Test Public Key', 'woocommerce-rave' ),
    264264                'type'        => 'text',
    265265                'description' => __( 'Required! Enter your Flutterwave test public key here', 'woocommerce-rave' ),
     
    267267            ),
    268268            'test_secret_key'    => array(
    269                 'title'       => __( 'Rave Test Secret Key', 'woocommerce-rave' ),
     269                'title'       => __( 'Test Secret Key', 'woocommerce-rave' ),
    270270                'type'        => 'password',
    271271                'description' => __( 'Required! Enter your Flutterwave test secret key here', 'woocommerce-rave' ),
     
    273273            ),
    274274            'live_public_key'    => array(
    275                 'title'       => __( 'Rave Live Public Key', 'woocommerce-rave' ),
     275                'title'       => __( 'Live Public Key', 'woocommerce-rave' ),
    276276                'type'        => 'text',
    277277                'description' => __( 'Required! Enter your Flutterwave live public key here', 'woocommerce-rave' ),
     
    279279            ),
    280280            'live_secret_key'    => array(
    281                 'title'       => __( 'Rave Live Secret Key', 'woocommerce-rave' ),
     281                'title'       => __( 'Live Secret Key', 'woocommerce-rave' ),
    282282                'type'        => 'password',
    283283                'description' => __( 'Required! Enter your Flutterwave live secret key here', 'woocommerce-rave' ),
     
    382382        include_once dirname( __FILE__ ) . '/client/class-flw-wc-payment-gateway-request.php';
    383383
    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 ) );
    387398
    388399        $response = $sdk->get_client()->request( $this->sdk::$standard_inline_endpoint, 'POST', $flutterwave_request );
     
    558569
    559570        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
    562578        }
    563579
     
    565581        $event = json_decode( $event );
    566582
     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
    567593        if ( 'charge.completed' === $event->event ) {
    568594            sleep( 6 );
     
    572598
    573599            $txn_ref  = sanitize_text_field( $event_data->tx_ref );
    574             $o        = explode( '_', sanitize_text_field( $txn_ref ) );
     600            $o        = explode( '_', $txn_ref );
    575601            $order_id = intval( $o[1] );
    576602            $order    = wc_get_order( $order_id );
     
    604630            $sdk->set_event_handler( new FlwEventHandler( $order ) )->webhook_verify( $event_type, $event_data );
    605631        }
     632
     633        wp_safe_redirect( home_url() );
     634        exit();
    606635    }
    607636
  • rave-woocommerce-payment-gateway/trunk/includes/client/class-flw-wc-payment-gateway-request.php

    r2904114 r2906082  
    7575     * @param \WC_Order $order Order object.
    7676     * @param string    $secret_key APi key.
     77     * @param bool      $testing is ci.
     78     * @throws \InvalidArgumentException When the secret key is not spplied.
    7779     *
    7880     * @return array
    7981     */
    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
    8698        $data_to_hash  = array(
    8799            'amount'     => $amount,
     
    99111            'payment_options' => 'card',
    100112            'redirect_url'    => $this->notify_url . '?order_id=' . $order_id,
    101             'checkout_hash'   => $checkout_hash,
     113            'payload_hash'    => $checkout_hash,
    102114            'customer'        => array(
    103115                'email'        => $email,
  • rave-woocommerce-payment-gateway/trunk/readme.txt

    r2904114 r2906082  
    11=== Flutterwave WooCommerce ===
    22Contributors: theflutterwave
    3 Tags: rave,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa
     3Tags: fintech,flutterwave, woocommerce, payments, nigeria, mastercard, visa, target,Naira,payments,verve,donation,church,shop,store, ghana, kenya, international, mastercard, visa
    44Requires at least: 3.1
    55Tested up to: 6.1
    66Stable tag: 2.3.2
    77License: MIT
    8 License URI: https://github.com/Flutterwave/rave-woocommerce/blob/master/LICENSE
     8License URI: https://github.com/Flutterwave/Woocommerce/blob/master/LICENSE
    99
    1010The 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.
     
    24241. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication)
    25252. [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
     266. Supported PHP version: 7.4.0 - 8.1.0
    3027
    3128== Installation ==
     
    3936*   Activate the plugin.
    4037*   Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab.
    41 *   Click on the __Rave__ link from the available Checkout Options
     38*   Click on the __Flutterwave__ link from the available Checkout Options
    4239*   Configure your __Flutterwave Woocommerce__ settings accordingly.
    4340
     
    48454.  Activate the plugin.
    49465.  Click on "WooCommerce > Settings" from the left menu and click the "Checkout" tab.
    50 6.  Click on the __Rave__ link from the available Checkout Options
     476.  Click on the __Flutterwave__ link from the available Checkout Options
    51487. Configure your __Flutterwave WooCommerce__ settings accordingly.
    5249
     
    5451
    5552= Configure the plugin =
    56 To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Rave__.
     53To configure the plugin, go to __WooCommerce > Settings__ from the left menu, click __Checkout__ tab. Click on __Flutterwave__.
    5754
    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.
    6158* Click __Save Changes__ to save your changes.
    6259
     
    10097
    10198== Changelog ==
     99= 2.3.2 =
     100* Added: Support for WooCommerce Blocks.
     101* Updated: WooCommerce Checkout Process.
    102102= 2.3.0 =
    103103* Fix: Handled MobileMoney Payment Handler Error.
  • rave-woocommerce-payment-gateway/trunk/woocommerce-rave.php

    r2904114 r2906082  
    4040
    4141/**
     42 * Register the Flutterwave payment gateway for WooCommerce Blocks.
     43 *
     44 * @return void
     45 */
     46function 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.
     60add_action( 'woocommerce_blocks_loaded', 'flutterwave_woocommerce_blocks_support' );
     61
     62/**
    4263 * Add the Settings link to the plugin
    4364 *
Note: See TracChangeset for help on using the changeset viewer.