Skip to content

Commit

Permalink
Merge pull request #18 from tubiz/release/2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tubiz authored Feb 17, 2024
2 parents b1e3ba9 + 0ee1757 commit e0623c5
Show file tree
Hide file tree
Showing 11 changed files with 18,936 additions and 14 deletions.
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

# Operating System files
.DS_Store
Thumbs.db

# IDE files
.idea
.vscode/*
project.xml
project.properties
.project
.settings*
*.sublime-project
*.sublime-workspace
.sublimelinterrc

# Sass
.sass-cache/

# Logs
logs/

# Environment files
wp-cli.local.yml
yarn-error.log
npm-debug.log
.pnpm-debug.log

# Build files
*.sql
*.swp
*.zip

# Built packages
build/
build-module/
build-style/
build-types/
dist/

# Project files
node_modules/
vendor/

# TypeScript files
tsconfig.tsbuildinfo

# wp-env config
.wp-env.override.json

# Unit tests
tmp/

# Composer
vendor/
bin/composer/**/vendor/
lib/vendor/
contributors.md
contributors.html
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

**Tags:** woocommerce, rave, flutterwave, payment gateway, payment gateways, mastercard, visa cards, verve cards, tubiz plugins, verve, nigeria, ghana, kenya, south africa, mpesa

**Requires at least:** 5.6
**Requires at least:** 5.8

**Requires PHP:** 7.4

**Tested up to:** 6.2
**Tested up to:** 6.4

**Stable tag:** 2.3
**Stable tag:** 2.4.0

**License:** GPLv2 or later

Expand Down Expand Up @@ -150,6 +150,11 @@ To configure the plugin, go to __WooCommerce > Settings__ from the left hand me

## Changelog

### 2.4.0 (February 17, 2024) =
* New: Add support for WooCommerce checkout block
* Tweak: Declare compatibility for High Performance Order Storage (HPOS)
* Update: WooCommerce 8.6 compatibility
*
### 2.3.1 (May 7, 2023) =
* Fix: Fix not supported charge currency error

Expand Down Expand Up @@ -200,8 +205,8 @@ To configure the plugin, go to __WooCommerce > Settings__ from the left hand me

## Upgrade Notice

### 2.3.1
* Fix not supported charge currency error
### 2.4.0
* Add support for WooCommerce Checkout Block. Declare compatibility for High Performance Order Storage (HPOS).

## Screenshots

Expand Down
1 change: 1 addition & 0 deletions assets/js/blocks/frontend/blocks.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'), 'version' => 'cad942b1d0bb2316b237');
1 change: 1 addition & 0 deletions assets/js/blocks/frontend/blocks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions includes/blocks/class-wc-gateway-flutterwave-blocks-support.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace Tubiz\Flutterwave_Woocommerce;

use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;

/**
* Flutterwave Blocks integration
*
* @since 2.4.0
*/
final class WC_Gateway_Flutterwave_Blocks_Support extends AbstractPaymentMethodType {

/**
* The gateway instance.
*
* @var WC_Gateway_Flutterwave_Blocks_Support
*/
private $gateway;

/**
* Payment method name/id/slug.
*
* @var string
*/
protected $name = 'tbz_rave';

/**
* Initializes the payment method type.
*/
public function initialize() {
$this->settings = get_option( 'woocommerce_tbz_rave_settings', array() );
$gateways = \WC()->payment_gateways->payment_gateways();
$this->gateway = $gateways[ $this->name ];
}

/**
* Returns if this payment method should be active. If false, the scripts will not be enqueued.
*
* @return boolean
*/
public function is_active() {
return $this->gateway->is_available();
}

/**
* Returns an array of scripts/handles to be registered for this payment method.
*
* @return array
*/
public function get_payment_method_script_handles() {
$script_asset_path = plugins_url( '/assets/js/blocks/frontend/blocks.asset.php', TBZ_WC_FLUTTERWAVE_MAIN_FILE );
$script_asset = file_exists( $script_asset_path )
? require $script_asset_path
: array(
'dependencies' => array(),
'version' => TBZ_WC_FLUTTERWAVE_VERSION,
);

$script_url = plugins_url( '/assets/js/blocks/frontend/blocks.js', TBZ_WC_FLUTTERWAVE_MAIN_FILE );

wp_register_script(
'wc-tbz-flutterwave-blocks',
$script_url,
$script_asset['dependencies'],
$script_asset['version'],
true
);

if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( 'wc-tbz-flutterwave-blocks', 'woo-rave' );
}

return array( 'wc-tbz-flutterwave-blocks' );
}

/**
* Returns an array of key=>value pairs of data made available to the payment methods script.
*
* @return array
*/
public function get_payment_method_data() {
$payment_method_logo = \WC_HTTPS::force_https_url( plugins_url( '/assets/images/powered-by-rave.png', TBZ_WC_FLUTTERWAVE_MAIN_FILE ) );

return array(
'title' => $this->get_setting( 'title' ),
'description' => $this->get_setting( 'description' ),
'checkout_image_url' => $payment_method_logo,
'supports' => array_filter( $this->gateway->supports, array( $this->gateway, 'supports' ) ),
);
}
}
Loading

0 comments on commit e0623c5

Please sign in to comment.