| @@ -512,9 +512,9 @@ | ||
| 512 | 512 | exit(); |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | $gateway_checkout_id = !empty($token['gateway_checkout_id']) && c_ws_plugin__s2member_gateway_checkouts::valid_id((string)$token['gateway_checkout_id']) ? (string)$token['gateway_checkout_id'] : ''; |
| 516 | - $gateway_checkout = $gateway_checkout_id ? c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id) : FALSE; | |
| 516 | + $gateway_checkout = $gateway_checkout_id ? c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id) : FALSE; | |
| 517 | 517 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'subscription') |
| 518 | 518 | { |
| 519 | 519 | echo wp_json_encode(array('error' => 'gateway_checkout_invalid')); |
| 520 | 520 | exit(); |
| @@ -575,9 +575,9 @@ | ||
| 575 | 575 | |
| 576 | 576 | $gateway_checkout_id = !empty($token['gateway_checkout_id']) && c_ws_plugin__s2member_gateway_checkouts::valid_id((string)$token['gateway_checkout_id']) ? (string)$token['gateway_checkout_id'] : ''; |
| 577 | 577 | if($gateway_checkout_id) |
| 578 | 578 | { |
| 579 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 579 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 580 | 580 | $expected_subscription_id = $gateway_checkout && !empty($gateway_checkout['gateway_ids']['subscription_id']) ? (string)$gateway_checkout['gateway_ids']['subscription_id'] : ''; |
| 581 | 581 | //260901.2145 A coordinator-backed browser may confirm only the PayPal subscription that s2Member created and persisted for this logical checkout. |
| 582 | 582 | if(!$expected_subscription_id || !hash_equals($expected_subscription_id, $subscription_id)) |
| 583 | 583 | { |
| @@ -1045,9 +1045,9 @@ | ||
| 1045 | 1045 | else if($op === 'get_order_status') |
| 1046 | 1046 | { |
| 1047 | 1047 | //260907.1820 This recovery endpoint is intentionally coordinator-only: the signed checkout token authorizes a local state read, while PayPal polling/retries remain server/webhook responsibilities. |
| 1048 | 1048 | $gateway_checkout_id = !empty($token['gateway_checkout_id']) && c_ws_plugin__s2member_gateway_checkouts::valid_id((string)$token['gateway_checkout_id']) ? (string)$token['gateway_checkout_id'] : ''; |
| 1049 | - $gateway_checkout = $gateway_checkout_id ? c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id) : FALSE; | |
| 1049 | + $gateway_checkout = $gateway_checkout_id ? c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id) : FALSE; | |
| 1050 | 1050 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment') |
| 1051 | 1051 | { |
| 1052 | 1052 | echo wp_json_encode(array('error' => 'gateway_checkout_invalid')); |
| 1053 | 1053 | exit(); |
| @@ -1077,9 +1077,9 @@ | ||
| 1077 | 1077 | |
| 1078 | 1078 | $gateway_checkout_id = !empty($token['gateway_checkout_id']) && c_ws_plugin__s2member_gateway_checkouts::valid_id((string)$token['gateway_checkout_id']) ? (string)$token['gateway_checkout_id'] : ''; |
| 1079 | 1079 | if($gateway_checkout_id) |
| 1080 | 1080 | { |
| 1081 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 1081 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 1082 | 1082 | $private_context = $gateway_checkout ? c_ws_plugin__s2member_gateway_checkouts::private_context_get($gateway_checkout_id) : FALSE; |
| 1083 | 1083 | $fulfillment_result = is_array($private_context) && !empty($private_context['paypal_checkout']['fulfillment_result']) && is_array($private_context['paypal_checkout']['fulfillment_result']) ? $private_context['paypal_checkout']['fulfillment_result'] : array(); |
| 1084 | 1084 | if($gateway_checkout && (string)$gateway_checkout['fulfillment_status'] === 'fulfilled' && !empty($fulfillment_result['rtn_url']) && !empty($fulfillment_result['rtn_post'])) |
| 1085 | 1085 | { |