-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from tubiz/release/2.4.0
- Loading branch information
Showing
11 changed files
with
18,936 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
includes/blocks/class-wc-gateway-flutterwave-blocks-support.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ) ), | ||
); | ||
} | ||
} |
Oops, something went wrong.