関数
Checkout::handleCheckoutResult()
Handles a redirect from the amazonPayRedirectUrl
returned by Amazon
戻り値 戻り値
ファイル: src/Checkout.php
public function handleCheckoutResult() { global $usces; $sessionId = $_REQUEST['amazonCheckoutSessionId']; $result = (new API\CheckoutSession\Complete($this->module))->post($sessionId); if ($result instanceof GenericError) { $this->error = $result; $this->setToErrorPage(); return; } $this->checkoutResponse = json_decode($result['response'], true); $details = $this->checkoutResponse['statusDetails']; $checkoutSessionState = new Models\CheckoutSession\State( $details['state'], $details['reasonCode'], $details['reasonDescription'] ); if ($checkoutSessionState->isCanceled()) { $this->error = $checkoutSessionState->getErrorResponseFromCanceledState(); $this->setToErrorPage(); return; } // deferred authorization if ($checkoutSessionState->isOpen()) { $res = $usces->order_processing(); if (strtolower($res) === 'ordercompletion') { $this->setToCompletionPage(); } else { $this->setToErrorPage(); } return; } if ($checkoutSessionState->isCompleted()) { $getChargeRes = (new API\Charge\Get($this->module))->get($this->checkoutResponse['chargeId']); if ($getChargeRes instanceof GenericError) { $this->error = $getChargeRes; $this->setToErrorPage(); return; } $this->chargeResponse = json_decode($getChargeRes['response'], true); $res = $usces->order_processing(); if (strtolower($res) === 'ordercompletion') { $this->setToCompletionPage(); } else { $this->setToErrorPage(); } return; } $this->error = $this->module->errors->getErrorResponse(Errors\GenericErrorStore::UNKNOWN_ERROR); $this->setToErrorPage(); }