feat: Refund payment (#6610)

Essentially the same as #6601 but for refunds
This commit is contained in:
Oli Juhl
2024-03-07 12:34:36 +00:00
committed by GitHub
parent 7dee1a3fd3
commit e5cbe28d54
10 changed files with 246 additions and 37 deletions
@@ -642,23 +642,23 @@ moduleIntegrationTestRunner({
)
})
// it("should throw if refund is greater than captured amount", async () => {
// await service.capturePayment({
// amount: 50,
// payment_id: "pay-id-1",
// })
//
// const error = await service
// .refundPayment({
// amount: 100,
// payment_id: "pay-id-1",
// })
// .catch((e) => e)
//
// expect(error.message).toEqual(
// "Refund amount for payment: pay-id-1 cannot be greater than the amount captured on the payment."
// )
// })
it("should throw if refund is greater than captured amount", async () => {
await service.capturePayment({
amount: 50,
payment_id: "pay-id-1",
})
const error = await service
.refundPayment({
amount: 100,
payment_id: "pay-id-1",
})
.catch((e) => e)
expect(error.message).toEqual(
"You cannot refund more than what is captured on the payment."
)
})
})
describe("cancel", () => {