Skip to content

Commit

Permalink
Merge pull request #239 from pay-now/release/2.5.2
Browse files Browse the repository at this point in the history
Release/2.5.2
  • Loading branch information
DeveloperMovecloser authored Feb 2, 2024
2 parents 5869a52 + bc5c5f4 commit 667b99d
Show file tree
Hide file tree
Showing 43 changed files with 995 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ build
node_modules/
test-results/
playwright-report/

!src/Blocks/Payment/build/
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Changelog ==

= 2.5.2 (2024-02-02) =

- We have added support for woocommerce blocks

= 2.5.1 (2024-01-11) =

- We have added new security features to the payment system
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pay-now/paynow-woocommerce",
"description": "paynow.pl plugin for WooCommerce",
"license": "GPLv3",
"version": "2.5.1",
"version": "2.5.2",
"authors": [
{
"name": "mElements S.A.",
Expand Down
27 changes: 27 additions & 0 deletions package.json
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"
}
}
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tags: payment, payment gateway, paynow, woocommerce, płatności, payments, bramka płatności
Tested up to: 6.2
Requires PHP: 7.1
Stable tag: 2.5.1
Stable tag: 2.5.2
License: GPLv3

**pay**now is a secure online payment by bank transfers, BLIK and card.
Expand Down
67 changes: 67 additions & 0 deletions src/Blocks/Payment/abstract/class-paynow-payment-method.php
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();
}
}
4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-apple-pay-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => 'a729dcdfc951ba0e5b17',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-apple-pay-block.js

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

4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-blik-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => 'b84faacbc42ca524da05',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-blik-block.js

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

4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-card-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => 'cd445b690ee486bceaab',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-card-block.js

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',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-digital-wallets-block.js

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

4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-google-pay-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => '76a843566dc95ce582ca',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-google-pay-block.js

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

4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-paywall-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => 'ecf63bf6cabbb822c71a',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-paywall-block.js

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

4 changes: 4 additions & 0 deletions src/Blocks/Payment/build/paynow-pbl-block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => '73f50c24018bac626ab5',
);
1 change: 1 addition & 0 deletions src/Blocks/Payment/build/paynow-pbl-block.js

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

50 changes: 50 additions & 0 deletions src/Blocks/Payment/class-paynow-apple-pay-payment.php
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(),
);
}
}
51 changes: 51 additions & 0 deletions src/Blocks/Payment/class-paynow-blik-payment.php
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(),
);
}
}
51 changes: 51 additions & 0 deletions src/Blocks/Payment/class-paynow-card-payment.php
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(),
);
}
}
49 changes: 49 additions & 0 deletions src/Blocks/Payment/class-paynow-digital-wallets-payment.php
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(),
);
}
}
Loading

0 comments on commit 667b99d

Please sign in to comment.