Skip to content

Commit

Permalink
Version 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tubiz committed Sep 7, 2014
1 parent e1f556a commit ae719e8
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 15 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

**Requires at least:** 3.5

**Tested up to:** 3.9.1
**Tested up to:** 4.0

**Stable tag:** 2.0.1
**Stable tag:** 2.0.2

**License:** GPLv2 or later

Expand Down Expand Up @@ -134,6 +134,10 @@ __*You can select the radio button next to the Voguepay Payment Gateway from the

## Changelog ##

### 2.0.2 ###
* New: Automatically redirect the customer to Voguepay to make payment
* New: Add support for Woocommerce 2.2

### 2.0.1 ###
* Fix: This fix the errors that display on the order received page if another payment method is selected

Expand Down Expand Up @@ -166,8 +170,8 @@ __*You can select the radio button next to the Voguepay Payment Gateway from the

## Upgrade Notice ##

### 2.0.0 ###
* This release fine tuned the IPN (Instant Payment Notification).
### 2.0.2 ###
* Add support for Woocommerce 2.2 & automatically redirect the customer to Voguepay to make payment.



Expand Down
12 changes: 8 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: tubiz
Donate link: http://bosun.me/donate
Tags: woocommerce, payment gateway, payment gateways, voguepay, interswitch, verve cards, tubiz plugins, verve, nigeria
Requires at least: 3.5
Tested up to: 3.9.1
Stable tag: 2.0.1
Tested up to: 4.0
Stable tag: 2.0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -126,6 +126,10 @@ __*You can select the radio button next to the Voguepay Payment Gateway from the

== Changelog ==

= 2.0.2 =
* New: Automatically redirect the customer to Voguepay to make payment
* New: Add support for Woocommerce 2.2

= 2.0.1 =
* Fix: This fix the errors that display on the order received page if another payment method is selected

Expand Down Expand Up @@ -161,8 +165,8 @@ __*You can select the radio button next to the Voguepay Payment Gateway from the

== Upgrade Notice ==

= 2.0.1 =
* This release fix the errors that display on the order received page if another payment method is selected. Kindly update to this version
= 2.0.2 =
* Add support for Woocommerce 2.2 & automatically redirect the customer to Voguepay to make payment.



Expand Down
56 changes: 49 additions & 7 deletions voguepay-woocommerce-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Voguepay WooCommerce Payment Gateway
Plugin URI: http://bosun.me/voguepay-woocommerce-payment-gateway
Description: Voguepay Woocommerce Payment Gateway allows you to accept payment on your Woocommerce store via Visa Cards, Mastercards, Verve Cards and eTranzact.
Version: 2.0.1
Version: 2.0.2
Author: Tunbosun Ayinla
Author URI: http://bosun.me/
License: GPL-2.0+
Expand Down Expand Up @@ -179,12 +179,39 @@ function generate_voguepay_form( $order_id ) {
$voguepay_args_array[] = '<input type="hidden" name="'.esc_attr( $key ).'" value="'.esc_attr( $value ).'" />';
}

return '<form action="'.esc_url( $voguepay_adr ).'" method="post" id="voguepay_payment_form" target="_top">
' . implode('', $voguepay_args_array) . '
<input type="submit" class="button-alt" id="submit_voguepay_payment_form" value="'.__('Make Payment', 'woocommerce').'" />
<a class="button cancel" href="'.esc_url( $order->get_cancel_order_url() ).'">'.__('Cancel order &amp; restore cart', 'woocommerce').'</a>
wc_enqueue_js( '
$.blockUI({
message: "' . esc_js( __( 'Thank you for your order. We are now redirecting you to Voguepay to make payment.', 'woocommerce' ) ) . '",
baseZ: 99999,
overlayCSS:
{
background: "#fff",
opacity: 0.6
},
css: {
padding: "20px",
zindex: "9999999",
textAlign: "center",
color: "#555",
border: "3px solid #aaa",
backgroundColor:"#fff",
cursor: "wait",
lineHeight: "24px",
}
});
jQuery("#submit_voguepay_payment_form").click();
' );

return '<form action="' . esc_url( $voguepay_adr ) . '" method="post" id="voguepay_payment_form" target="_top">
' . implode( '', $voguepay_args_array ) . '
<!-- Button Fallback -->
<div class="payment_buttons">
<input type="submit" class="button alt" id="submit_voguepay_payment_form" value="' . __( 'Pay via Voguepay', 'woocommerce' ) . '" /> <a class="button cancel" href="' . esc_url( $order->get_cancel_order_url() ) . '">' . __( 'Cancel order &amp; restore cart', 'woocommerce' ) . '</a>
</div>
<script type="text/javascript">
jQuery(".payment_buttons").hide();
</script>
</form>';

}

/**
Expand All @@ -203,7 +230,7 @@ function process_payment( $order_id ) {
* Output for the order received page.
**/
function receipt_page( $order ) {
echo '<p>'.__('Thank you for your order, please click the button below to make payment.', 'woocommerce').'</p>';
echo '<p>' . __( 'Thank you - your order is now pending payment. You should be automatically redirected to Voguepay to make payment.', 'woocommerce' ) . '</p>';
echo $this->generate_voguepay_form( $order );
}

Expand Down Expand Up @@ -323,6 +350,10 @@ function check_voguepay_response( $posted ){
'message_type' => $message_type
);

if ( version_compare( WOOCOMMERCE_VERSION, "2.2" ) >= 0 ) {
add_post_meta( $order_id, '_transaction_id', $transaction_id, true );
}

update_post_meta( $order_id, '_tbz_voguepay_message', $voguepay_message );

die( 'IPN Processed OK. Payment Successfully' );
Expand Down Expand Up @@ -372,6 +403,17 @@ function check_voguepay_response( $posted ){
}

}


public function get_transaction_url( $order ) {
if( version_compare( WOOCOMMERCE_VERSION, "2.2" ) >= 0 ) {

$this->view_transaction_url = 'https://voguepay.com/?v_transaction_id=%s&type=xml';

return parent::get_transaction_url( $order );
}
}

}

function tbz_voguepay_message(){
Expand Down

0 comments on commit ae719e8

Please sign in to comment.