feat(dashboard,js-sdk,types): add ability to capture payment from order page (#8368)
what: - adds ability to capture payment from order page bugs found: - when capturing payment of one order, other orders statuses get affected from "captured" to "partially captured". Will investigate this separately. https://github.com/user-attachments/assets/0a1beac2-74fc-4803-8528-8de5913964d4
This commit is contained in:
@@ -8,6 +8,7 @@ import { InventoryItem } from "./inventory-item"
|
||||
import { Invite } from "./invite"
|
||||
import { Notification } from "./notification"
|
||||
import { Order } from "./order"
|
||||
import { Payment } from "./payment"
|
||||
import { PriceList } from "./price-list"
|
||||
import { PricePreference } from "./price-preference"
|
||||
import { Product } from "./product"
|
||||
@@ -59,6 +60,7 @@ export class Admin {
|
||||
public productTag: ProductTag
|
||||
public user: User
|
||||
public currency: Currency
|
||||
public payment: Payment
|
||||
|
||||
constructor(client: Client) {
|
||||
this.invite = new Invite(client)
|
||||
@@ -90,5 +92,6 @@ export class Admin {
|
||||
this.productTag = new ProductTag(client)
|
||||
this.user = new User(client)
|
||||
this.currency = new Currency(client)
|
||||
this.payment = new Payment(client)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { HttpTypes, SelectParams } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class Payment {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async capture(
|
||||
id: string,
|
||||
body: HttpTypes.AdminCapturePayment,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<{ payment: HttpTypes.AdminPayment }>(
|
||||
`/admin/payments/${id}/capture`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user