Changeset 2753558
- Timestamp:
- 07/08/2022 06:27:32 AM (4 years ago)
- Location:
- cashfree
- Files:
-
- 26 added
- 9 edited
-
tags/4.3.4 (added)
-
tags/4.3.4/LICENSE (added)
-
tags/4.3.4/README.md (added)
-
tags/4.3.4/assets (added)
-
tags/4.3.4/assets/js (added)
-
tags/4.3.4/assets/js/checkout.js (added)
-
tags/4.3.4/cashfree.php (added)
-
tags/4.3.4/includes (added)
-
tags/4.3.4/includes/class-wc-cashfree-api.php (added)
-
tags/4.3.4/includes/gateways (added)
-
tags/4.3.4/includes/gateways/class-wc-cashfree-gateway.php (added)
-
tags/4.3.4/includes/gateways/class-wc-cashfree-payments.php (added)
-
tags/4.3.4/includes/http (added)
-
tags/4.3.4/includes/http/class-wc-cashfree-adapter.php (added)
-
tags/4.3.4/includes/request (added)
-
tags/4.3.4/includes/request/class-wc-cashfree-request-billing.php (added)
-
tags/4.3.4/includes/request/class-wc-cashfree-request-checkout.php (added)
-
tags/4.3.4/includes/request/class-wc-cashfree-request-items.php (added)
-
tags/4.3.4/includes/request/class-wc-cashfree-request-shipping.php (added)
-
tags/4.3.4/includes/settings (added)
-
tags/4.3.4/includes/settings/cashfree-payments.php (added)
-
tags/4.3.4/includes/wc-cashfree-functions.php (added)
-
tags/4.3.4/includes/wc-cashfree-scripts.php (added)
-
tags/4.3.4/readme.txt (added)
-
tags/4.3.4/templates (added)
-
tags/4.3.4/templates/payment-fields.php (added)
-
trunk/assets/js/checkout.js (modified) (1 diff)
-
trunk/cashfree.php (modified) (2 diffs)
-
trunk/includes/gateways/class-wc-cashfree-gateway.php (modified) (7 diffs)
-
trunk/includes/gateways/class-wc-cashfree-payments.php (modified) (1 diff)
-
trunk/includes/http/class-wc-cashfree-adapter.php (modified) (3 diffs)
-
trunk/includes/request/class-wc-cashfree-request-billing.php (modified) (1 diff)
-
trunk/includes/request/class-wc-cashfree-request-checkout.php (modified) (1 diff)
-
trunk/includes/request/class-wc-cashfree-request-shipping.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cashfree/trunk/assets/js/checkout.js
r2747397 r2753558 68 68 pippin_form.submit(); 69 69 } 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); 71 71 Pippin(env, wc_cashfree_checkout_params.token, successCallback, failureCallback, dismissCallback); 72 72 } -
cashfree/trunk/cashfree.php
r2747397 r2753558 2 2 /** 3 3 * Plugin Name: Cashfree 4 * Version: 4.3. 34 * Version: 4.3.4 5 5 * 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. 7 7 * Author: devcashfree 8 8 * Author URI: https://cashfree.com 9 9 * Developer: Cashfree Dev 10 10 * Developer URI: techsupport@gocashfree.com 11 * 11 * Text Domain: woocommerce-extension 12 * Domain Path: /languages 12 13 * Requires at least: 4.4 13 14 * Tested up to: 6.0 … … 15 16 * WC tested up to: 6.3.1 16 17 * 17 * Text Domain: Cashfree18 18 * 19 19 * License: GPLv3 -
cashfree/trunk/includes/gateways/class-wc-cashfree-gateway.php
r2747397 r2753558 5 5 6 6 defined( 'ABSPATH' ) || exit; 7 8 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 7 9 8 10 /** … … 146 148 $order_id = $data['order_id']; 147 149 } 148 150 149 151 $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')) { 151 153 try { 152 154 $response = $this->adapter->capture( $data ); … … 189 191 * Cancel a checkout. 190 192 * 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']; 196 198 $order = $this->get_order( $order_id, $order_key ); 197 199 198 200 if ( $order && $order->needs_payment() ) { 199 if($ data['transaction_status'] === 'CANCELLED') {201 if($post_data['transaction_status'] === 'CANCELLED') { 200 202 $order_status = 'cancelled'; 201 } elseif($ data['transaction_status'] === 'FAILED') {203 } elseif($post_data['transaction_status'] === 'FAILED') { 202 204 $order_status = 'failed'; 203 205 } else { … … 211 213 $order_status, 212 214 $order->get_id(), 213 $ data['transaction_msg']215 $post_data['transaction_msg'] 214 216 ) 215 217 ); 216 218 } 217 wc_add_notice( __( $ data['transaction_msg'], 'cashfree' ), 'error');219 wc_add_notice( __( $post_data['transaction_msg'], 'cashfree' ), 'error'); 218 220 wp_safe_redirect( wc_get_checkout_url() ); 219 221 exit; … … 234 236 * Webhook a checkout. 235 237 * 236 * @param array $ data post data.238 * @param array $post_data post data. 237 239 * @param string $order_key Order key. 238 240 */ 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']; 242 244 $order = $this->get_order( $order_id, $order_key ); 243 245 244 246 if ( $order && $order->needs_payment() ) { 245 247 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'] ); 250 252 $order->add_order_note( 251 253 sprintf( 252 254 __( 'Webhook - Cashfree payment successful <br/>Transaction Id: %1$s.', 'cashfree' ), 253 $ data['referenceId']255 $post_data['referenceId'] 254 256 ) 255 257 ); … … 318 320 'cancel_url' => WC_Cashfree_Request_Checkout::get_url( 'cancel', wc_clean( wp_unslash( $_GET[ 'key' ] ) ), $this->id ), 319 321 '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'] ) 321 324 ); 322 325 } … … 326 329 * Get order instance. 327 330 * 328 * @param string $ order_id Orderid.329 * @param string $order_key Order key.331 * @param string $transaction_id Transaction id. 332 * @param string $order_key Order key. 330 333 * 331 334 * @return bool|WC_Order|WC_Order_Refund -
cashfree/trunk/includes/gateways/class-wc-cashfree-payments.php
r2747397 r2753558 16 16 public function __construct() { 17 17 $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"; 19 19 $this->method_description = __( 'Pay securely via Card/Net Banking/Wallet via Cashfree.', 'cashfree' ); 20 20 parent::__construct(); -
cashfree/trunk/includes/http/class-wc-cashfree-adapter.php
r2747397 r2753558 54 54 ]; 55 55 56 // Save cart details56 //Order Cart save 57 57 try { 58 58 $this->cashfreeCheckoutCartSave( $order_id ); … … 161 161 $postCode = (!empty($billing_address['postcode'])) ? $billing_address['postcode'] : ""; 162 162 } 163 $billing_address = WC_Cashfree_Request_Billing::build( $order_id ); 164 $shipping_address = WC_Cashfree_Request_Shipping::build( $order_id ); 163 165 $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'], 166 168 'pincode' => $postCode, 167 169 'customer_note' => $order->get_currency(), … … 171 173 }, 172 174 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 } 175 185 176 186 $getEnvValue = $this->getCurlValue(); -
cashfree/trunk/includes/request/class-wc-cashfree-request-billing.php
r2742179 r2753558 21 21 $order = new WC_Order( $order_id ); 22 22 $billing_address=$order->get_address( 'billing' ) ; 23 $addressData = array(); 24 $billingAddressArray = array(); 23 25 $billingAddress = ""; 24 26 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 } 26 31 if(!empty($customer->get_billing_address_1())) { 32 $billingAddressArray['address_1'] = substr($customer->get_billing_address_1(),0,254); 27 33 $billingAddress = $billingAddress." ".$customer->get_billing_address_1(); 28 34 } 29 35 if(!empty($customer->get_billing_address_2())) { 36 $billingAddressArray['address_2'] = substr($customer->get_billing_address_2(),0,254); 30 37 $billingAddress = $billingAddress." ".$customer->get_billing_address_2(); 31 38 } 32 39 if(!empty($customer->get_billing_city())) { 40 $billingAddressArray['city'] = substr($customer->get_billing_city(),0,254); 33 41 $billingAddress = $billingAddress." ".$customer->get_billing_city(); 34 42 } 35 43 if(!empty($customer->get_billing_state())) { 44 $billingAddressArray['state'] = substr($customer->get_billing_state(),0,254); 36 45 $billingAddress = $billingAddress." ".$customer->get_billing_state(); 37 46 } 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; 39 56 } elseif(!empty($billing_address)) { 57 if(!empty($billing_address['first_name'])) { 58 $billingAddressArray['full_name'] = $billing_address['first_name']. " " . $billing_address['last_name']; 59 } 40 60 if(!empty($billing_address['address_1'])) { 61 $billingAddressArray['address_1'] = substr($billing_address['address_1'],0,254); 41 62 $billingAddress = $billingAddress." ".$billing_address['address_1']; 42 63 } 43 64 if(!empty($billing_address['address_2'])) { 65 $billingAddressArray['address_2'] = substr($billing_address['address_2'],0,254); 44 66 $billingAddress = $billingAddress." ".$billing_address['address_2']; 45 67 } 46 68 if(!empty($billing_address['city'])) { 69 $billingAddressArray['city'] = substr($billing_address['city'],0,254); 47 70 $billingAddress = $billingAddress." ".$billing_address['city']; 48 71 } 49 72 if(!empty($billing_address['state'])) { 73 $billingAddressArray['state'] = substr($billing_address['state'],0,254); 50 74 $billingAddress = $billingAddress." ".$billing_address['state']; 51 75 } 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; 53 85 } else { 54 $billingAddress = "";86 return $addressData; 55 87 } 56 88 57 return $billingAddress;58 89 } 59 90 } -
cashfree/trunk/includes/request/class-wc-cashfree-request-checkout.php
r2747397 r2753558 45 45 "order_note" => "WooCommerce", 46 46 "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 ), 48 48 "return_url" => self::get_return_url('capture', $order->get_order_key(), $gateway) 49 49 ) -
cashfree/trunk/includes/request/class-wc-cashfree-request-shipping.php
r2742179 r2753558 21 21 $order = new WC_Order( $order_id ); 22 22 $shipping_address=$order->get_address( 'shipping' ) ; 23 $addressData = array(); 24 $shippingAddressArray = array(); 23 25 $shippingAddress = ""; 24 26 if ( !empty($shipping_address) ) { 27 if(!empty($shipping_address['first_name'])) { 28 $shippingAddressArray['full_name'] = $shipping_address['first_name']. " " . $shipping_address['last_name']; 29 } 25 30 if(!empty($shipping_address['address_1'])) { 31 $shippingAddressArray['address_1'] = substr($shipping_address['address_1'],0,254); 26 32 $shippingAddress = $shippingAddress." ".$shipping_address['address_1']; 27 33 } 28 34 if(!empty($shipping_address['address_2'])) { 35 $shippingAddressArray['address_2'] = substr($shipping_address['address_2'],0,254); 29 36 $shippingAddress = $shippingAddress." ".$shipping_address['address_2']; 30 37 } 31 38 if(!empty($shipping_address['city'])) { 39 $shippingAddressArray['city'] = substr($shipping_address['city'],0,254); 32 40 $shippingAddress = $shippingAddress." ".$shipping_address['city']; 33 41 } 34 42 if(!empty($shipping_address['state'])) { 43 $shippingAddressArray['state'] = substr($shipping_address['state'],0,254); 35 44 $shippingAddress = $shippingAddress." ".$shipping_address['state']; 36 45 } 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; 38 55 } 39 56 40 return $ shippingAddress;57 return $addressData; 41 58 42 59 } -
cashfree/trunk/readme.txt
r2747397 r2753558 4 4 Tested up to: 6.0 5 5 Requires PHP: 5.6 6 Stable tag: 4.3. 37 Version: 4.3. 36 Stable tag: 4.3.4 7 Version: 4.3.4 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 33 33 34 34 == Changelog == 35 36 = 4.3.4 = 37 * Bugfix for order capture redirection 38 * Change cashfree default logo size 35 39 36 40 = 4.3.3 =
Note: See TracChangeset
for help on using the changeset viewer.