diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-21 09:24:23 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-21 09:24:23 +0000 |
commit | 9d393de96706a0bc0eaff5394eadd322b5fae277 (patch) | |
tree | 0124397ebef6e0edd4c435c6e1a1273ae6ee71c7 /sandbox/travelsample/contributions/payment-java-contribution/src/main | |
parent | 896792aac64e78c84e8b7cad3a87c3d729d1a7d3 (diff) |
Tidy code in Payment component implementation
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@786960 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/payment-java-contribution/src/main')
-rw-r--r-- | sandbox/travelsample/contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/sandbox/travelsample/contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java b/sandbox/travelsample/contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java index e3b1d88d4a..53e896a580 100644 --- a/sandbox/travelsample/contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java +++ b/sandbox/travelsample/contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java @@ -57,34 +57,21 @@ public class PaymentImpl implements Payment { protected float transactionFee = 0.01f;
public String makePaymentMember(String customerId, float amount) {
- Customer customer = null;
-
try {
- customer = customerRegistry.getCustomer(customerId);
+ Customer customer = customerRegistry.getCustomer(customerId);
+ String status = creditCardPayment.authorize(customer.getCreditCard(),
+ amount + transactionFee);
+ emailGateway.sendEmail("order@tuscanyscatours.com",
+ customer.getEmail(),
+ "Status for your payment",
+ customer + " >>> Status = " + status);
+ return status;
} catch (CustomerNotFoundException ex) {
return "Payment failed due to " + ex.getMessage();
+ } catch (AuthorizeFault_Exception e) {
+ return e.getFaultInfo().getErrorCode();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
- }
-
- CreditCardDetailsType ccDetails = customer.getCreditCard();
-
- float total = amount + transactionFee;
-
- String status;
- try {
- status = creditCardPayment.authorize(ccDetails, total);
- } 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;
+ }
}
-
}
|