Skip to content
Snippets Groups Projects
Commit e99d1a5d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

refunds are working now

parent ae991dfc
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
})
);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment