简体   繁体   English

Nuget包上Paypal Sandbox的负面测试

[英]Negative Testing on Paypal Sandbox on Nuget Package

I am trying to figure out how to do negative testing on the PayPal sandbox using the Nuget package from https://github.com/paypal/PayPal-NET-SDK 我试图弄清楚如何使用来自https://github.com/paypal/PayPal-NET-SDK的Nuget包对PayPal沙箱进行负面测试

I am using the call payment.Create(apiContext) and would like to test all the conditions for the errors. 我正在使用呼叫payment.Create(apiContext),并希望测试错误的所有条件。

I referred to the documents in https://www.paypal.com/us/smarthelp/article/how-do-i-test-failed-transactions-in-the-paypal-sandbox-ts1259 but explains how to add request headers to the REST calls. 我参考了https://www.paypal.com/us/smarthelp/article/how-do-i-test-failed-transactions-in-the-paypal-sandbox-ts1259中的文档,但解释了如何添加请求标题到REST调用。 I do not find such methods on the c# SDK. 我在c#SDK上找不到这样的方法。

any pointers will be helpful and appreciated. 任何指针都会有所帮助和赞赏。

There is no an official way to test negative conditions via .NET or java SDK. 没有官方方法可以通过.NET或java SDK测试负面条件。 Official documentation offers negative conditions only for REST and SOAP calls here . 官方文档仅为此处的 REST和SOAP调用提供了负面条件。

By the way I have been able to rise an error condition in this way: 顺便说一句,我已经能够以这种方式出现错误情况:

  1. Be sure your sandbox payer account has money enough to pay your item and keep a browser page open on 'edit payer account' page in your paypal development dashboard 确保您的沙箱付款人帐户有足够的钱来支付您的商品,并在您的PayPal开发信息中心的“编辑付款人帐户”页面上打开浏览器页面 PIC PIC

  2. Prepare the payment for the user and test it till the moment the sandbox payer arrive to the last step before paying 为用户准备付款并进行测试,直到沙盒付款人到达最后一步才付款为止 PIC

  3. On the 'edit payer account' page (see pt. 1) edit the available amount of the payer to a value lesser than the amount to pay (eg 1.0) 在“编辑付款人帐户”页面(请参阅第1页),将付款人的可用金额编辑为小于付款金额的值(例如1.0)

  4. Return to the payer page (see pt. 2) and press the 'continue' button. 返回付款人页面(参见第2页)并按“继续”按钮。 Payment will fail with the code : 付款将失败,代码为

    INSTRUMENT_DECLINED - The instrument presented was either declined by the processor or bank, or it can't be used for this payment. INSTRUMENT_DECLINED - 提供的工具被处理者或银行拒绝,或者不能用于此付款。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM