I am using the USAEPAY Web service for credit card services, including adding, updating and deleting credit cards. Adding/updating works fine, however the credit card deletion results in the error:
com.usaepay.api.jaxws.GeneralFault_Exception: 40030: Customer Not Found
It is quite strange because I check the customer number in all other operations and this number is the same and it works
Code example
Add credit card:
public void addPaymentMethodToCustomer(String customerNum, SavedCreditCardInfo savedCreditCardInfo, Address address) {
UeSecurityToken securityToken = getSecurityToken(null);
PaymentMethod paymentMethod = createUSAEPaymentMethod(savedCreditCardInfo, address);
BigInteger paymentMethodID = null;
if(securityToken != null) {
try {
UeSoapServerPortType client = getClient();
paymentMethodID = client.addCustomerPaymentMethod(securityToken, new BigInteger(customerNum), paymentMethod, false, false);
} catch (Exception e) {
LOG.error("Unable to add payment method for customer " + customerNum, e);
throw new AddPaymentMethodException("Unable to add payment method for USA E Pay customer num " + customerNum);
}
LOG.info("Succesfully added payment method for customer=" + customerNum + " with payment method=" + paymentMethodID );
}
}
Log:
INFO com.smartdestinations.service.payment.impl.USAEPayServiceImpl:288 - Succesfully added payment method for customer=25468380 with payment method=12184
Deletion:
public void deleteCustomerPaymentMethod(String paymentMethodId, String customerNum) {
UeSecurityToken securityToken = getSecurityToken(null);
if(securityToken != null) {
try {
UeSoapServerPortType client = getClient();
client.deleteCustomerPaymentMethod(securityToken, new BigInteger(customerNum), new BigInteger(paymentMethodId));
} catch (Exception e) {
LOG.error("Unable to delete payment method with customerNumber=" + customerNum + " and paymentID=" + paymentMethodId, e);
throw new DeletePaymentMethodException("Unable to delete payment with id " + paymentMethodId + " for customer " + customerNum);
}
}
}
Log: com.smartdestinations.service.payment.impl.USAEPayServiceImpl:388 - Unable to delete payment method with customerNumber=25468380 and paymentID=12184 com.usaepay.api.jaxws.GeneralFault_Exception: 40030: Customer Not Found