diff --git a/pass/app/Order.js b/pass/app/Order.js index 052720e6e707f7f8ce569d2f63e93bc1bc4ec468..d859d7865083827cead7bed384b4e181e748a379 100644 --- a/pass/app/Order.js +++ b/pass/app/Order.js @@ -105,7 +105,9 @@ class Order { order_data.encrypted_sales_receipts ); if (order_data.payment_method_link) { - loaded_order.setPaymentMethodLink(order_data.payment_method_link); + loaded_order.setPaymentMethodLink( + JSON.parse(order_data.payment_method_link) + ); } loaded_order.set_create_mode(false); resolve(loaded_order); @@ -136,7 +138,7 @@ class Order { price_per_unit: this.#price_per_unit, encrypted_sales_receipts: this.#encrypted_sales_receipts, payment_completed: this.#payment_completed, - payment_method_link: this.#payment_method_link, + payment_method_link: JSON.stringify(this.#payment_method_link), }) .then((result) => { this.#create_mode = false; diff --git a/pass/routes/checkout/paypal.js b/pass/routes/checkout/paypal.js index 41e5fa61fb9823d10862fb6f7cc7c79003daa765..1cde1f444f24be975081c6115c3cbbcc4faff0a6 100644 --- a/pass/routes/checkout/paypal.js +++ b/pass/routes/checkout/paypal.js @@ -39,8 +39,9 @@ router.post("/", async (req, res, next) => { router.post("/capture", async (req, res) => { Order.LOAD_ORDER_FROM_ID(req.body.order_id).then((loaded_order) => { let paypal_order_id = loaded_order.getPaymentMethodLink().id; - console.log(paypal_order_id); - //const captureData = await capturePayment(orderID); + capturePayment(paypal_order_id).then((captureData) => + res.json(captureData) + ); //res.json(captureData); // TODO: store payment information such as the transaction ID });