feat(dashboard,types,js-sdk,payment): ability to refund payment in order page (#8385)

* feat(dashboard,types,js-sdk,payment): ability to refund payment in order page

* chore: use confirmation variant for capture payment

* chore: change refund design accords to figma

* chore: move to js-sdk + currency input
This commit is contained in:
Riqwan Thamir
2024-08-01 19:13:41 +02:00
committed by GitHub
parent 6efdba1967
commit 7ae1d80380
14 changed files with 308 additions and 15 deletions
+42 -1
View File
@@ -8,13 +8,37 @@ export class Payment {
this.client = client
}
async list(query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminPaymentsResponse>(
`/admin/payments`,
{
query,
headers,
}
)
}
async retrieve(
id: string,
query?: HttpTypes.AdminPaymentFilters,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminPaymentResponse>(
`/admin/payments/${id}`,
{
query,
headers,
}
)
}
async capture(
id: string,
body: HttpTypes.AdminCapturePayment,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<{ payment: HttpTypes.AdminPayment }>(
return await this.client.fetch<HttpTypes.AdminPaymentResponse>(
`/admin/payments/${id}/capture`,
{
method: "POST",
@@ -24,4 +48,21 @@ export class Payment {
}
)
}
async refund(
id: string,
body: HttpTypes.AdminRefundPayment,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminPaymentResponse>(
`/admin/payments/${id}/refund`,
{
method: "POST",
headers,
body,
query,
}
)
}
}