Plugin Directory

Changeset 2753558


Ignore:
Timestamp:
07/08/2022 06:27:32 AM (4 years ago)
Author:
devcashfree
Message:

Update to version 4.3.4

Location:
cashfree
Files:
26 added
9 edited

Legend:

Unmodified
Added
Removed
  • cashfree/trunk/assets/js/checkout.js

    r2747397 r2753558  
    6868            pippin_form.submit();
    6969        }
    70         Pippin.setOrderMetaPlatform("wc-" + wc_cashfree_checkout_params.woo_version);
     70        Pippin.setOrderMetaPlatform("wc" + wc_cashfree_checkout_params.woo_version + "-" +  wc_cashfree_checkout_params.cf_version);
    7171        Pippin(env, wc_cashfree_checkout_params.token, successCallback, failureCallback, dismissCallback);
    7272    }
  • cashfree/trunk/cashfree.php

    r2747397 r2753558  
    22/**
    33 * Plugin Name: Cashfree
    4  * Version: 4.3.3
     4 * Version: 4.3.4
    55 * Plugin URI: https://github.com/cashfree/cashfree-woocommerce
    6  * Description: Payment gateway plugin by Cashfree for Woocommerce sites.
     6 * Description: Payment gateway plugin by Cashfree Payments for Woocommerce sites.
    77 * Author: devcashfree
    88 * Author URI: https://cashfree.com
    99 * Developer: Cashfree Dev
    1010 * Developer URI: techsupport@gocashfree.com
    11  *
     11 * Text Domain: woocommerce-extension
     12 * Domain Path: /languages
    1213 * Requires at least: 4.4
    1314 * Tested up to: 6.0
     
    1516 * WC tested up to: 6.3.1
    1617 *
    17  * Text Domain: Cashfree
    1818 *
    1919 * License: GPLv3
  • cashfree/trunk/includes/gateways/class-wc-cashfree-gateway.php

    r2747397 r2753558  
    55
    66defined( 'ABSPATH' ) || exit;
     7
     8require_once ABSPATH . 'wp-admin/includes/plugin.php';
    79
    810/**
     
    146148            $order_id   = $data['order_id'];
    147149        }
    148        
     150
    149151        $order = $this->get_order( $order_id, $order_key );
    150         if ( $order && $order->needs_payment() || $order->has_status('processing')) {
     152        if ( $order && $order->needs_payment() || $order->has_status('processing') || $order->has_status('completed')) {
    151153            try {
    152154                $response = $this->adapter->capture( $data );
     
    189191     * Cancel a checkout.
    190192     *
    191      * @param array $data post data.
    192      * @param string $order_key   Order key.
    193      */
    194     public function cancel( $data, $order_key ) {
    195         $order_id = $data['orderId'];
     193     * @param array $post_data post data.
     194     * @param string $order_key Order key.
     195     */
     196    public function cancel( $post_data, $order_key ) {
     197        $order_id = $post_data['orderId'];
    196198        $order = $this->get_order( $order_id, $order_key );
    197199
    198200        if ( $order && $order->needs_payment() ) {
    199             if($data['transaction_status'] === 'CANCELLED') {
     201            if($post_data['transaction_status'] === 'CANCELLED') {
    200202                $order_status = 'cancelled';
    201             } elseif($data['transaction_status'] === 'FAILED') {
     203            } elseif($post_data['transaction_status'] === 'FAILED') {
    202204                $order_status = 'failed';
    203205            } else {
     
    211213                    $order_status,
    212214                    $order->get_id(),
    213                     $data['transaction_msg']
     215                    $post_data['transaction_msg']
    214216                )
    215217            );
    216218        }
    217         wc_add_notice( __( $data['transaction_msg'], 'cashfree' ), 'error');
     219        wc_add_notice( __( $post_data['transaction_msg'], 'cashfree' ), 'error');
    218220        wp_safe_redirect( wc_get_checkout_url() );
    219221        exit;
     
    234236     * Webhook a checkout.
    235237     *
    236      * @param array $data post data.
     238     * @param array $post_data post data.
    237239     * @param string $order_key Order key.
    238240     */
    239     public function notify( $data, $order_key ) {
    240         if($data['txStatus'] === 'SUCCESS') {
    241             $order_id = $data['orderId'];
     241    public function notify( $post_data, $order_key ) {
     242        if($post_data['txStatus'] === 'SUCCESS') {
     243            $order_id = $post_data['orderId'];
    242244            $order = $this->get_order( $order_id, $order_key );
    243245
    244246            if ( $order && $order->needs_payment() ) {
    245247                try {
    246                     $data['order_status'] = 'PAID';
    247                     $data['transaction_msg'] = $data['txMsg'];
    248                     $this->adapter->notify( $data );
    249                     $order->payment_complete( $data['referenceId'] );
     248                    $post_data['order_status'] = 'PAID';
     249                    $post_data['transaction_msg'] = $post_data['txMsg'];
     250                    $this->adapter->notify( $post_data );
     251                    $order->payment_complete( $post_data['referenceId'] );
    250252                    $order->add_order_note(
    251253                        sprintf(
    252254                            __( 'Webhook - Cashfree payment successful <br/>Transaction Id: %1$s.', 'cashfree' ),
    253                             $data['referenceId']
     255                            $post_data['referenceId']
    254256                        )
    255257                    );
     
    318320                    'cancel_url'    => WC_Cashfree_Request_Checkout::get_url( 'cancel', wc_clean( wp_unslash( $_GET[ 'key' ] ) ), $this->id ),
    319321                    'dismiss_url'   => WC_Cashfree_Request_Checkout::get_url( 'dismiss', wc_clean( wp_unslash( $_GET[ 'key' ] ) ), $this->id ),
    320                     'woo_version'   => WC()->version )
     322                    'woo_version'   => WC()->version,
     323                    'cf_version'    => get_plugin_data(WC_CASHFREE_DIR_PATH . 'cashfree.php')['Version'] )
    321324            );
    322325        }
     
    326329     * Get order instance.
    327330     *
    328      * @param string $order_id Order id.
    329      * @param string $order_key Order key.
     331     * @param string $transaction_id Transaction id.
     332     * @param string $order_key      Order key.
    330333     *
    331334     * @return bool|WC_Order|WC_Order_Refund
  • cashfree/trunk/includes/gateways/class-wc-cashfree-payments.php

    r2747397 r2753558  
    1616    public function __construct() {
    1717        $this->id                 = WC_Cashfree::PAYMENT_GATEWAY_ID;
    18         $this->icon               = "https://cashfreelogo.cashfree.com/wix/cflogo.svg";
     18        $this->icon               = "https://cashfreelogo.cashfree.com/cashfreepayments/logopng1x/Cashfree_Payments_Logo.png";
    1919        $this->method_description = __( 'Pay securely via Card/Net Banking/Wallet via Cashfree.', 'cashfree' );
    2020        parent::__construct();
  • cashfree/trunk/includes/http/class-wc-cashfree-adapter.php

    r2747397 r2753558  
    5454            ];
    5555
    56             //Save cart details
     56            //Order Cart save   
    5757            try {
    5858                $this->cashfreeCheckoutCartSave( $order_id );               
     
    161161            $postCode = (!empty($billing_address['postcode'])) ? $billing_address['postcode'] : "";
    162162        }
     163        $billing_address = WC_Cashfree_Request_Billing::build( $order_id );
     164        $shipping_address = WC_Cashfree_Request_Shipping::build( $order_id );
    163165        $cartData = array(
    164             'shipping_address'  => WC_Cashfree_Request_Shipping::build( $order_id ),
    165             'billing_address'   => WC_Cashfree_Request_Billing::build( $order_id ),
     166            'shipping_address'  => $shipping_address['shippingAddress'],
     167            'billing_address'   => $billing_address['billingAddress'],
    166168            'pincode'           => $postCode,
    167169            'customer_note'     => $order->get_currency(),
     
    171173                },
    172174                array_values( $order->get_items() )
    173             ),
    174         );
     175            )
     176
     177        );
     178
     179        if (!empty($billing_address['data'])) {
     180            $cartData['customer_billing_address'] = $billing_address['data'];
     181        }
     182        if (!empty($shipping_address['data'])) {
     183            $cartData['customer_shipping_address'] = $shipping_address['data'];
     184        }
    175185
    176186        $getEnvValue = $this->getCurlValue();
  • cashfree/trunk/includes/request/class-wc-cashfree-request-billing.php

    r2742179 r2753558  
    2121        $order = new WC_Order( $order_id );
    2222        $billing_address=$order->get_address( 'billing' ) ;
     23        $addressData = array();
     24        $billingAddressArray = array();
    2325        $billingAddress = "";
    2426        if ( is_user_logged_in() ) {
    25             $customer       = new WC_Customer( $order->get_user_id() );
     27            $customer = new WC_Customer( $order->get_user_id() );
     28            if(!empty($customer->get_billing_first_name())) {
     29                $billingAddressArray['full_name'] = $customer->get_billing_first_name(). " ". $customer->get_billing_last_name();
     30            }
    2631            if(!empty($customer->get_billing_address_1())) {
     32                $billingAddressArray['address_1'] = substr($customer->get_billing_address_1(),0,254);
    2733                $billingAddress = $billingAddress." ".$customer->get_billing_address_1();
    2834            }
    2935            if(!empty($customer->get_billing_address_2())) {
     36                $billingAddressArray['address_2'] = substr($customer->get_billing_address_2(),0,254);
    3037                $billingAddress = $billingAddress." ".$customer->get_billing_address_2();
    3138            }
    3239            if(!empty($customer->get_billing_city())) {
     40                $billingAddressArray['city'] = substr($customer->get_billing_city(),0,254);
    3341                $billingAddress = $billingAddress." ".$customer->get_billing_city();
    3442            }
    3543            if(!empty($customer->get_billing_state())) {
     44                $billingAddressArray['state'] = substr($customer->get_billing_state(),0,254);
    3645                $billingAddress = $billingAddress." ".$customer->get_billing_state();
    3746            }
    38             return substr($billingAddress,0,254);
     47            if(!empty($customer->get_billing_country())) {
     48                $billingAddressArray['country'] = substr($customer->get_billing_country(),0,254);
     49            }
     50            if(!empty($customer->get_billing_postcode())) {
     51                $billingAddressArray['pincode'] = $customer->get_billing_postcode();
     52            }
     53            $addressData['data'] = $billingAddressArray;
     54            $addressData['billingAddress'] = substr($billingAddress,0,254);
     55            return $addressData;
    3956        } elseif(!empty($billing_address)) {
     57            if(!empty($billing_address['first_name'])) {
     58                $billingAddressArray['full_name'] = $billing_address['first_name']. " " . $billing_address['last_name'];
     59            }
    4060            if(!empty($billing_address['address_1'])) {
     61                $billingAddressArray['address_1'] = substr($billing_address['address_1'],0,254);
    4162                $billingAddress = $billingAddress." ".$billing_address['address_1'];
    4263            }
    4364            if(!empty($billing_address['address_2'])) {
     65                $billingAddressArray['address_2'] = substr($billing_address['address_2'],0,254);
    4466                $billingAddress = $billingAddress." ".$billing_address['address_2'];
    4567            }
    4668            if(!empty($billing_address['city'])) {
     69                $billingAddressArray['city'] = substr($billing_address['city'],0,254);
    4770                $billingAddress = $billingAddress." ".$billing_address['city'];
    4871            }
    4972            if(!empty($billing_address['state'])) {
     73                $billingAddressArray['state'] = substr($billing_address['state'],0,254);
    5074                $billingAddress = $billingAddress." ".$billing_address['state'];
    5175            }
    52             return substr($billingAddress,0,254);
     76            if(!empty($billing_address['country'])) {
     77                $billingAddressArray['country'] = substr($billing_address['country'],0,254);
     78            }
     79            if(!empty($billing_address['postcode'])) {
     80                $billingAddressArray['postcode'] = $billing_address['postcode'];
     81            }
     82            $addressData['data'] = $billingAddressArray;
     83            $addressData['billingAddress'] = substr($billingAddress,0,254);
     84            return $addressData;
    5385        } else {
    54             $billingAddress = "";
     86            return $addressData;
    5587        }
    5688
    57         return $billingAddress;
    5889    }
    5990}
  • cashfree/trunk/includes/request/class-wc-cashfree-request-checkout.php

    r2747397 r2753558  
    4545            "order_note"        => "WooCommerce",
    4646            "order_meta"        => array(
    47             "notify_url"        => self::get_url( 'notify', $order->get_order_key(), $gateway->id ),
     47            "notify_url"        => self::get_notify_url( 'notify', $order->get_order_key(), $gateway ),
    4848            "return_url"        => self::get_return_url('capture', $order->get_order_key(), $gateway)
    4949            )
  • cashfree/trunk/includes/request/class-wc-cashfree-request-shipping.php

    r2742179 r2753558  
    2121        $order = new WC_Order( $order_id );
    2222        $shipping_address=$order->get_address( 'shipping' ) ;
     23        $addressData = array();
     24        $shippingAddressArray = array();
    2325        $shippingAddress = "";
    2426        if ( !empty($shipping_address) ) {
     27            if(!empty($shipping_address['first_name'])) {
     28                $shippingAddressArray['full_name'] = $shipping_address['first_name']. " " . $shipping_address['last_name'];
     29            }
    2530            if(!empty($shipping_address['address_1'])) {
     31                $shippingAddressArray['address_1'] = substr($shipping_address['address_1'],0,254);
    2632                $shippingAddress = $shippingAddress." ".$shipping_address['address_1'];
    2733            }
    2834            if(!empty($shipping_address['address_2'])) {
     35                $shippingAddressArray['address_2'] = substr($shipping_address['address_2'],0,254);
    2936                $shippingAddress = $shippingAddress." ".$shipping_address['address_2'];
    3037            }
    3138            if(!empty($shipping_address['city'])) {
     39                $shippingAddressArray['city'] = substr($shipping_address['city'],0,254);
    3240                $shippingAddress = $shippingAddress." ".$shipping_address['city'];
    3341            }
    3442            if(!empty($shipping_address['state'])) {
     43                $shippingAddressArray['state'] = substr($shipping_address['state'],0,254);
    3544                $shippingAddress = $shippingAddress." ".$shipping_address['state'];
    3645            }
    37             return substr($shippingAddress,0,254);
     46            if(!empty($shipping_address['country'])) {
     47                $shippingAddressArray['country'] = substr($shipping_address['country'],0,254);
     48            }
     49            if(!empty($shipping_address['postcode'])) {
     50                $shippingAddressArray['postcode'] = $shipping_address['postcode'];
     51            }
     52            $addressData['data'] = $shippingAddressArray;
     53            $addressData['shippingAddress'] = substr($shippingAddress,0,254);
     54            return $addressData;
    3855        }
    3956
    40         return $shippingAddress;
     57        return $addressData;
    4158       
    4259    }
  • cashfree/trunk/readme.txt

    r2747397 r2753558  
    44Tested up to: 6.0
    55Requires PHP: 5.6
    6 Stable tag: 4.3.3
    7 Version: 4.3.3
     6Stable tag: 4.3.4
     7Version: 4.3.4
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3333
    3434== Changelog ==
     35
     36= 4.3.4 =
     37* Bugfix for order capture redirection
     38* Change cashfree default logo size
    3539
    3640= 4.3.3 =
Note: See TracChangeset for help on using the changeset viewer.