| @@ -1560,9 +1560,9 @@ | ||
| 1560 | 1560 | $gateway_checkout_lock = ''; |
| 1561 | 1561 | |
| 1562 | 1562 | if($gateway_checkout_id) |
| 1563 | 1563 | { |
| 1564 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 1564 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 1565 | 1565 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment') |
| 1566 | 1566 | return array('__error' => 'gateway_checkout_invalid'); |
| 1567 | 1567 | |
| 1568 | 1568 | //260902.0635 Return an already-persisted PayPal order before another provider create; a lost browser response can therefore resume the same logical purchase. |
| @@ -1573,9 +1573,9 @@ | ||
| 1573 | 1573 | $gateway_checkout_lock = c_ws_plugin__s2member_gateway_checkouts::processing_lock($gateway_checkout_id); |
| 1574 | 1574 | if(!$gateway_checkout_lock) |
| 1575 | 1575 | return array('__error' => 'gateway_checkout_busy'); |
| 1576 | 1576 | |
| 1577 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 1577 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 1578 | 1578 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment') |
| 1579 | 1579 | { |
| 1580 | 1580 | c_ws_plugin__s2member_gateway_checkouts::processing_unlock($gateway_checkout_id, $gateway_checkout_lock); |
| 1581 | 1581 | return array('__error' => 'gateway_checkout_invalid'); |
| @@ -1856,9 +1856,9 @@ | ||
| 1856 | 1856 | |
| 1857 | 1857 | if($gateway_checkout_id) |
| 1858 | 1858 | { |
| 1859 | 1859 | //260907.1820 For coordinator-backed captures, the order ID already persisted server-side is authoritative; never let a browser-supplied order ID rebind this logical checkout to another PayPal resource. |
| 1860 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 1860 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 1861 | 1861 | $expected_order_id = $gateway_checkout && !empty($gateway_checkout['gateway_ids']['order_id']) ? (string)$gateway_checkout['gateway_ids']['order_id'] : ''; |
| 1862 | 1862 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment' || !$expected_order_id || !hash_equals($expected_order_id, $order_id)) |
| 1863 | 1863 | return array('__error' => 'gateway_checkout_order_mismatch'); |
| 1864 | 1864 | |
| @@ -1884,9 +1884,9 @@ | ||
| 1884 | 1884 | try |
| 1885 | 1885 | { |
| 1886 | 1886 | if($gateway_checkout_id) |
| 1887 | 1887 | { |
| 1888 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 1888 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 1889 | 1889 | if(!$gateway_checkout || empty($gateway_checkout['gateway_ids']['order_id']) || !hash_equals((string)$gateway_checkout['gateway_ids']['order_id'], $order_id)) |
| 1890 | 1890 | return array('__error' => 'gateway_checkout_order_mismatch'); |
| 1891 | 1891 | |
| 1892 | 1892 | $gateway_status = !empty($gateway_checkout['gateway_status']) ? strtoupper((string)$gateway_checkout['gateway_status']) : ''; |
| @@ -2036,9 +2036,9 @@ | ||
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | try |
| 2039 | 2039 | { |
| 2040 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2040 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2041 | 2041 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment') |
| 2042 | 2042 | return array('handled' => FALSE, 'ok' => FALSE, 'error' => 'not_coordinator_checkout'); |
| 2043 | 2043 | |
| 2044 | 2044 | //260907.1820 Provider identities are immutable once learned: browser/webhook reconciliation may advance status only for the same PayPal order/capture and must never rebind a checkout to conflicting IDs. |
| @@ -2096,9 +2096,9 @@ | ||
| 2096 | 2096 | |
| 2097 | 2097 | if(!$gateway_checkout_id || ($completion_error = self::paypal_checkout_order_completion_error($order, $order_id, $token))) |
| 2098 | 2098 | return array('ok' => FALSE, 'error' => $completion_error ? $completion_error : 'gateway_checkout_invalid'); |
| 2099 | 2099 | |
| 2100 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2100 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2101 | 2101 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'payment') |
| 2102 | 2102 | return array('ok' => FALSE, 'error' => 'gateway_checkout_invalid'); |
| 2103 | 2103 | |
| 2104 | 2104 | $private_context = c_ws_plugin__s2member_gateway_checkouts::private_context_get($gateway_checkout_id); |
| @@ -2288,9 +2288,9 @@ | ||
| 2288 | 2288 | |
| 2289 | 2289 | if(!$subscription_id || !c_ws_plugin__s2member_gateway_checkouts::valid_id($gateway_checkout_id)) |
| 2290 | 2290 | return array('handled' => false, 'ok' => false, 'recovered' => false, 'error' => 'not_coordinator_checkout'); |
| 2291 | 2291 | |
| 2292 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2292 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2293 | 2293 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'subscription') |
| 2294 | 2294 | return array('handled' => false, 'ok' => false, 'recovered' => false, 'error' => 'not_coordinator_checkout'); |
| 2295 | 2295 | |
| 2296 | 2296 | $lock = c_ws_plugin__s2member_gateway_checkouts::processing_lock($gateway_checkout_id, 60); |
| @@ -2298,9 +2298,9 @@ | ||
| 2298 | 2298 | return array('handled' => true, 'ok' => false, 'recovered' => false, 'error' => 'gateway_checkout_busy', 'gateway_checkout_id' => $gateway_checkout_id); |
| 2299 | 2299 | |
| 2300 | 2300 | try |
| 2301 | 2301 | { |
| 2302 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2302 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2303 | 2303 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'subscription') |
| 2304 | 2304 | return array('handled' => true, 'ok' => false, 'recovered' => false, 'error' => 'gateway_checkout_invalid', 'gateway_checkout_id' => $gateway_checkout_id); |
| 2305 | 2305 | |
| 2306 | 2306 | $existing_subscription_id = !empty($gateway_checkout['gateway_ids']['subscription_id']) ? (string)$gateway_checkout['gateway_ids']['subscription_id'] : ''; |
| @@ -2356,9 +2356,9 @@ | ||
| 2356 | 2356 | $gateway_checkout_lock = ''; |
| 2357 | 2357 | |
| 2358 | 2358 | if($gateway_checkout_id) |
| 2359 | 2359 | { |
| 2360 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2360 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2361 | 2361 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'subscription') |
| 2362 | 2362 | return array('__error' => 'gateway_checkout_invalid'); |
| 2363 | 2363 | |
| 2364 | 2364 | //260901.2145 Return a previously persisted PayPal subscription before making another create request; this also recovers a browser reload after server-side creation succeeded. |
| @@ -2368,9 +2368,9 @@ | ||
| 2368 | 2368 | $gateway_checkout_lock = c_ws_plugin__s2member_gateway_checkouts::processing_lock($gateway_checkout_id); |
| 2369 | 2369 | if(!$gateway_checkout_lock) |
| 2370 | 2370 | return array('__error' => 'gateway_checkout_busy'); |
| 2371 | 2371 | |
| 2372 | - $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::get($gateway_checkout_id); | |
| 2372 | + $gateway_checkout = c_ws_plugin__s2member_gateway_checkouts::load_state($gateway_checkout_id); | |
| 2373 | 2373 | if(!$gateway_checkout || (string)$gateway_checkout['gateway'] !== 'paypal_checkout' || (string)$gateway_checkout['operation'] !== 'subscription') |
| 2374 | 2374 | { |
| 2375 | 2375 | c_ws_plugin__s2member_gateway_checkouts::processing_unlock($gateway_checkout_id, $gateway_checkout_lock); |
| 2376 | 2376 | return array('__error' => 'gateway_checkout_invalid'); |