我正在使用PayPal沙箱进行测试付款。自昨天以来一直运作良好,我从昨天开始连续收到错误500,
我查了链接https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR, 找到问题背后的原因并没有多大帮助。
Java Stack-trace:
com.paypal.base.rest.PayPalRESTException:错误代码:500响应:{" name":" INTERNAL_SERVICE_ERROR"," message":&# 34;发生内部服务错误"," information_link":" https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR"," debug_id":" e1242b0ed621b&# 34;} at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:66) 在com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:436) 在com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:266) 在com.paypal.api.payments.CreditCard.create(CreditCard.java:368) 在com.elegantra.service.impl.PaypalRestServiceImpl.createCreditCard(PaypalRestServiceImpl.java:130) at com.elegantra.service.impl.PaymentServiceImpl.newCardPayment(PaymentServiceImpl.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 在org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 在org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) 在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor $ 1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) 在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 在org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) 在com.sun.proxy。$ Proxy88.newCardPayment(未知来源) at com.elegantra.service.impl.PaymentServiceImplTest.testSuccessfulPaymentWithNewCard(PaymentServiceImplTest.java:154) at com.elegantra.service.impl.PaymentServiceImplTest.testSuccessfulPaymentAmountLessThan1000(PaymentServiceImplTest.java:248) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:47) 在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) 在org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 在org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) 在org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) 在org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) 在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) 在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) 在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:238) 在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:63) 在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) 在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:53) 在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:229) 在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 在org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) 在org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) 在org.junit.runners.ParentRunner.run(ParentRunner.java:309) 在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175) 在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 引起:com.paypal.base.exception.HttpErrorException:错误代码:500响应:{" name":" INTERNAL_SERVICE_ERROR"," message":&# 34;发生内部服务错误"," information_link":" https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR"," debug_id":" e1242b0ed621b&# 34;} 在com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:173) 在com.paypal.base.HttpConnection.execute(HttpConnection.java:71) 在com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:424) ......还有49个 引起:java.io.IOException:响应代码:500将日志级别更改为DEBUG以获取详细信息。 在com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:153) ... 51更多
以下是用于运行但现在失败的测试:
@Test
public void testSuccessfulPaymentWithNewCard() throws Exception {
NewCardPaymentDto paymentDto = new NewCardPaymentDto();
paymentDto.setCardType("visa");
paymentDto.setCardNumber("XXXXXXXXXXXXXXX");
paymentDto.setExpYear("YYYY");
paymentDto.setExpMonth("MM");
paymentDto.setCvv("000");
paymentDto.setZipcode("94085");
paymentDto.setConsumerId(user.getUserId());
paymentDto.setOrderId(orderDetails.getId());
paymentDto.setTip(1.0);
paymentDto.setNameOnCard("John Doe");
//making call to paypal service
PaymentStatus paymentStatus = paymentService.newCardPayment(newCard,
orderDetails);
Card card = cardRepository.findByLastFourDigits("5105");
assertThat(paymentStatus.getId(), notNullValue());
assertThat(paymentStatus.getStatus(), equalTo("approved"));
assertThat(paymentStatus.getCard(), equalTo(card));
}
PaymentServiceImpl.newCardPayment正在拨打paypal rest api,片段:
Payment payment = paypalRestService.makeDirectPayment(orderDetails.computeAmount(), newCard.getCardType(),
newCard.getCardNumber(), newCard.getExpMonth(), newCard.getExpYear(), newCard.getCvv(), newCard.getNameOnCard());
以下是我在运行测试后从paypal沙盒交易部分获得的详细信息:
请求:
{
"body": {
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"first_name": "John Doe",
"expire_month": 10,
"number": "xxxxxxxxxxxx6370",
"cvv2": "***",
"expire_year": 2020,
"type": "visa"
}
}
]
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": "13.80"
}
}
]
},
"header": {
"content-length": "461",
"paypal-request-id": "c01e88d8-a784-42a6-adc8-4412e51d041b",
"x-pp-silover": "name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D1748763222",
"connection": "keep-alive",
"accept": "text/html, image/gif, image/jpeg, *; q\\u003d.2, */*; q\\u003d.2",
"client-auth": "No cert",
"host": "api.sandbox.paypal.com",
"user-agent": "PayPalSDK/PayPal-Java-SDK 1.2.8 (lang\\u003dJava;v\\u003d1.7.0_45;bit\\u003d64;os\\u003dWindows_8 6.2)",
"authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxG5ws",
"x-pp-corrid": "64ec69a84149",
"pp_remote_addr": "106.51.131.226",
"content-type": "application/json",
"x-pp-slingshot-targetapp": "platformapiserv"
},
"additional_properties": {},
"method": "POST"
}
响应:
{
"status": 400,
"duration_time": 1523,
"body": {
"message": "An unknown error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR",
"name": "UNKNOWN_ERROR",
"debug_id": "64ec69a84149"
},
"additional_properties": {},
"header": {
"Content-Length": "184",
"Content-Language": "*",
"CORRELATION-ID": "64ec69a84149",
"Date": "Wed, 23 Sep 2015 05:45:13 GMT",
"Connection": "close",
"Paypal-Debug-Id": "64ec69a84149",
"PROXY_SERVER_INFO": "host\\u003dslcsbplatformapiserv3001.slc.paypal.com;threadId\\u003d355",
"Content-Type": "application/json"
}
}
请帮帮我