Plugin Directory

Changeset 2317410


Ignore:
Timestamp:
06/03/2020 02:02:38 PM (6 years ago)
Author:
mobipaid
Message:
  • change logo size.
  • add readme for setup.
  • change the way of get payment status.
Location:
mobipaid
Files:
48 added
5 edited

Legend:

Unmodified
Added
Removed
  • mobipaid/trunk/changelog.txt

    r2302697 r2317410  
    88= 1.0.1 - 2020-05-11 =
    99* change the way of get payment status.
     10
     11= 1.0.2 - 2020-06-03 =
     12* change logo size.
     13* add readme for setup.
     14* change the way of get payment status.
  • mobipaid/trunk/includes/class-mobipaid.php

    r2302697 r2317410  
    405405        if ( ! empty( $token ) ) {
    406406            $this->log( 'get response from the gateway reponse url' );
    407             $res_body = file_get_contents( 'php://input' );
    408             $res_body = json_decode( $res_body, true );
    409             $response = json_decode( wp_unslash( $res_body['response'] ), true );
    410             $this->log( 'response_page - response: ' . wp_json_encode( $response ) );
    411 
    412             $transaction_id  = isset( $response['transaction_id'] ) ? $response['transaction_id'] : '';
    413             $result          = isset( $response['result'] ) ? $response['result'] : '';
    414             $payment_id      = isset( $response['payment_id'] ) ? $response['payment_id'] : '';
    415             $currency        = isset( $response['currency'] ) ? $response['currency'] : '';
     407            $response = get_query_var( 'response' );
     408            $this->log( 'response_page - original response: ' . $response );
     409            $response = json_decode( wp_unslash( $response ), true );
     410            $this->log( 'response_page - formated response: ' . wp_json_encode( $response ) );
     411
     412            $payment_status = '';
     413            $payment_id     = '';
     414            $currency       = '';
     415
     416            if ( isset( $response['status'] ) ) {
     417                $payment_status = $response['status'];
     418            } elseif ( isset( $response['result'] ) ) {
     419                $payment_status = $response['result'];
     420            }
     421
     422            if ( isset( $response['payment_id'] ) ) {
     423                $payment_id = $response['payment_id'];
     424            } elseif ( isset( $response['response'] ) && isset( $response['response']['id'] ) ) {
     425                $payment_id = $response['response']['id'];
     426            }
     427
     428            if ( isset( $response['currency'] ) ) {
     429                $currency = $response['currency'];
     430            } elseif ( isset( $response['response'] ) && isset( $response['response']['currency'] ) ) {
     431                $currency = $response['response']['currency'];
     432            }
     433
    416434            $generated_token = $this->generate_token( $order_id, $currency );
    417435            $order           = wc_get_order( $order_id );
     
    419437            if ( $order && 'mobipaid' === $order->get_payment_method() ) {
    420438                if ( $token === $generated_token ) {
    421                     if ( 'ACK' === $result ) {
     439                    if ( 'ACK' === $payment_status ) {
    422440                        $this->log( 'response_page: update order status to processing' );
    423441                        $order_status = 'processing';
  • mobipaid/trunk/mobipaid.php

    r2302697 r2317410  
    44 * Plugin URI:           https://github.com/MobipaidLLC/mobipaid-woocommerce
    55 * Description:          Receive payments using Mobipaid.
    6  * Version:              1.0.1
     6 * Version:              1.0.2
    77 * Requires at least:    5.0
    88 * Tested up to:         5.3.2
     
    2424}
    2525
    26 define( 'MOBIPAID_PLUGIN_VERSION', '1.0.1' );
     26define( 'MOBIPAID_PLUGIN_VERSION', '1.0.2' );
    2727
    2828register_activation_hook( __FILE__, 'mobipaid_activate_plugin' );
  • mobipaid/trunk/readme.txt

    r2302697 r2317410  
    66Tested up to: 5.3.2
    77Requires PHP: 7.0
    8 Stable tag: 1.0.1
     8Stable tag: 1.0.2
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    71713. Settings the plugin through the 'Plugins' menu in WordPress.
    7272
     73= Setup =
     74
     75After installed the plugin, you need to go to plugin settings and input an access key that received from Mobipaid developer portal.
     76And please make sure Merchant has created POS Link with Reference number type Customer Input and sets avaiable currencies.
     77
    7378== Frequently Asked Questions ==
    7479
     
    99104= 1.0.1 - 2020-05-11 =
    100105* change the way of get payment status.
     106
     107= 1.0.2 - 2020-06-03 =
     108* change logo size.
     109* add readme for setup.
     110* change the way of get payment status.
Note: See TracChangeset for help on using the changeset viewer.