diff options
Diffstat (limited to 'sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java')
-rw-r--r-- | sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java b/sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java index b70c4b0135..02918efb6c 100644 --- a/sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java +++ b/sandbox/travelsample/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package payment.creditcard; @@ -29,7 +29,7 @@ import org.osoa.sca.annotations.Service; @RolesAllowed("Admin") public class CreditCardPaymentImpl implements CreditCardPayment { - public String authorize(CreditCardDetailsType creditCard, float amount) { + public String authorize(CreditCardDetailsType creditCard, float amount) throws AuthorizeFault_Exception { if (creditCard != null) { System.out.println("Checking card: name = " + creditCard.getCardOwner().getName() + " number = " @@ -38,6 +38,11 @@ public class CreditCardPaymentImpl implements CreditCardPayment { + amount); } else { System.out.println("Checking card is null"); + ObjectFactory factory = new ObjectFactory(); + AuthorizeFault fault = factory.createAuthorizeFault(); + fault.setErrorCode("001 - Invalid card"); + AuthorizeFault_Exception ex = new AuthorizeFault_Exception("Invalid card", fault); + throw ex; } return "OK"; |