Skip to content

Commit

Permalink
Merge pull request #249 from pay-now/release/2.5.6
Browse files Browse the repository at this point in the history
Release/2.5.6
  • Loading branch information
DeveloperMovecloser authored Aug 12, 2024
2 parents 2ac713f + f6590fd commit e424ffb
Show file tree
Hide file tree
Showing 40 changed files with 288 additions and 238 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ build
node_modules/
test-results/
playwright-report/
composer.lock
docker-compose.yml

!src/Blocks/Payment/build/
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
== Changelog ==
= 2.5.6 (2024-08-12) =

- Purchasing process improvements and fixes

= 2.5.5 (2024-06-27) =

- Fix BLIK code validation
Expand Down
8 changes: 4 additions & 4 deletions 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.5",
"version": "2.5.6",
"authors": [
{
"name": "mElements S.A.",
Expand All @@ -12,8 +12,8 @@
"type": "woocommerce-plugin",
"minimum-stability": "stable",
"require": {
"php": ">=7.1",
"pay-now/paynow-php-sdk": "^2.3.1",
"php": ">=7.2",
"pay-now/paynow-php-sdk": "^2.4.1",
"nyholm/psr7": "^1.2",
"php-http/curl-client": "^2.1",
"ext-json": "*"
Expand All @@ -32,7 +32,7 @@
},
"config": {
"platform": {
"php": "7.1"
"php": "7.2"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Pay by paynow.pl ===
Tags: payment, payment gateway, paynow, woocommerce, płatności, payments, bramka płatności
Tested up to: 6.4
Requires PHP: 7.1
Stable tag: 2.5.5
Requires PHP: 7.2
Stable tag: 2.5.6
License: GPLv3

**pay**now is a secure online payment by bank transfers, BLIK and card.
Expand Down
1 change: 0 additions & 1 deletion src/Blocks/Payment/build/paynow-apple-pay-block.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => '9cdc28fc4e882254f8e8',
'version' => 'bfcba2c406f9d8135476',
);
2 changes: 1 addition & 1 deletion 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: 0 additions & 4 deletions src/Blocks/Payment/build/paynow-google-pay-block.asset.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Blocks/Payment/build/paynow-google-pay-block.js

This file was deleted.

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

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

2 changes: 1 addition & 1 deletion src/Blocks/Payment/build/paynow-pbl-block.asset.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php return array(
'dependencies' => array( 'react' ),
'version' => '73f50c24018bac626ab5',
'version' => '3e047fa35c5c723acf1f',
);
2 changes: 1 addition & 1 deletion 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.

2 changes: 2 additions & 0 deletions src/Blocks/Payment/class-paynow-digital-wallets-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public function get_payment_method_data() {
'title' => __( 'Digital wallets', 'pay-by-paynow-pl' ),
'description' => __( 'Secure and fast payments provided by paynow.pl', 'pay-by-paynow-pl' ),
'available' => $this->is_available(),
'iconurl' => $this->payment_method ? $this->payment_method->get_paynow_icon_url() : '',
'fields' => $this->get_payment_fields(),
);
}
}
50 changes: 0 additions & 50 deletions src/Blocks/Payment/class-paynow-google-pay-payment.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
namespace PayByPaynowPl\Blocks\Payments;

/**
* Class Paynow_Apple_Pay_Payment
* Class Paynow_PayPo_Payment
*/
class Paynow_Apple_Pay_Payment extends Paynow_Payment_Method {
class Paynow_PayPo_Payment extends Paynow_Payment_Method {
/**
* Payment method name. Matches gateway ID.
*
* @var string
*/
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'apple_pay';
protected $name = WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'paypo';

/**
* Loads the payment method scripts.
Expand All @@ -25,13 +25,13 @@ class Paynow_Apple_Pay_Payment extends Paynow_Payment_Method {
*/
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';
$path = plugins_url( 'build/paynow-paypo-block.js', __FILE__ );
$handle = 'paynow-paypo-checkout-block';
$dependencies = array( 'wp-hooks' );

wp_register_script( $handle, $path, $dependencies, $version, true );

return array( 'paynow-apple-pay-checkout-block' );
return array( $handle );
}

/**
Expand All @@ -41,10 +41,11 @@ public function get_payment_method_script_handles() {
*/
public function get_payment_method_data() {
return array(
'title' => __( 'Apple Pay', 'pay-by-paynow-pl' ),
'title' => __( 'Buy now, pay later', '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',
'iconurl' => 'https://static.paynow.pl/payment-method-icons/3000.png',
'available' => $this->is_available(),
'fields' => $this->get_payment_fields(),
);
}
}
38 changes: 0 additions & 38 deletions src/Blocks/Payment/src/js/paynow-apple-pay-payment-block.js

This file was deleted.

39 changes: 37 additions & 2 deletions src/Blocks/Payment/src/js/paynow-digital-wallets-payment-block.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
const { decodeEntities } = wp.htmlEntities;
const { getSetting } = wc.wcSettings;
const { registerPaymentMethod } = wc.wcBlocksRegistry;
const { useEffect } = wp.element;

// Data
const settings = getSetting('pay_by_paynow_pl_digital_wallets_data', {});
const title = decodeEntities(settings.title || 'Digital wallets');
const description = decodeEntities(settings.description || '');
const iconUrl = settings.iconurl;
const available = decodeEntities(settings.available || false);
const fields = decodeEntities(settings.fields || '');

const canMakePayment = () => {
return available;
};

const Content = props => {
return <div>{description}</div>;
const { eventRegistration, emitResponse } = props;
const { onPaymentProcessing } = eventRegistration;
useEffect( () => {
const unsubscribe = onPaymentProcessing( async () => {
const paymentMethodIdInput = document.querySelector('#paynow_block_digital-wallets input[name="paymentMethodId"]:checked');
const paymentMethodId = paymentMethodIdInput ? paymentMethodIdInput.value : false;

if ( paymentMethodId ) {
return {
type: emitResponse.responseTypes.SUCCESS,
meta: {
paymentMethodData: {
'paymentMethodId': paymentMethodId,
},
},
};
}

return {
type: emitResponse.responseTypes.ERROR,
message: 'Payment method ID does not exists',
};
} );
return () => {
unsubscribe();
};
}, [
emitResponse.responseTypes.ERROR,
emitResponse.responseTypes.SUCCESS,
onPaymentProcessing,
] );
return <div id="paynow_block_digital-wallets" dangerouslySetInnerHTML={{__html: fields}}></div>;
};

const Label = props => {
const { PaymentMethodLabel } = props.components;
return <PaymentMethodLabel className='paynow-block-label' text={title} />;
const icon = <img src={iconUrl} alt={title} name={title} />
return <PaymentMethodLabel className='paynow-block-label' text={title} icon={icon} />;
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
const { decodeEntities } = wp.htmlEntities;
const { getSetting } = wc.wcSettings;
const { registerPaymentMethod } = wc.wcBlocksRegistry;
const { useEffect } = wp.element;

// Data
const settings = getSetting('pay_by_paynow_pl_google_pay_data', {});
const title = decodeEntities(settings.title || 'Google Pay');
const description = decodeEntities(settings.description || '');
const settings = getSetting('pay_by_paynow_pl_paypo_data', {});
const title = decodeEntities(settings.title || 'Card');
const iconUrl = settings.iconurl;
const available = decodeEntities(settings.available || false);
const fields = decodeEntities(settings.fields || '');

const canMakePayment = () => {
return available;
};

const Content = props => {
return <div>{description}</div>;
return <div dangerouslySetInnerHTML={{__html: fields}}></div>;
};

const Label = props => {
Expand All @@ -24,15 +25,15 @@ const Label = props => {
};

/**
* Paynow Google Pay method config.
* Paynow PayPo method config.
*/
const PaynowGooglePayOptions = {
name: 'pay_by_paynow_pl_google_pay',
const PaynowPayPoOptions = {
name: 'pay_by_paynow_pl_paypo',
label: <Label />,
content: <Content />,
edit: <Content />,
canMakePayment: canMakePayment,
ariaLabel: title
};

registerPaymentMethod(PaynowGooglePayOptions);
registerPaymentMethod(PaynowPayPoOptions);
4 changes: 2 additions & 2 deletions src/Blocks/Payment/src/js/paynow-pbl-payment-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Content = props => {
const { onPaymentProcessing } = eventRegistration;
useEffect( () => {
const unsubscribe = onPaymentProcessing( async () => {
const paymentMethodIdInput = document.querySelector('input[name="paymentMethodId"]:checked');
const paymentMethodIdInput = document.querySelector('#paynow_block_pbl input[name="paymentMethodId"]:checked');
const paymentMethodId = paymentMethodIdInput ? paymentMethodIdInput.value : false;

if ( paymentMethodId ) {
Expand All @@ -47,7 +47,7 @@ const Content = props => {
emitResponse.responseTypes.SUCCESS,
onPaymentProcessing,
] );
return <div dangerouslySetInnerHTML={{__html: fields}}></div>;
return <div id="paynow_block_pbl" dangerouslySetInnerHTML={{__html: fields}}></div>;
};

const Label = props => {
Expand Down
Loading

0 comments on commit e424ffb

Please sign in to comment.