@Property
protected float transactionFeeRate = 0.01f;
public String makePaymentMember(String customerId, float amount) {
Customer customer = null;
try {
customer = customerRegistry.getCustomer(customerId);
} catch (CustomerNotFoundException ex) {
return "Payment failed due to " + ex.getMessage();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
}
CreditCardDetailsType ccDetails = customer.getCreditCard();
String status;
try {
status = creditCardPayment.authorize(ccDetails, amount);
} catch (AuthorizeFault_Exception e) {
status = e.getFaultInfo().getErrorCode();
}
StringBuffer body = new StringBuffer();
body.append(customer);
body.append("\n").append("Status: ").append(status).append("\n");
emailGateway.sendEmail("order@tuscanyscatours.com", customer.getEmail(), "Status for your payment", body
.toString());
return status;
}