関数
OrderMeta::__construct( int $orderid )
Constructs an AmazonPay order object from an existing transaction
パラメータ パラメータ
- $orderid
(数値) (必須)
ファイル: src/Models/OrderMeta.php
public function __construct($orderid) { global $usces; $this->orderid = (int)$orderid; $this->chargeId = $usces->get_order_meta_value(self::CHARGE_ID, $this->orderid); $this->chargePermissionId = $usces->get_order_meta_value(self::CHARGE_PERMISSION_ID, $this->orderid); $this->refundId = $usces->get_order_meta_value(self::REFUND_ID, $this->orderid); $this->linkKey = $usces->get_order_meta_value(self::LINK_KEY, $this->orderid); $this->paymentCurrency = $usces->get_order_meta_value(self::PAYMENT_CURRENCY, $this->orderid); $ipnNotificationIds = $usces->get_order_meta_value(self::IPN_NOTIFICATION_IDS, $this->orderid); $this->mostRecentTransactionAmount = $usces->get_order_meta_value( self::MOST_RECENT_TRANS_AMOUNT, $this->orderid ); if (empty($this->chargePermissionId)) { throw new InvalidArgumentException('No such Amazon Pay order exists for the given order ID'); } if (empty($ipnNotificationIds)) { $this->ipnNotificationIds = []; } else { $this->ipnNotificationIds = json_decode($ipnNotificationIds); } if (!empty($this->chargeId)) { $chargeState = json_decode($usces->get_order_meta_value(self::CHARGE_STATE, $this->orderid), true); $this->chargeState = new Charge\State( $chargeState['state'], $chargeState['reasonCode'], $chargeState['reasonDescription'] ); } if (!empty($this->refundId)) { $refundState = json_decode($usces->get_order_meta_value(self::REFUND_STATE, $this->orderid), true); $this->refundState = new Refund\State( $refundState['state'], $refundState['reasonCode'], $refundState['reasonDescription'] ); } }