Commit a1e85c44 authored by alish's avatar alish
Browse files

feat: init shopping cart flow

parent 0e2a2535
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -74,3 +74,5 @@ MERCHANT_IDS=[]
PORT=4201
WEB_MEMORY=4096
WEB_CONCURRENCY=1

SHOPPING_CART=false
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -104,7 +104,9 @@ export const environment: Environment = {
		env.MERCHANT_IDS && env.MERCHANT_IDS.length > 0
			? env.MERCHANT_IDS
			: JSON.stringify([])
  }
  },

  SHOPPING_CART: ${env.SHOPPING_CART}
};

/*
+2 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ export type Env = Readonly<{
	WEB_CONCURRENCY: number;
	WEB_MEMORY: number;
	PORT: number;
	SHOPPING_CART: boolean;
}>;

const merchantIDs: any = makeValidator((x) => x, 'merchantIDs');
@@ -175,6 +176,7 @@ export const env: any = cleanEnv(
		WEB_CONCURRENCY: num({ default: 1 }),
		WEB_MEMORY: num({ default: 2048 }),
		PORT: num({ default: 4201 }),
		SHOPPING_CART: bool({ default: false }),
	},
	{ strict: true, dotEnvPath: __dirname + '/../.env' }
);
+5 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ export class OrderSignComponent implements OnChanges {

	async getPrice() {
		const orderId = this.store.orderId;
		const shoppingCartDataString = this.store.shoppingCartData;

		if (orderId) {
			const { totalPrice } = await this.ordersService
@@ -30,6 +31,10 @@ export class OrderSignComponent implements OnChanges {
				.pipe(first())
				.toPromise();

			this.totalPrice = totalPrice;
		} else if (shoppingCartDataString) {
			const { totalPrice } = JSON.parse(this.store.shoppingCartData);

			this.totalPrice = totalPrice;
		}
	}
+1 −4
Original line number Diff line number Diff line
@@ -61,10 +61,7 @@
					<e-cu-store-sign [inStore]="inStore"></e-cu-store-sign>
				</ion-label>

				<ion-label
					*ngIf="hasPendingOrder && hasPendingOrder"
					(click)="showOrderInfo()"
				>
				<ion-label *ngIf="hasPendingOrder" (click)="showOrderInfo()">
					<e-cu-order-sign
						[onChangeOrder]="changePendingOrder"
					></e-cu-order-sign>
Loading