Dear ,
+Thank you for shopping from our book store. We hope you had a good time with our service!
+Your order number is: #. Here is your order detail:
+| Billing Details | +Payment Information | +Shipping Address | +
|---|---|---|
|
+ + + + + + |
+
+ Card Name + Visa + Card Number + Exp Date: / + |
+
+ David Peere: + + + + + |
+
| Item Name | +Item Price | +Item Quantity + | +Total | +
| + | ++ | ++ + | ++ | +
| + | + | + Subtotal | ++ | +
| + | + | Tax + | ++ | +
| + | + | Total + | ++ | +
Best,
+Le's Bookstore
+ + \ No newline at end of file diff --git a/bookstore-api/target/classes/com/bookstore/resource/CheckoutResource.class b/bookstore-api/target/classes/com/bookstore/resource/CheckoutResource.class new file mode 100644 index 0000000..7423619 Binary files /dev/null and b/bookstore-api/target/classes/com/bookstore/resource/CheckoutResource.class differ diff --git a/bookstore-api/target/classes/templates/orderConfirmationEmailTemplate.html b/bookstore-api/target/classes/templates/orderConfirmationEmailTemplate.html new file mode 100644 index 0000000..89ecbd8 --- /dev/null +++ b/bookstore-api/target/classes/templates/orderConfirmationEmailTemplate.html @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + +Dear ,
+Thank you for shopping from our book store. We hope you had a good time with our service!
+Your order number is: #. Here is your order detail:
+| Billing Details | +Payment Information | +Shipping Address | +
|---|---|---|
|
+ + + + + + |
+
+ Card Name + Visa + Card Number + Exp Date: / + |
+
+ David Peere: + + + + + |
+
| Item Name | +Item Price | +Item Quantity + | +Total | +
| + | ++ | ++ + | ++ | +
| + | + | + Subtotal | ++ | +
| + | + | Tax + | ++ | +
| + | + | Total + | ++ | +
Best,
+Le's Bookstore
+ + \ No newline at end of file diff --git a/store-front/src/app/app.module.ts b/store-front/src/app/app.module.ts index 90463fa..cb624a1 100644 --- a/store-front/src/app/app.module.ts +++ b/store-front/src/app/app.module.ts @@ -20,6 +20,7 @@ import { PaymentService } from './services/payment.service'; import { ShippingService } from './services/shipping.service'; import { BookService } from './services/book.service'; import { CartService } from './services/cart.service'; +import { CheckoutService } from './services/checkout.service'; import { MyAccountComponent } from './components/my-account/my-account.component'; import { MyProfileComponent } from './components/my-profile/my-profile.component'; @@ -27,6 +28,7 @@ import { BookListComponent } from './components/book-list/book-list.component'; import { BookDetailComponent } from './components/book-detail/book-detail.component'; import { ShoppingCartComponent } from './components/shopping-cart/shopping-cart.component'; import { OrderComponent } from './components/order/order.component'; +import { OrderSummaryComponent } from './components/order-summary/order-summary.component'; @NgModule({ declarations: [ @@ -39,7 +41,8 @@ import { OrderComponent } from './components/order/order.component'; BookListComponent, BookDetailComponent, ShoppingCartComponent, - OrderComponent + OrderComponent, + OrderSummaryComponent ], imports: [ BrowserModule, @@ -55,7 +58,8 @@ import { OrderComponent } from './components/order/order.component'; PaymentService, ShippingService, BookService, - CartService + CartService, + CheckoutService ], bootstrap: [AppComponent] }) diff --git a/store-front/src/app/app.routing.ts b/store-front/src/app/app.routing.ts index 65eb5dc..c88bada 100644 --- a/store-front/src/app/app.routing.ts +++ b/store-front/src/app/app.routing.ts @@ -11,6 +11,8 @@ import {BookListComponent} from './components/book-list/book-list.component'; import {BookDetailComponent} from './components/book-detail/book-detail.component'; import {ShoppingCartComponent} from './components/shopping-cart/shopping-cart.component'; import {OrderComponent} from './components/order/order.component'; +import { OrderSummaryComponent } from './components/order-summary/order-summary.component'; + const appRoutes: Routes = [ { @@ -45,6 +47,10 @@ const appRoutes: Routes = [ { path: 'order', component: OrderComponent + }, + { + path: 'orderSummary', + component: OrderSummaryComponent } ]; diff --git a/store-front/src/app/components/order-summary/order-summary.component.css b/store-front/src/app/components/order-summary/order-summary.component.css new file mode 100644 index 0000000..e69de29 diff --git a/store-front/src/app/components/order-summary/order-summary.component.html b/store-front/src/app/components/order-summary/order-summary.component.html new file mode 100644 index 0000000..82ef69c --- /dev/null +++ b/store-front/src/app/components/order-summary/order-summary.component.html @@ -0,0 +1,45 @@ +
+ 10" style="color: green;">In Stock
+0" style="color: green;"> Only {{cartItem.book.inStockNumber}} In Stock +
+Product Unavailable
+
diff --git a/store-front/src/app/models/billing-address.ts b/store-front/src/app/models/billing-address.ts
index 6d21f01..27ad9f2 100644
--- a/store-front/src/app/models/billing-address.ts
+++ b/store-front/src/app/models/billing-address.ts
@@ -7,4 +7,5 @@ export class BillingAddress {
public billingAddressState:string;
public billingAddressCountry:string;
public billingAddressZipcode:string;
+ public order: Order;
}
diff --git a/store-front/src/app/models/payment.ts b/store-front/src/app/models/payment.ts
index d7832ac..63d3978 100644
--- a/store-front/src/app/models/payment.ts
+++ b/store-front/src/app/models/payment.ts
@@ -3,7 +3,6 @@ import {BillingAddress} from './billing-address';
export class Payment {
public id: number;
public type: string;
- public cardName: string;
public cardNumber: string;
public expiryMonth: string;
public expiryYear: string;
diff --git a/store-front/src/app/models/shipping-address.ts b/store-front/src/app/models/shipping-address.ts
index d10392a..6c3693c 100644
--- a/store-front/src/app/models/shipping-address.ts
+++ b/store-front/src/app/models/shipping-address.ts
@@ -1,3 +1,5 @@
+import {Order} from "./order";
+
export class ShippingAddress {
public id:number;
public shippingAddressName:string;
@@ -7,4 +9,5 @@ export class ShippingAddress {
public shippingAddressState:string;
public shippingAddressCountry:string;
public shippingAddressZipcode:string;
+ public order:Order;
}
diff --git a/store-front/src/app/services/checkout.service.spec.ts b/store-front/src/app/services/checkout.service.spec.ts
new file mode 100644
index 0000000..dc932b8
--- /dev/null
+++ b/store-front/src/app/services/checkout.service.spec.ts
@@ -0,0 +1,16 @@
+/* tslint:disable:no-unused-variable */
+
+import { TestBed, async, inject } from '@angular/core/testing';
+import { CheckoutService } from './checkout.service';
+
+describe('CheckoutService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [CheckoutService]
+ });
+ });
+
+ it('should ...', inject([CheckoutService], (service: CheckoutService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/store-front/src/app/services/checkout.service.ts b/store-front/src/app/services/checkout.service.ts
new file mode 100644
index 0000000..c5d241f
--- /dev/null
+++ b/store-front/src/app/services/checkout.service.ts
@@ -0,0 +1,32 @@
+import { Injectable } from '@angular/core';
+import {Headers, Http} from "@angular/http";
+import {AppConst} from '../constants/app-const';
+import {ShippingAddress} from '../models/shipping-address';
+import {BillingAddress} from '../models/billing-address';
+import {Payment} from '../models/payment';
+
+@Injectable()
+export class CheckoutService {
+
+ constructor(private http: Http) { }
+
+ checkout(
+ shippingAddress:ShippingAddress,
+ billingAddress:BillingAddress,
+ payment:Payment,
+ shippingMethod:string
+ ) {
+ let url = AppConst.serverPath+"/checkout/checkout";
+ let order = {
+ "shippingAddress" : shippingAddress,
+ "billingAddress" : billingAddress,
+ "payment" : payment,
+ "shippingMethod" : shippingMethod
+ }
+ let tokenHeader = new Headers ({
+ 'x-auth-token' : localStorage.getItem("xAuthToken")
+ });
+ return this.http.post(url, order, {headers : tokenHeader});
+ }
+
+}