Changeset 3200279
- Timestamp:
- 12/01/2024 04:21:25 PM (16 months ago)
- Location:
- cashfree
- Files:
-
- 30 added
- 4 edited
-
tags/4.7.6 (added)
-
tags/4.7.6/LICENSE (added)
-
tags/4.7.6/README.md (added)
-
tags/4.7.6/assets (added)
-
tags/4.7.6/assets/js (added)
-
tags/4.7.6/assets/js/checkout.js (added)
-
tags/4.7.6/assets/js/index.js (added)
-
tags/4.7.6/cashfree.php (added)
-
tags/4.7.6/dist (added)
-
tags/4.7.6/dist/main.js (added)
-
tags/4.7.6/includes (added)
-
tags/4.7.6/includes/class-wc-cashfree-api.php (added)
-
tags/4.7.6/includes/gateways (added)
-
tags/4.7.6/includes/gateways/class-wc-cashfree-block-support.php (added)
-
tags/4.7.6/includes/gateways/class-wc-cashfree-gateway.php (added)
-
tags/4.7.6/includes/gateways/class-wc-cashfree-payments.php (added)
-
tags/4.7.6/includes/http (added)
-
tags/4.7.6/includes/http/class-wc-cashfree-adapter.php (added)
-
tags/4.7.6/includes/request (added)
-
tags/4.7.6/includes/request/class-wc-cashfree-request-billing.php (added)
-
tags/4.7.6/includes/request/class-wc-cashfree-request-checkout.php (added)
-
tags/4.7.6/includes/request/class-wc-cashfree-request-items.php (added)
-
tags/4.7.6/includes/request/class-wc-cashfree-request-shipping.php (added)
-
tags/4.7.6/includes/settings (added)
-
tags/4.7.6/includes/settings/cashfree-payments.php (added)
-
tags/4.7.6/includes/wc-cashfree-functions.php (added)
-
tags/4.7.6/includes/wc-cashfree-scripts.php (added)
-
tags/4.7.6/readme.txt (added)
-
tags/4.7.6/templates (added)
-
tags/4.7.6/templates/payment-fields.php (added)
-
trunk/cashfree.php (modified) (1 diff)
-
trunk/includes/http/class-wc-cashfree-adapter.php (modified) (1 diff)
-
trunk/includes/request/class-wc-cashfree-request-checkout.php (modified) (2 diffs)
-
trunk/includes/request/class-wc-cashfree-request-items.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cashfree/trunk/cashfree.php
r3198819 r3200279 12 12 * Domain Path: /languages 13 13 * Requires at least: 4.4 14 * Tested up to: 6. 714 * Tested up to: 6.6 15 15 * WC requires at least: 3.0 16 * WC tested up to: 9. 416 * WC tested up to: 9.2 17 17 * 18 18 * -
cashfree/trunk/includes/http/class-wc-cashfree-adapter.php
r3198819 r3200279 69 69 if ( $http_code === 200 ) { 70 70 $cf_order = json_decode( wp_remote_retrieve_body( $response ) ); 71 72 // Check if the order has already been paid for. 73 if ( $cf_order->order_status === 'PAID' ) { 71 if ( $cf_order->order_status === 'PAID' || $cf_order->order_status === 'EXPIRED' ) { 74 72 throw new Exception( 'Please reach out to the support team' ); 75 73 } -
cashfree/trunk/includes/request/class-wc-cashfree-request-checkout.php
r3198819 r3200279 64 64 'pincode' => $postCode, 65 65 'cart_items' => array_map( 66 function( $item ) use ( $order ){67 return WC_Cashfree_Request_Item::build( $ order, $item );66 function( $item ) { 67 return WC_Cashfree_Request_Item::build( $item ); 68 68 }, 69 69 array_values( $order->get_items() ) … … 71 71 ) 72 72 ); 73 return $data; 74 } 73 75 74 return $data; 76 private static function get_valid_cart_items( $order ) { 77 $filtered_items = array_filter( 78 $order->get_items(), 79 function( $item ) { 80 return $item->get_product(); // Only include valid products 81 } 82 ); 83 84 return array_map( 85 function( $item ) use ( $order ) { 86 return WC_Cashfree_Request_Item::build( $order, $item ); 87 }, 88 $filtered_items 89 ); 75 90 } 76 91 -
cashfree/trunk/includes/request/class-wc-cashfree-request-items.php
r3198819 r3200279 19 19 * @return array 20 20 */ 21 public static function build( $order, $item ) { 22 require_once WC_CASHFREE_DIR_PATH . 'includes/request/class-wc-cashfree-request-checkout.php'; 23 $product = $item->get_product(); 21 public static function build( $item ) { 24 22 return array( 25 'item_id' => substr( $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id(), 0, 254 ),26 23 'item_name' => mb_convert_encoding(substr( $item->get_name(), 0, 254 ), 'UTF-8', 'UTF-8'), 27 'item_description' => mb_convert_encoding(substr( $product->get_description(), 0, 499 ), 'UTF-8', 'UTF-8'), 28 "tags" => [], 29 'item_details_url' => get_permalink( $item->get_product_id() ), 30 'item_image_url' => (string) wp_get_attachment_image_url( $product->get_image_id(), 'full' ), 31 'item_original_unit_price' => self::cfConvertToNumber($product->get_regular_price() ? $product->get_regular_price() : 0), 32 'item_discounted_unit_price'=> self::cfConvertToNumber($product->get_price() ? $product->get_price() : 0), 24 'item_original_unit_price' => self::cfConvertToNumber($item->get_total() ? $item->get_total() : 0), 33 25 'item_quantity' => $item->get_quantity(), 34 'item_currency' => $order->get_currency()35 26 ); 36 27 }
Note: See TracChangeset
for help on using the changeset viewer.