Changeset 2574918
- Timestamp:
- 07/29/2021 06:21:25 PM (4 years ago)
- Location:
- consumer-financing-by-chargeafter/trunk
- Files:
-
- 4 edited
-
assets/js/promo.js (modified) (1 diff)
-
includes/wc-chargeafter-api.php (modified) (7 diffs)
-
includes/wc-chargeafter-helper.php (modified) (1 diff)
-
includes/wc-chargeafter-start-checkout-script.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
consumer-financing-by-chargeafter/trunk/assets/js/promo.js
r2428921 r2574918 1 !function(e,t,c,a,n){var r,o=t.getElementsByTagName(c)[0];e.ChargeAfter || (e.ChargeAfter = {}), t.getElementById(a)||(e.ChargeAfter.cfg = n,(r=t.createElement(c)).id=a, r.src="https://cdn" + caConfig.url + "/promotional-widget/v 1/widget.min.js?t="+1*new Date, r.async=!0,o.parentNode.insertBefore(r,o))}(window,document,"script","chargeafter-promotional-widget",caConfig);1 !function(e,t,c,a,n){var r,o=t.getElementsByTagName(c)[0];e.ChargeAfter || (e.ChargeAfter = {}), t.getElementById(a)||(e.ChargeAfter.cfg = n,(r=t.createElement(c)).id=a, r.src="https://cdn" + caConfig.url + "/promotional-widget/v2/widget.min.js?t="+1*new Date, r.async=!0,o.parentNode.insertBefore(r,o))}(window,document,"script","chargeafter-promotional-widget",caConfig); 2 2 jQuery(".single_variation_wrap").on("show_variation",function(i,e){let t=e.display_price,a=jQuery(".ca-promotional-widget.ca-product");if(t&&a){let i=a.data("widget-item-price"),e=a.data("widget-item-sku");t!=i&&e&&(ChargeAfter.promotionalWidget.update({items:[{sku:e,price:t}]}),a.data("widget-item-price",t))}}); -
consumer-financing-by-chargeafter/trunk/includes/wc-chargeafter-api.php
r2556894 r2574918 18 18 */ 19 19 public static function api_get_charge_data( $charge_id ) { 20 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v 1/post-sale/charges/' . (string) $charge_id;20 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v2/post-sale/charges/' . (string) $charge_id; 21 21 22 22 return self::api_generic_post_sale( 'wp_safe_remote_get', $url ); … … 81 81 */ 82 82 public static function api_post_sale( $charge_id, $action, $data = '' ) { 83 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v 1/post-sale/charges/' . (string) $charge_id . '/' . $action;83 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v2/post-sale/charges/' . (string) $charge_id . '/' . $action; 84 84 85 85 return self::api_generic_post_sale( 'wp_safe_remote_post', $url, $data ); … … 132 132 */ 133 133 public static function api_create_charge( $token ) { 134 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v 1/payment/charges';134 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v2/payment/charges'; 135 135 136 136 return self::api_generic_post_sale( 'wp_safe_remote_post', $url, json_encode( array( 'confirmationToken' => $token ) ) ); … … 146 146 */ 147 147 public static function api_payment_partially_update( $chargeId, $order_id ) { 148 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v 1/post-sale/charges/' . $chargeId;148 $url = self::get_api_prefix() . WC_ChargeAfter_Helper::get_url_suffix() . '/v2/post-sale/charges/' . $chargeId; 149 149 150 150 return self::api_generic_patch_sale( $url, json_encode( array( 'merchantOrderId' => (string) $order_id ) ) ); … … 195 195 'requestInfo' => [ 196 196 'flowType' => 'Apply', 197 'channel' => ' InStore',197 'channel' => 'e_commerce', 198 198 'source' => 'Api' 199 199 ] … … 237 237 $body = json_decode($body, true); 238 238 239 return key_exists('data', $body) && isset($body['data'][' MerchantId']) ? $body['data']['MerchantId'] : null;239 return key_exists('data', $body) && isset($body['data']['merchantId']) ? $body['data']['merchantId'] : null; 240 240 } 241 241 … … 249 249 public static function api_get_merchant_settings( $merchant_id ) { 250 250 $json = @file_get_contents(WC_ChargeAfter_Helper::get_merchant_settings_with_cdn($merchant_id)); 251 if (empty($json)) { 252 return null; 253 } 254 255 return json_decode($json, true); 251 if (!empty($json)) { 252 $json_settings = json_decode($json, true); 253 if (empty($json_settings)) { 254 $json_settings = json_decode(gzdecode($json), true); 255 } 256 257 return $json_settings; 258 } 259 260 return null; 256 261 } 257 262 } -
consumer-financing-by-chargeafter/trunk/includes/wc-chargeafter-helper.php
r2556894 r2574918 343 343 */ 344 344 public static function get_cdn_url() { 345 return 'https://storage.googleapis.com/cdn-production-bucket/'; 345 return self::is_sandbox() 346 ? 'https://cdn-sandbox.ca-dev.co/' 347 : 'https://storage.googleapis.com/cdn-production-bucket/'; 346 348 } 347 349 -
consumer-financing-by-chargeafter/trunk/includes/wc-chargeafter-start-checkout-script.php
r2556894 r2574918 164 164 */ 165 165 public static function start_checkout_script( $public_key, $url_suffix ) { 166 $date = '${Date.now()}';167 168 166 $onDataUpdate = ''; 169 167 if ( WC_ChargeAfter_Helper::is_enabled_data_update() ) { … … 197 195 }; 198 196 199 document.addEventListener('DOMContentLoaded', () => { 200 (function () { 201 var script = document.getElementById('ca-integration-script') || document.createElement('script'); 202 script.src = `https://cdn{{URL_SUFFIX}}/web/v1/caIntegration.min.js?t={$date}`; 203 script.id = 'ca-integration-script'; 204 document.body.append(script); 205 })(); 206 }); 197 !function(e,t,c,a,n){var r,o=t.getElementsByTagName(c)[0]; 198 e.ChargeAfter || (e.ChargeAfter = {}), 199 t.getElementById(a)||(e.ChargeAfter.cfg = n,(r=t.createElement(c)).id=a, 200 r.src='https://cdn{{URL_SUFFIX}}/web/v2/chargeafter.min.js?t='+1*new Date, 201 r.async=!0,o.parentNode.insertBefore(r,o))} 202 (window,document,'script','chargeafter-checkout-finance',caConfig); 207 203 208 204 var presentCheckout = function(hash) {
Note: See TracChangeset
for help on using the changeset viewer.