Skip to content

Commit

Permalink
Version 5.7 Release (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukman Bello <[email protected]>
Co-authored-by: lukman-paystack <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2021
1 parent c1c0f32 commit c80aee3
Show file tree
Hide file tree
Showing 14 changed files with 1,029 additions and 1,464 deletions.
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

**Requires at least:** 4.7

**Tested up to:** 5.5
**Tested up to:** 5.6

**Stable tag:** 5.6.4
**Stable tag:** 5.7

**License:** GPLv2 or later

Expand All @@ -25,30 +25,33 @@ Paystack WooCommerce Payment Gateway allows you to accept online payments from l

This is a Paystack payment gateway for WooCommerce.

Paystack is on a mission to deliver a safe and convenient payment experience for customers and merchants. Paystack provide Nigerian & Ghanaian merchants with the tools and services needed to accept online payments from local and international customers using Mastercard, Visa, Verve, Bank Accounts, GTB 737 & Visa QR.
Paystack is on a mission to deliver a safe and convenient payment experience for customers and merchants. Paystack provide Nigerian, South African & Ghanaian merchants with the tools and services needed to accept online payments from local and international customers using Mastercard, Visa, Verve, USSD, Mobile Money, Bank Transfer, EFT, Bank Accounts, GTB 737 & Visa QR.

To signup for a Paystack Merchant account visit their website by clicking [here](https://paystack.com)

Paystack WooCommerce Payment Gateway allows you to accept payment on your WooCommerce store using Mastercard, Visa, Verve, bank accounts, GTB 737 & Visa QR.
Paystack WooCommerce Payment Gateway allows you to accept payment on your WooCommerce store using Mastercard, Visa, Verve, USSD, Mobile Money, Bank Transfer, EFT, Bank Accounts, GTB 737 & Visa QR.

With this Paystack WooCommerce Payment Gateway plugin, you will be able to accept the following payment methods in your shop:

* __Mastercard__
* __Visa__
* __Verve__
* __USSD__
* __Mobile Money__
* __Bank Transfer__
* __EFT__
* __Bank Account__
* __GTB 737__
* __Visa QR__


### Note

This plugin is meant to be used by merchants in Nigeria and Ghana.

This plugin is meant to be used by merchants in Nigeria, South Africa and Ghana.

### Plugin Features

* __Accept payment__ via Mastercard, Visa, Verve, Bank Accounts, GTB 737 & Visa QR
* __Accept payment__ via Mastercard, Visa, Verve, USSD, Mobile Money, Bank Transfer, EFT, Bank Accounts, GTB 737 & Visa QR.
* __Seamless integration__ into the WooCommerce checkout page. Accept payment directly on your site
* __Refunds__ from the WooCommerce order details page. Refund an order directly from the order details page
* __Recurring payment__ using [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) plugin
Expand Down Expand Up @@ -145,7 +148,15 @@ To configure the plugin, go to __WooCommerce > Settings__ from the left hand men

## Changelog

### 5.6.4 - September 29, 2020 =
### 5.7 - January 13, 2021
* New: Add additional payment channels to the custom gateways
* New: Add redirect payment option
* New: Add option to autocomplete order after successful payment
* Misc: Add deprecate notice for Inline Embed payment option
* Fix: The default gateway should display only the payment channel(s) set on the Paystack settings page
* Tweak: WooCommerce 4.9 compatibility.

### 5.6.4 - September 29, 2020
* Fix: Use order currency when paying for an order and not the store currency
* Fix: Test mode enabled admin notice not displayed properly
* Misc: Add payment icon for South Africa
Expand Down Expand Up @@ -261,8 +272,8 @@ To configure the plugin, go to __WooCommerce > Settings__ from the left hand men

## Upgrade Notice

### 5.6.3 ###
* Add payment icon for South Africa. Use the order currency and not the store currency when paying for an order
### 5.7 ###
* Add redirect payment option. Add option to autocomplete order after payment. Add additional payment channels to the custom gateways.

## Screenshots ##

Expand Down
100 changes: 58 additions & 42 deletions assets/js/paystack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jQuery( function( $ ) {

var paystack_submit = false;
let paystack_submit = false;

if ( 'embed' === wc_paystack_params.pay_page ) {

Expand All @@ -20,7 +20,7 @@ jQuery( function( $ ) {

function wcPaystackCustomFields() {

var custom_fields = [
let custom_fields = [
{
"display_name": "Plugin",
"variable_name": "plugin",
Expand Down Expand Up @@ -97,47 +97,68 @@ jQuery( function( $ ) {

function wcPaystackCustomFilters() {

var custom_filters = new Object();
let custom_filters = {};

if ( wc_paystack_params.banks_allowed ) {
if ( wc_paystack_params.card_channel ) {

custom_filters[ 'banks' ] = wc_paystack_params.banks_allowed;
if ( wc_paystack_params.banks_allowed ) {

}
custom_filters[ 'banks' ] = wc_paystack_params.banks_allowed;

}

if ( wc_paystack_params.cards_allowed ) {

if ( wc_paystack_params.cards_allowed ) {
custom_filters[ 'card_brands' ] = wc_paystack_params.cards_allowed;
}

custom_filters[ 'card_brands' ] = wc_paystack_params.cards_allowed;
}

return custom_filters;
}

function wcPaymentChannels() {

let payment_channels = [];

if ( wc_paystack_params.bank_channel ) {
payment_channels.push( 'bank' );
}

if ( wc_paystack_params.card_channel ) {
payment_channels.push( 'card' );
}

if ( wc_paystack_params.ussd_channel ) {
payment_channels.push( 'ussd' );
}

if ( wc_paystack_params.qr_channel ) {
payment_channels.push( 'qr' );
}

if ( wc_paystack_params.bank_transfer_channel ) {
payment_channels.push( 'bank_transfer' );
}

return payment_channels;
}

function wcPaystackFormHandler() {

if ( paystack_submit ) {
paystack_submit = false;
return true;
}

var $form = $( 'form#payment-form, form#order_review' ),
let $form = $( 'form#payment-form, form#order_review' ),
paystack_txnref = $form.find( 'input.paystack_txnref' ),
bank = "false",
card = "false",
subaccount_code = '',
charges_account = '',
transaction_charges = '';

paystack_txnref.val( '' );

if ( wc_paystack_params.bank_channel ) {
bank = "true";
}

if ( wc_paystack_params.card_channel ) {
card = "true";
}

if ( wc_paystack_params.subaccount_code ) {
subaccount_code = wc_paystack_params.subaccount_code;
}
Expand All @@ -150,9 +171,9 @@ jQuery( function( $ ) {
transaction_charges = Number( wc_paystack_params.transaction_charges );
}

var amount = Number( wc_paystack_params.amount );
let amount = Number( wc_paystack_params.amount );

var paystack_callback = function( response ) {
let paystack_callback = function( response ) {
$form.append( '<input type="hidden" class="paystack_txnref" name="paystack_txnref" value="' + response.trxref + '"/>' );
paystack_submit = true;

Expand All @@ -170,26 +191,32 @@ jQuery( function( $ ) {
} );
};

var handler = PaystackPop.setup( {
let paymentData = {
key: wc_paystack_params.key,
email: wc_paystack_params.email,
amount: amount,
ref: wc_paystack_params.txnref,
currency: wc_paystack_params.currency,
callback: paystack_callback,
bank: bank,
card: card,
subaccount: subaccount_code,
bearer: charges_account,
transaction_charge: transaction_charges,
metadata: {
custom_fields: wcPaystackCustomFields(),
custom_filters: wcPaystackCustomFilters()
},
onClose: function() {
$( this.el ).unblock();
}
} );
};

if ( Array.isArray( wcPaymentChannels() ) && wcPaymentChannels().length ) {
paymentData[ 'channels' ] = wcPaymentChannels();
if ( !$.isEmptyObject( wcPaystackCustomFilters() ) ) {
paymentData[ 'metadata' ][ 'custom_filters' ] = wcPaystackCustomFilters();
}
}

let handler = PaystackPop.setup( paymentData );

handler.openIframe();

Expand All @@ -204,24 +231,14 @@ jQuery( function( $ ) {
return true;
}

var $form = $( 'form#payment-form, form#order_review' ),
let $form = $( 'form#payment-form, form#order_review' ),
paystack_txnref = $form.find( 'input.paystack_txnref' ),
bank = "false",
card = "false",
subaccount_code = '',
charges_account = '',
transaction_charges = '';

paystack_txnref.val( '' );

if ( wc_paystack_params.bank_channel ) {
bank = "true";
}

if ( wc_paystack_params.card_channel ) {
card = "true";
}

if ( wc_paystack_params.subaccount_code ) {
subaccount_code = wc_paystack_params.subaccount_code;
}
Expand All @@ -234,9 +251,9 @@ jQuery( function( $ ) {
transaction_charges = Number( wc_paystack_params.transaction_charges );
}

var amount = Number( wc_paystack_params.amount );
let amount = Number( wc_paystack_params.amount );

var paystack_callback = function( response ) {
let paystack_callback = function( response ) {

$form.append( '<input type="hidden" class="paystack_txnref" name="paystack_txnref" value="' + response.trxref + '"/>' );

Expand All @@ -259,16 +276,15 @@ jQuery( function( $ ) {

};

var handler = PaystackPop.setup( {
let handler = PaystackPop.setup( {
key: wc_paystack_params.key,
email: wc_paystack_params.email,
amount: amount,
ref: wc_paystack_params.txnref,
currency: wc_paystack_params.currency,
container: "paystackWooCommerceEmbedContainer",
callback: paystack_callback,
bank: bank,
card: card,
channels: wcPaymentChannels(),
subaccount: subaccount_code,
bearer: charges_account,
transaction_charge: transaction_charges,
Expand Down
2 changes: 1 addition & 1 deletion assets/js/paystack.min.js

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

Loading

0 comments on commit c80aee3

Please sign in to comment.