如何测试拒绝 Amazon Payments 授权?

How to test declination of Amazon Payments authorization?

在 Amazon Payments 上授权订单时,如果客户必须登录 Amazon Payments 并更改付款方式,授权状态可能会返回 Declined,原因是 InvalidPaymentMethod

如何强制亚马逊重现这个InvalidPaymentMethod案例进行测试?

哦,RTM...我在 Integration Guide 中找到了答案。进行授权调用时,必须指定 SellerAuthorizationNote:

{"SandboxSimulation": {
     "State":"Declined",
     "ReasonCode":"InvalidPaymentMethod",
     "PaymentMethodUpdateTimeInMins":5}}

在这里为集成此支付方式的开发人员留下问题。

这是最终方法的样子:

/**
 * @param string $orderReferenceId
 * @param string $authorizationReferenceId
 * @param float  $amount
 * @param string $currencyCode
 * @return \OffAmazonPaymentsService_Model_AuthorizeResponse
 */
private function authorizeOrder($orderReferenceId, $authorizationReferenceId, $amount, $currencyCode)
{
    return $this->getClient()->authorize([
        'SellerId'                 => $this->serviceCrendentials['merchantId'],
        'AmazonOrderReferenceId'   => $orderReferenceId,
        'AuthorizationReferenceId' => $authorizationReferenceId,
        'AuthorizationAmount'      => [
            'Amount'               => $amount,
            'CurrencyCode'         => $currencyCode
        ],
        // Delete it, it's just for sandbox testing
        'SellerAuthorizationNote'  => json_encode(['SandboxSimulation' => [
            'State'                         => 'Declined',
            'ReasonCode'                    => 'InvalidPaymentMethod',
            'PaymentMethodUpdateTimeInMins' => 5
        ]])
    ]);
}