diff --git a/pass/app/payment_processor/Paypal.js b/pass/app/payment_processor/Paypal.js index 106839ee8188ee0c006496487601b3a37f85cb64..aa9c852aef5d9fcf5105ab198b87f9aac8feb477 100644 --- a/pass/app/payment_processor/Paypal.js +++ b/pass/app/payment_processor/Paypal.js @@ -298,7 +298,10 @@ class Paypal extends PaymentProcessor { Authorization: `Bearer ${access_token}`, }, body: JSON.stringify({ - amount: amount_to_refund, + amount: { + value: amount_to_refund, + currency_code: "EUR", + }, }), }) ); @@ -312,6 +315,22 @@ class Paypal extends PaymentProcessor { Authorization: `Bearer ${access_token}`, }, }) + .then((response) => { + if (response.code !== 201) { + console.debug(response); + throw "Error issuing refund."; + } else { + return response.json(); + } + }) + .then((response_json) => { + if (response_json.status !== "COMPLETED") { + console.debug(response_json); + throw "Error issuing refund."; + } else { + return true; + } + }) ); } }