+
+
+
+
+
\ No newline at end of file
diff --git a/vue/src/views/ProductsView.vue b/vue/src/views/ProductsView.vue
index c82a0530..57d634d8 100644
--- a/vue/src/views/ProductsView.vue
+++ b/vue/src/views/ProductsView.vue
@@ -39,29 +39,7 @@ export default {
});
},
checkout: function () {
- this.disabledStatus = true;
- let internalTagSE = this.SE;
- let success = null;
-
- Sentry.startSpan({ name: "Checkout", forceTransaction: true}, async () => {
- var raw =
- '{"cart":{"items":[{"id":4,"title":"Botana Voice","description":"Lets plants speak for themselves.","descriptionfull":"Now we don\'t want him to get lonely, so we\'ll give him a little friend. Let your imagination just wonder around when you\'re doing these things. Let your imagination be your guide. Nature is so fantastic, enjoy it. Let it make you happy.","price":175,"img":"https://storage.googleapis.com/application-monitoring/plant-to-text.jpg","imgcropped":"https://storage.googleapis.com/application-monitoring/plant-to-text-cropped.jpg","pg_sleep":"","reviews":[{"id":4,"productid":4,"rating":4,"customerid":null,"description":null,"created":"2021-06-04 00:12:33.553939","pg_sleep":""},{"id":5,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-06-04 00:12:45.558259","pg_sleep":""},{"id":6,"productid":4,"rating":2,"customerid":null,"description":null,"created":"2021-06-04 00:12:50.510322","pg_sleep":""},{"id":13,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:43.312186","pg_sleep":""},{"id":14,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:54.719873","pg_sleep":""},{"id":15,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:57.760686","pg_sleep":""},{"id":16,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:00.140407","pg_sleep":""},{"id":17,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:00.971730","pg_sleep":""},{"id":18,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:01.665798","pg_sleep":""},{"id":19,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:02.278934","pg_sleep":""}]}],"quantities":{"4":2},"total":350},"form":{"loading":false}}';
- var requestOptions = {
- method: "POST",
- headers: {
- "Content-Type": "text/plain",
- },
- body: raw,
- redirect: "follow",
- };
-
- success = await this.makeCheckoutRequest(requestOptions);
- return success;
- })
-
- if (!success) {
- this.$router.push("/error");
- }
+ this.$router.push("/checkout");
},
addToCartPrice: function () {
@@ -117,7 +95,7 @@ export default {
:onClick="checkout"
:disabled="disabledStatus"
>
- Checkout your cart ($ {{ checkoutCartPrice }})
+ Checkout ($ {{ checkoutCartPrice }})
From f1bb45dce89670d18392d17604f16c4f684c69e4 Mon Sep 17 00:00:00 2001
From: sergiosentry <109162568+serglom21@users.noreply.github.com>
Date: Tue, 12 Nov 2024 11:03:14 -0500
Subject: [PATCH 2/5] get body from cart object
---
vue/src/views/CheckoutView.vue | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/vue/src/views/CheckoutView.vue b/vue/src/views/CheckoutView.vue
index 89b2dd7b..d2949a11 100644
--- a/vue/src/views/CheckoutView.vue
+++ b/vue/src/views/CheckoutView.vue
@@ -121,14 +121,13 @@ import { useCounterStore } from "../stores/cart";
let success = null;
Sentry.startSpan({ name: "Checkout" }, async () => {
- var raw =
- '{"cart":{"items":[{"id":4,"title":"Botana Voice","description":"Lets plants speak for themselves.","descriptionfull":"Now we don\'t want him to get lonely, so we\'ll give him a little friend. Let your imagination just wonder around when you\'re doing these things. Let your imagination be your guide. Nature is so fantastic, enjoy it. Let it make you happy.","price":175,"img":"https://storage.googleapis.com/application-monitoring/plant-to-text.jpg","imgcropped":"https://storage.googleapis.com/application-monitoring/plant-to-text-cropped.jpg","pg_sleep":"","reviews":[{"id":4,"productid":4,"rating":4,"customerid":null,"description":null,"created":"2021-06-04 00:12:33.553939","pg_sleep":""},{"id":5,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-06-04 00:12:45.558259","pg_sleep":""},{"id":6,"productid":4,"rating":2,"customerid":null,"description":null,"created":"2021-06-04 00:12:50.510322","pg_sleep":""},{"id":13,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:43.312186","pg_sleep":""},{"id":14,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:54.719873","pg_sleep":""},{"id":15,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:12:57.760686","pg_sleep":""},{"id":16,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:00.140407","pg_sleep":""},{"id":17,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:00.971730","pg_sleep":""},{"id":18,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:01.665798","pg_sleep":""},{"id":19,"productid":4,"rating":3,"customerid":null,"description":null,"created":"2021-07-01 00:13:02.278934","pg_sleep":""}]}],"quantities":{"4":2},"total":350},"form":{"loading":false}}';
+ let cartJson = JSON.stringify({ cart: this.cartItems})
var requestOptions = {
method: "POST",
headers: {
"Content-Type": "text/plain",
},
- body: raw,
+ body: cartJson,
redirect: "follow",
};
From bbffbdcfc27ab22f2c014ff2566bd47a03a51a1a Mon Sep 17 00:00:00 2001
From: sergiosentry <109162568+serglom21@users.noreply.github.com>
Date: Tue, 12 Nov 2024 11:20:19 -0500
Subject: [PATCH 3/5] adding form object to payload
---
vue/src/views/CheckoutView.vue | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/vue/src/views/CheckoutView.vue b/vue/src/views/CheckoutView.vue
index d2949a11..bc0b985e 100644
--- a/vue/src/views/CheckoutView.vue
+++ b/vue/src/views/CheckoutView.vue
@@ -121,7 +121,17 @@ import { useCounterStore } from "../stores/cart";
let success = null;
Sentry.startSpan({ name: "Checkout" }, async () => {
- let cartJson = JSON.stringify({ cart: this.cartItems})
+ let cartJson = JSON.stringify({ cart: this.cartItems, form: {
+ email,
+ subscribe,
+ firstName,
+ lastName,
+ address,
+ city,
+ country,
+ state,
+ zipCode
+ }})
var requestOptions = {
method: "POST",
headers: {
From 2127192b0bbfa2926ba16ed3ae124c5318a500e2 Mon Sep 17 00:00:00 2001
From: sergiosentry <109162568+serglom21@users.noreply.github.com>
Date: Tue, 12 Nov 2024 13:10:06 -0500
Subject: [PATCH 4/5] fix form parameters
---
vue/src/views/CheckoutView.vue | 1 -
1 file changed, 1 deletion(-)
diff --git a/vue/src/views/CheckoutView.vue b/vue/src/views/CheckoutView.vue
index bc0b985e..16b10396 100644
--- a/vue/src/views/CheckoutView.vue
+++ b/vue/src/views/CheckoutView.vue
@@ -123,7 +123,6 @@ import { useCounterStore } from "../stores/cart";
Sentry.startSpan({ name: "Checkout" }, async () => {
let cartJson = JSON.stringify({ cart: this.cartItems, form: {
email,
- subscribe,
firstName,
lastName,
address,
From 0df3e28b9e0f2ed6b872a5233b892ca8090b9652 Mon Sep 17 00:00:00 2001
From: sergiosentry <109162568+serglom21@users.noreply.github.com>
Date: Tue, 12 Nov 2024 17:00:44 -0500
Subject: [PATCH 5/5] creating new trace for checkout page
---
vue/src/stores/cart.js | 14 +++++++
vue/src/views/CheckoutView.vue | 77 +++++++++++++++++++++-------------
2 files changed, 61 insertions(+), 30 deletions(-)
diff --git a/vue/src/stores/cart.js b/vue/src/stores/cart.js
index ef389385..2921436b 100644
--- a/vue/src/stores/cart.js
+++ b/vue/src/stores/cart.js
@@ -10,6 +10,20 @@ export const useCounterStore = defineStore({
updatePrice(val = 1) {
this.counter += val;
},
+ getQuantities(){
+ let quantities = {}
+ for (let item in this.cart) {
+ quantities[this.cart[item].id] = this.cart[item].count
+ }
+ return quantities;
+ },
+ getTotalPrice(){
+ let total = 0;
+ for (let item in this.cart) {
+ total += this.cart[item].totalPrice
+ }
+ return total;
+ },
updateCart(product) {
let index = this.cart.findIndex( item => item.id === product.id);
if (index === -1) {
diff --git a/vue/src/views/CheckoutView.vue b/vue/src/views/CheckoutView.vue
index 16b10396..d5a702b1 100644
--- a/vue/src/views/CheckoutView.vue
+++ b/vue/src/views/CheckoutView.vue
@@ -87,7 +87,22 @@ import { useCounterStore } from "../stores/cart";
return this.store.getCartItems();
},
cartTotal() {
- return this.store.cartTotal; // example if you have a cart total in the store
+ return this.store.getTotalPrice(); // example if you have a cart total in the store
+ },
+ cartQuantities(){
+ return this.store.getQuantities()
+ },
+ contactForm(){
+ return {
+ email,
+ firstName,
+ lastName,
+ address,
+ city,
+ country,
+ state,
+ zipCode
+ }
}
},
methods: {
@@ -120,35 +135,37 @@ import { useCounterStore } from "../stores/cart";
handleSubmit() {
let success = null;
- Sentry.startSpan({ name: "Checkout" }, async () => {
- let cartJson = JSON.stringify({ cart: this.cartItems, form: {
- email,
- firstName,
- lastName,
- address,
- city,
- country,
- state,
- zipCode
- }})
- var requestOptions = {
- method: "POST",
- headers: {
- "Content-Type": "text/plain",
- },
- body: cartJson,
- redirect: "follow",
- };
-
- try {
- success = await this.makeCheckoutRequest(requestOptions);
- } catch (error) {
- Sentry.captureException(error);
- this.$router.push("/error");
-
- }
-
- return success;
+ Sentry.startNewTrace(() => {
+ Sentry.startSpan({ name: "Checkout" }, async (span) => {
+ const payload = {
+ cart: {
+ items: this.cartItems,
+ quantities: this.cartQuantities,
+ total: this.cartTotal,
+ },
+ form: this.contactForm,
+ }
+ var requestOptions = {
+ method: "POST",
+ headers: {
+ "Content-Type": "text/plain",
+ },
+ body: JSON.stringify(payload),
+ redirect: "follow",
+ };
+
+ try {
+ success = await this.makeCheckoutRequest(requestOptions);
+ } catch (error) {
+ Sentry.withActiveSpan(span, async () => {
+ Sentry.captureException(error);
+ })
+ this.$router.push("/error");
+
+ }
+
+ return success;
+ })
})
if (!success) {