Plugin Directory

Changeset 2863185


Ignore:
Timestamp:
02/10/2023 11:15:13 AM (3 years ago)
Author:
devcashfree
Message:

Update to version 4.4.2

Location:
cashfree
Files:
26 added
3 edited

Legend:

Unmodified
Added
Removed
  • cashfree/trunk/cashfree.php

    r2859422 r2863185  
    22/**
    33 * Plugin Name: Cashfree
    4  * Version: 4.4.1
     4 * Version: 4.4.2
    55 * Plugin URI: https://github.com/cashfree/cashfree-woocommerce
    66 * Description: Payment gateway plugin by Cashfree Payments for Woocommerce sites.
  • cashfree/trunk/includes/http/class-wc-cashfree-adapter.php

    r2753558 r2863185  
    3939    public function checkout( $order_id ) {
    4040        require_once WC_CASHFREE_DIR_PATH . 'includes/request/class-wc-cashfree-request-checkout.php';
     41
     42        $getEnvValue = $this->getCurlValue();
     43
     44        $getOrderUrl = $getEnvValue['curlUrl']."/".$order_id;
     45
     46        $args = array(
     47            'timeout'     => '30',
     48            'headers'     => array(
     49                'x-api-version'     =>  '2021-05-21',
     50                'x-client-id'       =>  $this->gateway->settings['app_id'],
     51                'x-client-secret'   =>  $this->gateway->settings['secret_key'],
     52            ),
     53        );
     54
     55       
     56        $response = wp_remote_get( $getOrderUrl, $args );
     57
     58        $http_code = wp_remote_retrieve_response_code( $response );
     59        if($http_code == 200){
     60            $cfOrder = json_decode(wp_remote_retrieve_body( $response ));
     61            if(!empty($cfOrder)) {
     62                $order = wc_get_order($order_id);
     63                if($cfOrder == "PAID") {
     64                    throw new Exception("Please reach out to the support team");
     65                } else {
     66                    if(strtotime($cfOrder->order_expiry_time) > time() && round($cfOrder->order_amount) == round($order->get_total()) && $cfOrder->order_currency == $order->get_currency()) {
     67                        $response = [
     68                            'order_token'       => $cfOrder->order_token,
     69                            'environment'       => $getEnvValue['environment'],
     70                            'payment_link'      => $cfOrder->payment_link,
     71                        ];
     72                        return $response;
     73                    } else {
     74                        throw new Exception("Please reach out to the support team");
     75                    }
     76                }
     77            }
     78        }
    4179
    4280        $requestParams = WC_Cashfree_Request_Checkout::build( $order_id, $this->gateway );
     
    246284    // Get request for gateway
    247285    private function curlGetRequest($curlUrl) {
    248 
    249286        $args = array(
    250287            'timeout'     => '30',
     
    257294
    258295        $response = wp_remote_get( $curlUrl, $args );
     296
    259297        $http_code = wp_remote_retrieve_response_code( $response );
    260298        $body     = json_decode(wp_remote_retrieve_body( $response ));
    261 
    262299        if($http_code == 200) {
    263300            return $body[0];   
  • cashfree/trunk/readme.txt

    r2859422 r2863185  
    44Tested up to: 6.0
    55Requires PHP: 5.6
    6 Stable tag: 4.4.1
    7 Version: 4.4.1
     6Stable tag: 4.4.2
     7Version: 4.4.2
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3333
    3434== Changelog ==
     35
     36= 4.4.2 =
     37* Handled same order id to get payments
    3538
    3639= 4.4.1 =
Note: See TracChangeset for help on using the changeset viewer.