diff --git a/functions/src/index.ts b/functions/src/index.ts
index 032aa81..0afc5cb 100644
--- a/functions/src/index.ts
+++ b/functions/src/index.ts
@@ -25,7 +25,6 @@ export const checkout = functions.https.onRequest((request, response) => {
transactions: [
{
item_list: {items: []},
- amount: {total: 0, currency: 'CAD'},
description: 'Purchase of equipment and suplies from FH & Sons'
}
]
@@ -46,7 +45,7 @@ export const checkout = functions.https.onRequest((request, response) => {
let products = await Promise.all(promises);
req.transactions[0].item_list.items = products.map((row, i) => {
const data = row.data();
- return {name: data.name, sku: data.name, price: data.price, currency: 'CAD', quantity: cart[i].quantity};
+ return {name: data.name, sku: data.name, price: data.price, currency: data.currency, quantity: cart[i].quantity};
});
req.transactions[0].amount.total = req.transactions[0].item_list.items.reduce((acc, row, i) => {
return acc + row.price * row.quantity;
diff --git a/src/app/store/newProduct/newProduct.component.html b/src/app/store/newProduct/newProduct.component.html
index 79996f4..64804f9 100644
--- a/src/app/store/newProduct/newProduct.component.html
+++ b/src/app/store/newProduct/newProduct.component.html
@@ -15,9 +15,14 @@
-
$
+
+ 0 will display "Contact For Price"
+
+ CAD
+ USD
+
diff --git a/src/app/store/newProduct/newProduct.component.ts b/src/app/store/newProduct/newProduct.component.ts
index 9e4dba0..7de74f2 100644
--- a/src/app/store/newProduct/newProduct.component.ts
+++ b/src/app/store/newProduct/newProduct.component.ts
@@ -11,8 +11,9 @@ export class NewProductComponent {
categories;
category;
- name: string;
+ currency = 'CAD';
description: string;
+ name: string;
price: number = 0.0;
image: string;
@@ -26,8 +27,9 @@ export class NewProductComponent {
if (data.product) {
this.category = data.product.category;
- this.name = data.product.name;
+ this.currency = data.product.currency;
this.description = data.product.description;
+ this.name = data.product.name;
this.price = data.product.price;
}
}
@@ -40,15 +42,14 @@ export class NewProductComponent {
submit() {
let newProduct = {
- name: this.name,
category: this.category,
+ currency: this.currency,
description: this.description,
+ name: this.name,
price: Number(this.price)
};
if (this.image) newProduct['image'] = this.image;
- console.log(newProduct.description);
-
if (!this.data.product) {
this.db
.collection('products')
diff --git a/src/app/store/products/products.component.html b/src/app/store/products/products.component.html
index 16963b5..329baae 100644
--- a/src/app/store/products/products.component.html
+++ b/src/app/store/products/products.component.html
@@ -12,7 +12,7 @@
{{product.name}}
- {{product.price | currency}}
+ {{product.currency}} {{product.price | currency}}
Contact For Price