我正在尝试使用Paypal网站付款专业定期付款系统。然而,从Paypal返回的回报似乎缺少一些数据,并且正在抛出以下内容:
java.lang.NumberFormatException:org.apache.axis.encoding.ser.CalendarDeserializer.makeValue(CalendarDeserializer.java:64)中的日期/时间无效
仅在设置完所有数据后调用CreateRecurringPaymentsProfile
时才会这样。我为RecurringPaymentsProfileDetailsType
发送的日期时间是正确的,错误如下:
<cfreturn pp_caller.call("CreateRecurringPaymentsProfile",pp_request)#>
以下是有问题的方法:
<cffunction name="CreateRecurringPaymentsProfile" returntype="any" output="no">
<cfargument name="buyerLastName" type="string" required="true">
<cfargument name="buyerFirstName" type="string" required="true">
<cfargument name="buyerAddress1" type="string" required="true">
<cfargument name="buyerAddress2" type="string">
<cfargument name="buyerCity" type="string" required="true">
<cfargument name="buyerZipCode" type="string" required="true">
<cfargument name="buyerState" type="string" required="true">
<cfargument name="creditCardType" type="string" required="true">
<cfargument name="creditCardNumber" type="string" required="true">
<cfargument name="CVV2" type="string" required="true">
<cfargument name="expMonth" type="string" required="true">
<cfargument name="expYear" type="string" required="true">
<cfargument name="paymentAmount" type="string" required="true">
<cfargument name="paypalToken" type="string" required="true">
<cfscript>
//*******
currencies = CreateObject("java", "com.paypal.soap.api.CurrencyCodeType");
userStatusCodes = CreateObject("java", "com.paypal.soap.api.PayPalUserStatusCodeType");
details= CreateObject("java", "com.paypal.soap.api.CreateRecurringPaymentsProfileRequestDetailsType");
// Create the request object
pp_request = CreateObject("java", "com.paypal.soap.api.CreateRecurringPaymentsProfileRequestType");
pp_request.setVersion(53);
if(paypalToken IS ''){
creditCardTypes = CreateObject("java", "com.paypal.soap.api.CreditCardTypeType");
countryCodes = CreateObject("java", "com.paypal.soap.api.CountryCodeType");
paymentTypes = CreateObject("java", "com.paypal.soap.api.PaymentActionCodeType");
creditCard = CreateObject("java", "com.paypal.soap.api.CreditCardDetailsType");
switch(creditCardType)
{
case "Visa":
{
creditCard.setCreditCardType(creditCardTypes.Visa);
break;
}
case "MasterCard":
{
creditCard.setCreditCardType(creditCardTypes.MasterCard);
break;
}
case "Discover":
{
creditCard.setCreditCardType(creditCardTypes.Discover);
break;
}
case "Amex":
{
creditCard.setCreditCardType(creditCardTypes.Amex);
break;
}
} //end switch
creditCard.setCreditCardNumber(creditCardNumber);
creditCard.setExpMonth(expMonth);
creditCard.setExpYear(expYear);
creditCard.setCVV2(CVV2);
// Payer info
cardOwner = CreateObject("java", "com.paypal.soap.api.PayerInfoType");
// Name
payerName = CreateObject("java", "com.paypal.soap.api.PersonNameType");
payerName.setFirstName(buyerFirstName);
payerName.setLastName(buyerLastName);
// Address
address = CreateObject("java", "com.paypal.soap.api.AddressType");
address.setStreet1(buyerAddress1);
address.setStreet2(buyerAddress2);
address.setCityName(buyerCity);
address.setStateOrProvince(buyerState);
address.setPostalCode(buyerZipCode);
address.setCountryName("USA");
address.setCountry(countryCodes.US);
cardOwner.setPayerName(payerName);
cardOwner.setPayerCountry(countryCodes.US);
cardOwner.setAddress(address);
creditCard.setCardOwner(cardOwner);
details.setCreditCard(creditCard);
}
else{
details.setToken(paypalToken);
}
// Details
recurringDetails= CreateObject("java", "com.paypal.soap.api.RecurringPaymentsProfileDetailsType");
//MAKE A JAVA DATE
calendar = CreateObject("java", "java.util.Calendar");
calendarObj1 = calendar.getInstance();
calendarObj1.setTime(now());
recurringDetails.setBillingStartdate(calendarObj1);
// Schedule Details
scheduleDetails= CreateObject("java", "com.paypal.soap.api.ScheduleDetailsType");
scheduleDetails.setDescription("Tattooed Pages Subscription");
billPeriodDetails= CreateObject("java", "com.paypal.soap.api.BillingPeriodDetailsType");
billingPeriodTypes= CreateObject("java", "com.paypal.soap.api.BillingPeriodType");
billPeriodDetails.setBillingFrequency(1);
billPeriodDetails.setBillingPeriod(billingPeriodTypes.Month);
orderTotal = CreateObject("java", "com.paypal.soap.api.BasicAmountType");
orderTotal.setCurrencyID(currencies.USD);
orderTotal.set_value(paymentAmount);
billPeriodDetails.setAmount(orderTotal);
scheduleDetails.setPaymentPeriod(billPeriodDetails);
details.setRecurringPaymentsProfileDetails(recurringDetails);
details.setScheduleDetails(scheduleDetails);
pp_request.setCreateRecurringPaymentsProfileRequestDetails(details);
//*******
</cfscript>
<cfreturn #pp_caller.call("CreateRecurringPaymentsProfile", pp_request)#>
由于它发生在CalendarDeserializer
,似乎是从Paypal返回。