Package com.tuscanyscatours.customer

Examples of com.tuscanyscatours.customer.Customer


    public void destroy() {
        // Save the customers
    }

    public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
        Customer customer = new Customer();
        customer.setId("c-" + idGenerator++);
        customer.setName(name);
        customer.setEmail(email);
        customer.setCreditCard(creditCard);
        customers.put(customer.getId(), customer);
        return customer;
    }
View Full Code Here


    public Collection<Customer> getAllCustomers() {
        return customers.values();
    }

    public Customer getCustomer(String id) throws CustomerNotFoundException {
        Customer customer = customers.get(id);

        if (customer == null) {
            throw new CustomerNotFoundException("Customer " + id + " not found");
        }
View Full Code Here

        return customer;
    }

    public boolean updateCustomer(Customer customer) {
        Customer current = null;
        try {
            current = getCustomer(customer.getId());
        } catch (Exception ex) {
            return false;
        }

        current.setEmail(customer.getEmail());
        current.setName(customer.getName());
        current.setCreditCard(customer.getCreditCard());
        return true;
    }
View Full Code Here

    public void destroy() {
        // Save the customers
    }

    public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
        Customer customer = new Customer();
        customer.setId("c-" + idGenerator++);
        customer.setName(name);
        customer.setEmail(email);
        customer.setCreditCard(creditCard);
        customers.put(customer.getId(), customer);
        return customer;
    }
View Full Code Here

    public Collection<Customer> getAllCustomers() {
        return customers.values();
    }

    public Customer getCustomer(String id) throws CustomerNotFoundException {
        Customer customer = customers.get(id);

        if (customer == null) {
            throw new CustomerNotFoundException("Customer " + id + " not found");
        }
View Full Code Here

        return customer;
    }

    public boolean updateCustomer(Customer customer) {
        Customer current = null;
        try {
            current = getCustomer(customer.getId());
        } catch (Exception ex) {
            return false;
        }

        current.setEmail(customer.getEmail());
        current.setName(customer.getName());
        current.setCreditCard(customer.getCreditCard());
        return true;
    }
View Full Code Here

    @Property
    protected float transactionFee = 0.01f;

    public String makePaymentMember(String customerId, float amount) {
        try {
            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();
View Full Code Here

        this.transactionFee = transactionFee;
    }

    public String makePaymentMember(String customerId, float amount) {
        try {
            Customer customer = customerRegistry.getCustomer(customerId);

            amount += transactionFee;

            String status = creditCardPayment.authorize(customer.getCreditCard(), amount);

            com.tuscanyscatours.emailgateway.ObjectFactory emailFactory =
                new com.tuscanyscatours.emailgateway.ObjectFactory();
            EmailType email = emailFactory.createEmailType();
            email.setTitle("Payment Received");
View Full Code Here

    @Property
    protected float transactionFee = 0.01f;

    public String makePaymentMember(String customerId, float amount) {
        try {
            Customer customer = customerRegistry.getCustomer(customerId);
            String status = creditCardPayment.authorize(customer.getCreditCard(),
                                                    amount + transactionFee,
                                                    emailGateway,
                                                    customer.getEmail());
            return status;
        } catch (CustomerNotFoundException ex) {
            return "Payment failed due to " + ex.getMessage();
        } catch (AuthorizeFault_Exception e) {
            return e.getFaultInfo().getErrorCode();
View Full Code Here

    public void destroy() {
        // Save the customers
    }

    public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
        Customer customer = new Customer();
        customer.setId("c-" + idGenerator++);
        customer.setName(name);
        customer.setEmail(email);
        customer.setCreditCard(creditCard);
        customers.put(customer.getId(), customer);
        return customer;
    }
View Full Code Here

TOP

Related Classes of com.tuscanyscatours.customer.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.