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:
@@ -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,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user