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 | |
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 '')
3 files changed, 20 insertions, 6 deletions
diff --git a/sandbox/travelsample/contributions/introducing-client-contribution/src/main/java/scatours/client/TestClient.java b/sandbox/travelsample/contributions/introducing-client-contribution/src/main/java/scatours/client/TestClient.java index cb80368918..64a1487f72 100644 --- a/sandbox/travelsample/contributions/introducing-client-contribution/src/main/java/scatours/client/TestClient.java +++ b/sandbox/travelsample/contributions/introducing-client-contribution/src/main/java/scatours/client/TestClient.java @@ -19,6 +19,8 @@ package scatours.client;
+import java.math.BigDecimal;
+
import com.tuscanyscatours.Bookings;
import com.tuscanyscatours.Checkout;
@@ -40,7 +42,6 @@ public class TestClient { String bookingCode = bookings.newBooking("FS1APR4", 1);
System.out.println("Booking code is " + bookingCode);
- checkout.makePayment(1995.00, "1234567843218765 10/10");
- System.out.println("Paid $1995.00");
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
}
}
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);
}
}
|