関数
OrderMeta::saveOrderMetaDataFromCheckoutSession( array $response, int $orderid, int|string $amount, string $currencyCode, Aivec\Welcart\SettlementModules\AmazonPay\Models\Charge\State|null $chargeState = null )
Saves Amazon Pay order meta data with Get Checkout Session
response and charge state after a successful purchase
パラメータ パラメータ
- $response
(配列) (必須)
- $orderid
(数値) (必須)
- $amount
(数値|文字列) (必須) authorize or capture amount
- $currencyCode
(文字列) (必須)
- $chargeState
(State) (任意)
ファイル: src/Models/OrderMeta.php
public static function saveOrderMetaDataFromCheckoutSession( array $response, $orderid, $amount, $currencyCode, Charge\State $chargeState = null ) { global $usces; $chargePermissionId = $response['chargePermissionId']; $chargeId = isset($response['chargeId']) ? $response['chargeId'] : null; $serializedChargeState = $chargeState !== null ? json_encode($chargeState) : null; $usces->set_order_meta_value(self::CHARGE_ID, $chargeId, $orderid); $usces->set_order_meta_value(self::CHARGE_PERMISSION_ID, $chargePermissionId, $orderid); $usces->set_order_meta_value(self::LINK_KEY, $response['checkoutSessionId'], $orderid); $usces->set_order_meta_value(self::CHARGE_STATE, $serializedChargeState, $orderid); $usces->set_order_meta_value(self::MOST_RECENT_TRANS_AMOUNT, $amount, $orderid); $usces->set_order_meta_value(self::PAYMENT_CURRENCY, $currencyCode, $orderid); $usces->set_order_meta_value('wc_trans_id', $chargePermissionId, $orderid); if ($chargeState !== null) { $state = $chargeState->getState(); if (!empty(Charge\State::STATE_TO_LOG_ACTION[$state])) { (new Logger())->logApiResponse(new Log( $chargePermissionId, Charge\State::STATE_TO_LOG_ACTION[$state], Log::RESPONSE_OK, $amount )); } } else { (new Logger())->logApiResponse(new Log( $chargePermissionId, Log::ACTION_DEFERRED_AUTHORIZE, Log::RESPONSE_OK, $amount )); } }