Package xpetstore.domain.customer.model

Examples of xpetstore.domain.customer.model.CustomerValue


    {
        try
        {
            String        userId = "CST-" + ( System.currentTimeMillis(  ) % 100000 );
            AccountValue  act0 = new AccountValue( userId, "password" );
            CustomerValue cst0 = new CustomerValue( null, "firstname", "lastname", userId + "@foo.com", "123-456", "en", "street1.1", "street1.2", "city", "CA", "A1A-1A1", "US", "111-111-111", "Visa", "01-11" );
            cst0.setAccountValue( act0 );

            //System.out.println( "creating customer=" + cst0 );
            String        id = _petstore.createCustomer( cst0 );
            CustomerValue cst = _petstore.getCustomer( id );
            AccountValue  act = cst.getAccountValue(  );

            assertEquals( "firstname", "firstname", cst.getFirstname(  ) );
            assertEquals( "lastname", "lastname", cst.getLastname(  ) );
            assertEquals( "telephone", "123-456", cst.getTelephone(  ) );
            assertEquals( "email", userId + "@foo.com", cst.getEmail(  ) );
            assertEquals( "language", "en", cst.getLanguage(  ) );
            assertEquals( "street1", "street1.1", cst.getStreet1(  ) );
            assertEquals( "street2", "street1.2", cst.getStreet2(  ) );
            assertEquals( "city", "city", cst.getCity(  ) );
            assertEquals( "zipcode", "A1A-1A1", cst.getZipcode(  ) );
            assertEquals( "state", "CA", cst.getState(  ) );
            assertEquals( "country", "US", cst.getCountry(  ) );
            assertEquals( "creditCardType", "Visa", cst.getCreditCardType(  ) );
            assertEquals( "creditCardNumber", "111-111-111", cst.getCreditCardNumber(  ) );
            assertEquals( "creditCardExpiryDate", "01-11", cst.getCreditCardExpiryDate(  ) );
            assertEquals( "account.userId", userId, act.getUserId(  ) );
            assertEquals( "account.password", "password", act.getPassword(  ) );
        }
        catch ( FinderException f )
        {
View Full Code Here


    {
        try
        {
            String        userId = "CST-" + ( System.currentTimeMillis(  ) % 1000000 );
            AccountValue  act0 = new AccountValue( userId, "password" );
            CustomerValue cst0 = new CustomerValue( null, "firstnam", "lastnam", userId + "@foo.com", "222-22", "f", "street2.", "street2.", "city", "O", "A1A-1A1", "C", "111-111-111", "Visa", "01-21" );
            cst0.setAccountValue( act0 );

            //System.out.println( "creating customer=" + cst0 );
            String        id = _petstore.createCustomer( cst0 );

            AccountValue  act1 = new AccountValue( userId, "password1" );
            CustomerValue cst1 = new CustomerValue( id, "firstname2", "lastname2", userId + "-2@foo.com", "222-222", "fr", "street2.1", "street2.2", "city2", "ON", "A2A-2A2", "CA", "222-222-222", "Amex", "02-22" );
            cst1.setAccountValue( act1 );

            //System.out.println( "updating customer=" + cst1 );
            _petstore.updateCustomer( cst1 );

            CustomerValue cst = _petstore.getCustomer( id );
            AccountValue  act = cst.getAccountValue(  );

            //System.out.println( "customer=" + cst );
            assertEquals( "firstname", "firstname2", cst.getFirstname(  ) );
            assertEquals( "lastname", "lastname2", cst.getLastname(  ) );
            assertEquals( "telephone", "222-222", cst.getTelephone(  ) );
            assertEquals( "email", userId + "-2@foo.com", cst.getEmail(  ) );
            assertEquals( "language", "fr", cst.getLanguage(  ) );
            assertEquals( "street1", "street2.1", cst.getStreet1(  ) );
            assertEquals( "street2", "street2.2", cst.getStreet2(  ) );
            assertEquals( "city", "city2", cst.getCity(  ) );
            assertEquals( "zipcode", "A2A-2A2", cst.getZipcode(  ) );
            assertEquals( "state", "ON", cst.getState(  ) );
            assertEquals( "country", "CA", cst.getCountry(  ) );
            assertEquals( "creditCardType", "Amex", cst.getCreditCardType(  ) );
            assertEquals( "creditCardNumber", "222-222-222", cst.getCreditCardNumber(  ) );
            assertEquals( "creditCardExpiryDate", "02-22", cst.getCreditCardExpiryDate(  ) );
            assertEquals( "account.userId", userId, act.getUserId(  ) );
            assertEquals( "account.password", "password1", act.getPassword(  ) );
        }
        catch ( FinderException f )
        {
View Full Code Here

            map.put( "EST-10", new Integer( 1 ) );

            // Customer
            String        userId = "CST-" + ( System.currentTimeMillis(  ) % 1000000 );
            AccountValue  act0 = new AccountValue( userId, "password" );
            CustomerValue cst0 = new CustomerValue( null, "firstname", "lastname", userId + "@localdomain", "123-456", "en", "street1.1", "street1.2", "city", "CA", "A1A-1A1", "US", "111-111-111", "Visa", "01-01-11" );
            cst0.setAccountValue( act0 );
            _petstore.createCustomer( cst0 );

            // Order
            Date now = new Date(  );
            _petstore.createOrder( userId, now, map );
View Full Code Here

                                       HttpServletRequest  request,
                                       HttpServletResponse response )
        throws Exception
    {
        CustomerForm  frm = ( CustomerForm ) form;
        CustomerValue cust = frm.getCustomerValue(  );

        try
        {
            getPetstore(  ).createCustomer( cust );
            return mapping.findForward( SUCCESS );
View Full Code Here

                                       HttpServletRequest  request,
                                       HttpServletResponse response )
        throws Exception
    {
        CustomerForm  frm = ( CustomerForm ) form;
        CustomerValue cust = frm.getCustomerValue(  );

        try
        {
            getPetstore(  ).updateCustomer( cust );
View Full Code Here

        throws Exception
    {
        CustomerForm  frm = ( CustomerForm ) form;
        String        userId = ( String ) request.getSession(  ).getAttribute( USERID_KEY );

        CustomerValue cst = getPetstore(  ).getCustomer( userId );
        frm.setCustomerValue( cst );

        return mapping.findForward( SUCCESS );
    }
View Full Code Here

        String    userId = ( String ) request.getSession(  ).getAttribute( USERID_KEY );
        CartForm  frm = ( CartForm ) form;
        CartLocal cart = getCart( request );

        /* Order */
        CustomerValue cust = getPetstore(  ).getCustomer( userId );
        frm.setCustomerValue( cust );

        /* Cart items */
        Collection items = cart.getCartItems(  );
        frm.setCartItems( items );
View Full Code Here

        String        redirectUri = frm.getRedirectUri(  );
        PetstoreLocal petstore = getPetstore(  );

        if ( petstore.authenticate( account.getUserId(  ), account.getPassword(  ) ) )
        {
            CustomerValue cust = petstore.getCustomer( account.getUserId(  ) );
            initSession( cust, request );

            if ( ( redirectUri == null ) || ( redirectUri.length(  ) == 0 ) )
            {
                return mapping.findForward( SUCCESS );
View Full Code Here

TOP

Related Classes of xpetstore.domain.customer.model.CustomerValue

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.