diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-17 15:23:10 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-17 15:23:10 +0000 |
commit | 8c750d3140ad9cfd8b7af778c50fbbf526a6d198 (patch) | |
tree | a584be48bea5eb7c6cfab8824c993fc006194c45 /sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution | |
parent | 25bc47ea8f541b5ecf2b864ab41d40d116b1afd7 (diff) |
Add a little more function to the simple travel booking sample and simplify the command line launcher contribution configuration.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775672 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution')
2 files changed, 17 insertions, 4 deletions
diff --git a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java index 688fc7e83b..29c84d2bc0 100644 --- a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java +++ b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java @@ -18,9 +18,11 @@ */
package com.tuscanyscatours;
+import java.math.BigDecimal;
+
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface Checkout {
- void makePayment(double amount, String cardInfo);
+ void makePayment(BigDecimal amount, String cardInfo);
}
diff --git a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java index 68bf25a8cd..09e5d322a3 100644 --- a/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java +++ b/sandbox/travelsample/contributions/introducing-tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java @@ -18,11 +18,22 @@ */
package com.tuscanyscatours;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
public class ShoppingCart implements Checkout, Updates {
- public void makePayment(double amount, String cardInfo) {
- // make payment for trips in cart giving card details
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged $" + amount + " to card " + cardInfo + " for trips" );
+ for (String trip : bookedTrips){
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
}
public void addTrip(String resCode) {
- // add the booked trip to the cart
+ bookedTrips.add(resCode);
}
}
|