-
Notifications
You must be signed in to change notification settings - Fork 28
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 #179 from wordpress-parsi/5.0.1
Incompleted PR
- Loading branch information
Showing
16 changed files
with
1,734 additions
and
128 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,19 @@ | ||
const wppMellatPG_data = window.wc.wcSettings.getSetting( 'mellat_data', {} ); | ||
const wppMellatPG_label = window.wp.htmlEntities.decodeEntities( wppMellatPG_data.title ) | ||
|| window.wp.i18n.__( 'Mellat Bank', 'wp-parsidate' ); | ||
const wppMellatPG_content = ( wppMellatPG_data ) => { | ||
return window.wp.htmlEntities.decodeEntities( wppMellatPG_data.description ); | ||
}; | ||
const wppMellatPG = { | ||
name: 'mellat', | ||
label: wppMellatPG_label, | ||
content: Object( window.wp.element.createElement )( wppMellatPG_content, null ), | ||
edit: Object( window.wp.element.createElement )( wppMellatPG_content, null ), | ||
canMakePayment: () => true, | ||
placeOrderButtonLabel: window.wp.i18n.__( 'Continue', 'wp-parsidate' ), | ||
ariaLabel: wppMellatPG_label, | ||
supports: { | ||
features: wppMellatPG_data.supports, | ||
}, | ||
}; | ||
window.wc.wcBlocksRegistry.registerPaymentMethod( wppMellatPG ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
const wppParsianPG_data = window.wc.wcSettings.getSetting( 'parsian_data', {} ); | ||
const wppParsianPG_label = window.wp.htmlEntities.decodeEntities( wppParsianPG_data.title ) | ||
|| window.wp.i18n.__( 'Parsian Bank', 'wp-parsidate' ); | ||
const wppParsianPG_content = ( wppParsianPG_data ) => { | ||
return window.wp.htmlEntities.decodeEntities( wppParsianPG_data.description ); | ||
}; | ||
const wppParsianPG = { | ||
name: 'parsian', | ||
label: wppParsianPG_label, | ||
content: Object( window.wp.element.createElement )( wppParsianPG_content, null ), | ||
edit: Object( window.wp.element.createElement )( wppParsianPG_content, null ), | ||
canMakePayment: () => true, | ||
placeOrderButtonLabel: window.wp.i18n.__( 'Continue', 'wp-parsidate' ), | ||
ariaLabel: wppParsianPG_label, | ||
supports: { | ||
features: wppParsianPG_data.supports, | ||
}, | ||
}; | ||
window.wc.wcBlocksRegistry.registerPaymentMethod( wppParsianPG ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
const wppPasargadPG_data = window.wc.wcSettings.getSetting( 'pasargad_data', {} ); | ||
const wppPasargadPG_label = window.wp.htmlEntities.decodeEntities( wppPasargadPG_data.title ) | ||
|| window.wp.i18n.__( 'Pasargad Bank', 'wp-parsidate' ); | ||
const wppPasargadPG_content = ( wppPasargadPG_data ) => { | ||
return window.wp.htmlEntities.decodeEntities( wppPasargadPG_data.description ); | ||
}; | ||
const wppPasargadPG = { | ||
name: 'pasargad', | ||
label: wppPasargadPG_label, | ||
content: Object( window.wp.element.createElement )( wppPasargadPG_content, null ), | ||
edit: Object( window.wp.element.createElement )( wppPasargadPG_content, null ), | ||
canMakePayment: () => true, | ||
placeOrderButtonLabel: window.wp.i18n.__( 'Continue', 'wp-parsidate' ), | ||
ariaLabel: wppPasargadPG_label, | ||
supports: { | ||
features: wppPasargadPG_data.supports, | ||
}, | ||
}; | ||
window.wc.wcBlocksRegistry.registerPaymentMethod( wppPasargadPG ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
includes/plugins/wc-gateways/blocks/wpp-mellat-pg-block.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,81 @@ | ||
<?php | ||
|
||
defined( 'ABSPATH' ) or exit( 'No direct script access allowed' ); | ||
|
||
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; | ||
|
||
if ( ! class_exists( 'WPP_WC_Mellat_Gateway_Blocks' ) ) { | ||
final class WPP_WC_Mellat_Gateway_Blocks extends AbstractPaymentMethodType { | ||
|
||
private $gateway; | ||
|
||
/** | ||
* Payment method name/id/slug. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'mellat'; | ||
|
||
|
||
/** | ||
* Initializes the payment method type. | ||
*/ | ||
public function initialize() { | ||
$class_name = get_class( $this ); | ||
$this->settings = get_option( "woocommerce_{$this->name}_settings", [] ); | ||
$this->gateway = new $class_name; | ||
} | ||
|
||
/** | ||
* Returns if this payment method should be active. If false, the scripts will not be enqueued. | ||
* | ||
* @return boolean | ||
*/ | ||
public function is_active() { | ||
return filter_var( $this->get_setting( 'enabled', true ), FILTER_VALIDATE_BOOLEAN ); | ||
} | ||
|
||
/** | ||
* Returns an array of scripts/handles to be registered for this payment method. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$script_id = "wpp-wc-$this->name-blocks-integration"; | ||
$script_name = "wpp-wc-$this->name-pg.js"; | ||
|
||
wp_register_script( | ||
$script_id, | ||
WP_PARSI_URL . "assets/js/wc-pg-blocks/$script_name", | ||
array( | ||
'wc-blocks-registry', | ||
'wc-settings', | ||
'wp-element', | ||
'wp-html-entities', | ||
'wp-i18n', | ||
), | ||
false, | ||
true | ||
); | ||
|
||
if ( function_exists( 'wp_set_script_translations' ) ) { | ||
wp_set_script_translations( $script_id, 'wp-parsidate', WP_PARSI_DIR . 'languages/' ); | ||
} | ||
|
||
return array( $script_id ); | ||
} | ||
|
||
/** | ||
* Returns an array of key=>value pairs of data made available to the payment methods script. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => $this->get_setting( 'title' ), | ||
'description' => $this->get_setting( 'description' ), | ||
'supports' => $this->get_supported_features(), | ||
); | ||
} | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
includes/plugins/wc-gateways/blocks/wpp-parsian-pg-block.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,83 @@ | ||
<?php | ||
|
||
defined( 'ABSPATH' ) or exit( 'No direct script access allowed' ); | ||
|
||
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; | ||
|
||
if ( ! class_exists( 'WPP_WC_Parsian_Gateway_Blocks' ) ) { | ||
final class WPP_WC_Parsian_Gateway_Blocks extends AbstractPaymentMethodType { | ||
|
||
private $gateway; | ||
|
||
/** | ||
* Payment method name/id/slug. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'parsian'; | ||
|
||
|
||
/** | ||
* Initializes the payment method type. | ||
*/ | ||
public function initialize() { | ||
$class_name = get_class( $this ); | ||
$this->settings = get_option( "woocommerce_{$this->name}_settings", [] ); | ||
$this->gateway = new $class_name; | ||
} | ||
|
||
/** | ||
* Returns if this payment method should be active. If false, the scripts will not be enqueued. | ||
* | ||
* @return boolean | ||
*/ | ||
public function is_active() { | ||
return filter_var( $this->get_setting( 'enabled', true ), FILTER_VALIDATE_BOOLEAN ); | ||
} | ||
|
||
/** | ||
* Returns an array of scripts/handles to be registered for this payment method. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$script_id = "wpp-wc-$this->name-blocks-integration"; | ||
$script_name = "wpp-wc-$this->name-pg"; | ||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || wpp_is_active( 'dev_mode' ) ? '' : '.min'; | ||
|
||
|
||
wp_register_script( | ||
$script_id, | ||
WP_PARSI_URL . "assets/js/wc-pg-blocks/$script_name$suffix.js", | ||
array( | ||
'wc-blocks-registry', | ||
'wc-settings', | ||
'wp-element', | ||
'wp-html-entities', | ||
'wp-i18n', | ||
), | ||
false, | ||
true | ||
); | ||
|
||
if ( function_exists( 'wp_set_script_translations' ) ) { | ||
wp_set_script_translations( $script_id, 'wp-parsidate', WP_PARSI_DIR . 'languages/' ); | ||
} | ||
|
||
return array( $script_id ); | ||
} | ||
|
||
/** | ||
* Returns an array of key=>value pairs of data made available to the payment methods script. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => $this->get_setting( 'title' ), | ||
'description' => $this->get_setting( 'description' ), | ||
'supports' => $this->get_supported_features(), | ||
); | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
includes/plugins/wc-gateways/blocks/wpp-pasargad-pg-block.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,81 @@ | ||
<?php | ||
|
||
defined( 'ABSPATH' ) or exit( 'No direct script access allowed' ); | ||
|
||
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; | ||
|
||
if ( ! class_exists( 'WPP_WC_Pasargad_Gateway_Blocks' ) ) { | ||
final class WPP_WC_Pasargad_Gateway_Blocks extends AbstractPaymentMethodType { | ||
|
||
private $gateway; | ||
|
||
/** | ||
* Payment method name/id/slug. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'pasargad'; | ||
|
||
|
||
/** | ||
* Initializes the payment method type. | ||
*/ | ||
public function initialize() { | ||
$class_name = get_class( $this ); | ||
$this->settings = get_option( "woocommerce_{$this->name}_settings", [] ); | ||
$this->gateway = new $class_name; | ||
} | ||
|
||
/** | ||
* Returns if this payment method should be active. If false, the scripts will not be enqueued. | ||
* | ||
* @return boolean | ||
*/ | ||
public function is_active() { | ||
return filter_var( $this->get_setting( 'enabled', true ), FILTER_VALIDATE_BOOLEAN ); | ||
} | ||
|
||
/** | ||
* Returns an array of scripts/handles to be registered for this payment method. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$script_id = "wpp-wc-$this->name-blocks-integration"; | ||
$script_name = "wpp-wc-$this->name-pg.js"; | ||
|
||
wp_register_script( | ||
$script_id, | ||
WP_PARSI_URL . "assets/js/wc-pg-blocks/$script_name", | ||
array( | ||
'wc-blocks-registry', | ||
'wc-settings', | ||
'wp-element', | ||
'wp-html-entities', | ||
'wp-i18n', | ||
), | ||
false, | ||
true | ||
); | ||
|
||
if ( function_exists( 'wp_set_script_translations' ) ) { | ||
wp_set_script_translations( $script_id, 'wp-parsidate', WP_PARSI_DIR . 'languages/' ); | ||
} | ||
|
||
return array( $script_id ); | ||
} | ||
|
||
/** | ||
* Returns an array of key=>value pairs of data made available to the payment methods script. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => $this->get_setting( 'title' ), | ||
'description' => $this->get_setting( 'description' ), | ||
'supports' => $this->get_supported_features(), | ||
); | ||
} | ||
} | ||
} |
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,3 @@ | ||
<?php | ||
|
||
// Silence is golden |
Oops, something went wrong.