-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
Release/2.5.2
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ build | |
node_modules/ | ||
test-results/ | ||
playwright-report/ | ||
|
||
!src/Blocks/Payment/build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "pay-by-paynow-pl", | ||
"title": "WooCommerce Pay by Paynow", | ||
"version": "1.0.0", | ||
"author": "WooCommerce", | ||
"license": "GPL-3.0+", | ||
"keywords": [], | ||
"engines": { | ||
"node": ">=6.9.4", | ||
"npm": ">=1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@woocommerce/dependency-extraction-webpack-plugin": "^2.2.0", | ||
"@wordpress/scripts": "^26.10.0", | ||
"cross-env": "7.0.3" | ||
}, | ||
"scripts": { | ||
"start": "wp-scripts start", | ||
"build": "wp-scripts build", | ||
"i18n": "npm run i18n:build", | ||
"i18n:build": "npm run i18n:pot && ./bin/build_i18n.sh", | ||
"i18n:pot": "php -d xdebug.max_nesting_level=512 $(which wp) i18n make-pot --exclude=\"node_modules/,languages/,assets/\" --headers='{\"Report-Msgid-Bugs-To\":\"https://woocommerce.com/my-account/create-a-ticket/\", \"language-team\":\"LANGUAGE <EMAIL@ADDRESS>\"}' . languages/woocommerce-gateway-dummy.pot", | ||
"i18n:json": "$(which wp) i18n make-json languages --no-purge", | ||
"packages-update": "wp-scripts packages-update", | ||
"check-engines": "wp-scripts check-engines" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace PayByPaynowPl\Blocks\Payments; | ||
|
||
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; | ||
|
||
/** | ||
* Class PaynowPaymentMethod | ||
*/ | ||
class Paynow_Payment_Method extends AbstractPaymentMethodType { | ||
|
||
/** | ||
* @var null|WC_Gateway_Pay_By_Paynow_PL | ||
*/ | ||
protected $payment_method = null; | ||
|
||
/** | ||
* Initializes block. | ||
* | ||
* @return void | ||
*/ | ||
public function initialize() { | ||
$payment_methods = WC()->payment_gateways()->payment_gateways(); | ||
|
||
foreach ( $payment_methods as $key => $gateway ) { | ||
if ( $key === $this->name ) { | ||
$this->payment_method = $gateway; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Checks if the payment method is active or not. | ||
* | ||
* @return boolean | ||
*/ | ||
public function is_active() { | ||
return 'yes' === ( $this->payment_method ? $this->payment_method->enabled : 'no' ); | ||
} | ||
|
||
/** | ||
* @return false|string|null | ||
*/ | ||
protected function get_payment_fields() { | ||
if ( empty( $this->payment_method ) ) { | ||
return null; | ||
} | ||
|
||
ob_start(); | ||
$this->payment_method->payment_fields(); | ||
$fields = ob_get_clean(); | ||
|
||
return $fields; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
protected function is_available() { | ||
if ( empty( $this->payment_method ) ) { | ||
return false; | ||
} | ||
|
||
return $this->payment_method->is_available(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => 'a729dcdfc951ba0e5b17', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => 'b84faacbc42ca524da05', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => 'cd445b690ee486bceaab', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => '9cdc28fc4e882254f8e8', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => '76a843566dc95ce582ca', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => 'ecf63bf6cabbb822c71a', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php return array( | ||
'dependencies' => array( 'react' ), | ||
'version' => '73f50c24018bac626ab5', | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Paynow payment block for WooCommerce | ||
* | ||
* @package WooCommerce/Blocks | ||
*/ | ||
|
||
namespace PayByPaynowPl\Blocks\Payments; | ||
|
||
/** | ||
* Class Paynow_Apple_Pay_Payment | ||
*/ | ||
class Paynow_Apple_Pay_Payment extends Paynow_Payment_Method { | ||
/** | ||
* Payment method name. Matches gateway ID. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'apple_pay'; | ||
|
||
/** | ||
* Loads the payment method scripts. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$version = wc_pay_by_paynow_pl_plugin_version(); | ||
$path = plugins_url( 'build/paynow-apple-pay-block.js', __FILE__ ); | ||
$handle = 'paynow-apple-pay-checkout-block'; | ||
$dependencies = array( 'wp-hooks' ); | ||
|
||
wp_register_script( $handle, $path, $dependencies, $version, true ); | ||
|
||
return array( 'paynow-apple-pay-checkout-block' ); | ||
} | ||
|
||
/** | ||
* Gets the payment method data to load into the frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => __( 'Apple Pay', 'pay-by-paynow-pl' ), | ||
'description' => __( 'Secure and fast payments provided by paynow.pl', 'pay-by-paynow-pl' ), | ||
'iconurl' => 'https://static.paynow.pl/payment-method-icons/2004.png', | ||
'available' => $this->is_available(), | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Paynow payment block for WooCommerce | ||
* | ||
* @package WooCommerce/Blocks | ||
*/ | ||
|
||
namespace PayByPaynowPl\Blocks\Payments; | ||
|
||
/** | ||
* Class PaynowBlikPayment | ||
*/ | ||
class Paynow_Blik_Payment extends Paynow_Payment_Method { | ||
/** | ||
* Payment method name. Matches gateway ID. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'blik'; | ||
|
||
/** | ||
* Loads the payment method scripts. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$version = wc_pay_by_paynow_pl_plugin_version(); | ||
$path = plugins_url( 'build/paynow-blik-block.js', __FILE__ ); | ||
$handle = 'paynow-blik-checkout-block'; | ||
$dependencies = array( 'wp-hooks' ); | ||
|
||
wp_register_script( $handle, $path, $dependencies, $version, true ); | ||
|
||
return array( 'paynow-blik-checkout-block' ); | ||
} | ||
|
||
/** | ||
* Gets the payment method data to load into the frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => __( 'BLIK payment', 'pay-by-paynow-pl' ), | ||
'description' => __( 'Secure and fast payments provided by paynow.pl', 'pay-by-paynow-pl' ), | ||
'iconurl' => 'https://static.paynow.pl/payment-method-icons/2007.png', | ||
'available' => $this->is_available(), | ||
'fields' => $this->get_payment_fields(), | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Paynow payment block for WooCommerce | ||
* | ||
* @package WooCommerce/Blocks | ||
*/ | ||
|
||
namespace PayByPaynowPl\Blocks\Payments; | ||
|
||
/** | ||
* Class PaynowCardPayment | ||
*/ | ||
class Paynow_Card_Payment extends Paynow_Payment_Method { | ||
/** | ||
* Payment method name. Matches gateway ID. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'card'; | ||
|
||
/** | ||
* Loads the payment method scripts. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$version = wc_pay_by_paynow_pl_plugin_version(); | ||
$path = plugins_url( 'build/paynow-card-block.js', __FILE__ ); | ||
$handle = 'paynow-card-checkout-block'; | ||
$dependencies = array( 'wp-hooks' ); | ||
|
||
wp_register_script( $handle, $path, $dependencies, $version, true ); | ||
|
||
return array( 'paynow-card-checkout-block' ); | ||
} | ||
|
||
/** | ||
* Gets the payment method data to load into the frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => __( 'Card payment', 'pay-by-paynow-pl' ), | ||
'description' => __( 'Secure and fast payments provided by paynow.pl', 'pay-by-paynow-pl' ), | ||
'iconurl' => 'https://static.paynow.pl/payment-method-icons/2002.png', | ||
'available' => $this->is_available(), | ||
'fields' => $this->get_payment_fields(), | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Paynow payment block for WooCommerce | ||
* | ||
* @package WooCommerce/Blocks | ||
*/ | ||
|
||
namespace PayByPaynowPl\Blocks\Payments; | ||
|
||
/** | ||
* Class PaynowDigitalWalletsPayment | ||
*/ | ||
class Paynow_Digital_Wallets_Payment extends Paynow_Payment_Method { | ||
/** | ||
* Payment method name. Matches gateway ID. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'digital_wallets'; | ||
|
||
/** | ||
* Loads the payment method scripts. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_script_handles() { | ||
$version = wc_pay_by_paynow_pl_plugin_version(); | ||
$path = plugins_url( 'build/paynow-digital-wallets-block.js', __FILE__ ); | ||
$handle = 'paynow-digital-wallets-checkout-block'; | ||
$dependencies = array( 'wp-hooks' ); | ||
|
||
wp_register_script( $handle, $path, $dependencies, $version, true ); | ||
|
||
return array( 'paynow-digital-wallets-checkout-block' ); | ||
} | ||
|
||
/** | ||
* Gets the payment method data to load into the frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function get_payment_method_data() { | ||
return array( | ||
'title' => __( 'Digital wallets', 'pay-by-paynow-pl' ), | ||
'description' => __( 'Secure and fast payments provided by paynow.pl', 'pay-by-paynow-pl' ), | ||
'available' => $this->is_available(), | ||
); | ||
} | ||
} |