Skip to content

Commit

Permalink
Merge pull request #238 from pay-now/release/2.5.1
Browse files Browse the repository at this point in the history
Release/2.5.1
  • Loading branch information
DeveloperMovecloser authored Jan 12, 2024
2 parents fe24629 + f9def6d commit 5869a52
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 22 deletions.
36 changes: 36 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
== Changelog ==

= 2.5.1 (2024-01-11) =

- We have added new security features to the payment system
- We have fixed processing info collapsing script
- We have added changelog to plugin repository
- We have changed the appearance of the selected online payment method

= 2.5.0 (2023-12-13) =

- We have added support for the latest SDK version
- We have added new payment features
- We have fixed a bug related to page editing in Elementor
- We have fixed a wrong typing error in the function fetching payment methods from the Paynow API

= 2.4.32 (2023-11-24) =

- We improved the WooCommerce HPOS compatibility declaration
- We set digital wallets to be active by default

= 2.4.31 (2023-11-22) =

- We added WooCommerce HPOS support
- We added a general payment method for digital wallets
- We added additional error logging and additional handling of validation errors when processing payments

= 2.4.30 (2023-11-08) =

- We improved payment methods display system
- We have fixed an error in sending product data to paynow when there were products without a category in the cart

= 2.4.29 (2023-10-24) =

- We removed the translation overriding mechanism from GlotPress
- We uploaded the latest translations downloaded from GlotPress
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.0",
"version": "2.5.1",
"authors": [
{
"name": "mElements S.A.",
Expand Down
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.0
Stable tag: 2.5.1
License: GPLv3

**pay**now is a secure online payment by bank transfers, BLIK and card.
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cp -R assets dist
cp -R vendor dist/pay-by-paynow-pl
cp -R src/* dist/pay-by-paynow-pl
cp -f readme.txt dist/pay-by-paynow-pl/
cp -f changelog.txt dist/pay-by-paynow-pl/
cp -f LICENSE dist/pay-by-paynow-pl/license.txt

echo "Preparing zip"
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/front.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
}

.paynow-payment-option-pbl input[type=radio]:checked + label {
border: 1px solid #d2d2d2;
border: 2px solid #16A035;
background: #f3f3f3;
}

Expand Down
56 changes: 41 additions & 15 deletions src/assets/js/front.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
jQuery( document ).ready(function () {
setTimeout(
function () {
jQuery( '.paynow-data-processing-info-less .expand' ).on(
'click',
function () {
let $target = jQuery( jQuery( this ).data( 'target' ) );
if ( ! $target.hasClass( 'show' )) {
$target.slideDown();
$target.addClass( 'show' );
jQuery( this ).text( jQuery( this ).data( 'expanded-text' ) );
} else {
$target.slideUp();
$target.removeClass( 'show' );
jQuery( this ).text( jQuery( this ).data( 'collapsed-text' ) );
}
}
);
jQuery( '.paynow-data-processing-info-less .expand' ).off( 'click', toggleProcessingInfo ).on( 'click', toggleProcessingInfo );
},
1000
);

addApplePayEnabledToCookie();
addFingerprintToCardPayment();

jQuery( 'body' ).on( 'updated_checkout', function () {
jQuery( '.paynow-data-processing-info-less .expand' ).off( 'click', toggleProcessingInfo ).on( 'click', toggleProcessingInfo );
addFingerprintToCardPayment();
});

jQuery(document).on('click', '.paynow-payment-card-menu .paynow-payment-card-menu-button', function (e) {
jQuery(e.currentTarget).siblings().toggleClass('--hidden');
Expand Down Expand Up @@ -70,6 +62,27 @@ function addApplePayEnabledToCookie() {
document.cookie = 'applePayEnabled=' + (applePayEnabled ? '1' : '0');
}

function addFingerprintToCardPayment() {
const input = jQuery('#payment-method-fingerprint');

if (!input.length) {
return;
}

try {
const fpPromise = import('https://static.paynow.pl/scripts/PyG5QjFDUI.min.js')
.then(FingerprintJS => FingerprintJS.load())

fpPromise
.then(fp => fp.get())
.then(result => {
input.val(result.visitorId);
})
} catch (e) {
console.error('Cannot get fingerprint');
}
}

function showRemoveSavedInstrumentErrorMessage(savedInstrument, errorMessage) {
const errorMessageWrapper = jQuery('#wrapper-' + savedInstrument + ' .paynow-payment-card-error');

Expand All @@ -79,3 +92,16 @@ function showRemoveSavedInstrumentErrorMessage(savedInstrument, errorMessage) {
errorMessageWrapper.text('');
}, 5000)
}

function toggleProcessingInfo() {
let $target = jQuery( jQuery( this ).data( 'target' ) );
if ( ! $target.hasClass( 'show' )) {
$target.slideDown();
$target.addClass( 'show' );
jQuery( this ).text( jQuery( this ).data( 'expanded-text' ) );
} else {
$target.slideUp();
$target.removeClass( 'show' );
jQuery( this ).text( jQuery( this ).data( 'collapsed-text' ) );
}
}
6 changes: 4 additions & 2 deletions src/includes/abstract/class-wc-gateway-pay-by-paynow-pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,17 @@ public function process_payment( $order_id ): array {
} elseif ( self::PAYNOW_PAYMENT_GATEWAY[ self::BLIK_PAYMENT ] === $payment_method ) {
$authorization_code = preg_replace( '/\s+/', '', filter_input( INPUT_POST, 'authorizationCode' ) );
} elseif ( self::PAYNOW_PAYMENT_GATEWAY[ self::CARD_PAYMENT ] === $payment_method ) {
$payment_method_token = filter_input( INPUT_POST, 'paymentMethodToken', FILTER_SANITIZE_STRING );
$payment_method_token = filter_input( INPUT_POST, 'paymentMethodToken', FILTER_SANITIZE_STRING );
$payment_method_fingerprint = filter_input( INPUT_POST, 'paymentMethodFingerprint', FILTER_SANITIZE_STRING );
}

$payment_data = $this->gateway->payment_request(
$order,
$this->get_return_url( $order ),
! empty( $payment_method_id ) ? intval( $payment_method_id ) : $this->payment_method_id,
$authorization_code,
! empty( $payment_method_token ) ? $payment_method_token : null
! empty( $payment_method_token ) ? $payment_method_token : null,
! empty( $payment_method_fingerprint ) ? $payment_method_fingerprint : null
);
if ( isset( $payment_data['errors'] ) ) {
$error_type = null;
Expand Down
7 changes: 6 additions & 1 deletion src/includes/class-paynow-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ public function __construct( array $settings ) {
* @param $payment_method_id
* @param $authorization_code
* @param $payment_method_token
* @param $payment_method_fingerprint
* @return array|array[]|void
* @throws ConfigurationException
*/
public function payment_request( WC_Order $order, $return_url, $payment_method_id = null, $authorization_code = null, $payment_method_token = null ) {
public function payment_request( WC_Order $order, $return_url, $payment_method_id = null, $authorization_code = null, $payment_method_token = null, $payment_method_fingerprint = null ) {

if ( ! $this->client ) {
return;
Expand Down Expand Up @@ -107,6 +108,10 @@ public function payment_request( WC_Order $order, $return_url, $payment_method_i
$payment_data['paymentMethodToken'] = $payment_method_token;
}

if ( ! empty( $payment_method_fingerprint ) ) {
$payment_data['buyer']['deviceFingerprint'] = $payment_method_fingerprint;
}

if ( 'yes' === $this->settings['send_order_items'] ) {
$order_items = array();
foreach ( $order->get_items() as $item ) {
Expand Down
1 change: 1 addition & 0 deletions src/includes/templates/card_payment.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php if ( !empty( $instruments ) ): ?>
<p><?php echo __( 'Select a saved card or enter new card details:', 'pay-by-paynow-pl' ); ?></p>
<input type="hidden" name="paymentMethodFingerprint" id="payment-method-fingerprint" value="">
<div class="paynow-payment-option-pbls">
<?php foreach ( $instruments as $instrument ):?>
<div class="paynow-payment-card-option" id="wrapper-<?php echo esc_attr( $instrument->getToken() ); ?>">
Expand Down
2 changes: 1 addition & 1 deletion src/pay-by-paynow-pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Pay by paynow.pl
* Plugin URI: https://github.com/pay-now/paynow-woocommerce
* Description: Accepts secure BLIK, credit cards payments and fast online transfers by paynow.pl
* Version: 2.5.0
* Version: 2.5.1
* Requires PHP: 7.1
* Author: mElements S.A.
* Author URI: https://www.paynow.pl
Expand Down

0 comments on commit 5869a52

Please sign in to comment.