[英]How to test a Braintree transaction refund?
I'm trying to run tests on Braintree transaction refunding, but I'm running into a problem. 我正在尝试对Braintree交易退款进行测试,但我遇到了一个问题。 Braintree's API only allows you to issue refunds for transactions that have settled. Braintree的API仅允许您为已结算的交易发放退款。 However, transactions created in the sandbox environment only "settle" once every 24 hours. 但是,在沙箱环境中创建的事务仅每24小时“结算”一次。 So, when I try to refund them in the test suite, the refunds are always rejected because the original transaction is "submitted_for_settlement" and not "settled". 因此,当我尝试在测试套件中退款时,退款总是被拒绝,因为原始交易是“submission_for_settlement”而不是“已结算”。
Any way around this? 有什么方法吗?
I work at Braintree. 我在布伦特里工作。 If you have more questions, you can always get in touch with our support team . 如果您有更多问题,可以随时与我们的支持团队联系 。
The TestHelper in the Braintree PHP library has a method to settle a transaction in sandbox: Braintree PHP库中的TestHelper有一种方法来解决沙箱中的事务:
class Braintree_TestHelper
{
. . .
public static function settle($transactionId)
{
$http = new Braintree_Http(Braintree_Configuration::$global);
$path = Braintree_Configuration::$global->merchantPath() . '/transactions/' . $transactionId . '/settle';
$http->put($path);
}
. . .
}
Similar methods exist for our other supported languages. 我们的其他支持语言也有类似的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.