feat(medusa,medusa-react): PaymentCollection support (#2659)
* chore: medusa react, order edit complete fix and single payment session
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AdminUpdatePaymentCollectionRequest,
|
||||
AdminUpdatePaymentCollectionsReq,
|
||||
AdminPaymentCollectionDeleteRes,
|
||||
AdminPaymentCollectionRes,
|
||||
AdminPaymentCollectionsRes,
|
||||
GetPaymentCollectionsParams,
|
||||
} from "@medusajs/medusa"
|
||||
import { ResponsePromise } from "../../typings"
|
||||
@@ -13,7 +13,7 @@ class AdminPaymentCollectionsResource extends BaseResource {
|
||||
id: string,
|
||||
query?: GetPaymentCollectionsParams,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<AdminPaymentCollectionRes> {
|
||||
): ResponsePromise<AdminPaymentCollectionsRes> {
|
||||
let path = `/admin/payment-collections/${id}`
|
||||
|
||||
if (query) {
|
||||
@@ -26,9 +26,9 @@ class AdminPaymentCollectionsResource extends BaseResource {
|
||||
|
||||
update(
|
||||
id: string,
|
||||
payload: AdminUpdatePaymentCollectionRequest,
|
||||
payload: AdminUpdatePaymentCollectionsReq,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<AdminPaymentCollectionRes> {
|
||||
): ResponsePromise<AdminPaymentCollectionsRes> {
|
||||
const path = `/admin/payment-collections/${id}`
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class AdminPaymentCollectionsResource extends BaseResource {
|
||||
markAsAuthorized(
|
||||
id: string,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<AdminPaymentCollectionRes> {
|
||||
): ResponsePromise<AdminPaymentCollectionsRes> {
|
||||
const path = `/admin/payment-collections/${id}/authorize`
|
||||
return this.client.request("POST", path, undefined, {}, customHeaders)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import {
|
||||
GetPaymentCollectionsParams,
|
||||
StoreManagePaymentCollectionSessionRequest,
|
||||
StoreRefreshPaymentCollectionSessionRequest,
|
||||
StorePaymentCollectionSessionRes,
|
||||
StorePaymentCollectionRes,
|
||||
StorePostPaymentCollectionsBatchSessionsReq,
|
||||
StorePostPaymentCollectionsBatchSessionsAuthorizeReq,
|
||||
StorePaymentCollectionSessionsReq,
|
||||
StorePaymentCollectionsSessionRes,
|
||||
StorePaymentCollectionsRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { ResponsePromise } from "../typings"
|
||||
import BaseResource from "./base"
|
||||
@@ -14,7 +15,7 @@ class PaymentCollectionsResource extends BaseResource {
|
||||
id: string,
|
||||
query?: GetPaymentCollectionsParams,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionRes> {
|
||||
): ResponsePromise<StorePaymentCollectionsRes> {
|
||||
let path = `/store/payment-collections/${id}`
|
||||
|
||||
if (query) {
|
||||
@@ -25,19 +26,38 @@ class PaymentCollectionsResource extends BaseResource {
|
||||
return this.client.request("GET", path, undefined, {}, customHeaders)
|
||||
}
|
||||
|
||||
authorize(
|
||||
authorizePaymentSession(
|
||||
id: string,
|
||||
session_id: string,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionRes> {
|
||||
const path = `/store/payment-collections/${id}/authorize`
|
||||
): ResponsePromise<StorePaymentCollectionsRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions/${session_id}/authorize`
|
||||
return this.client.request("POST", path, undefined, {}, customHeaders)
|
||||
}
|
||||
|
||||
manageSessions(
|
||||
authorizePaymentSessionsBatch(
|
||||
id: string,
|
||||
payload: StoreManagePaymentCollectionSessionRequest,
|
||||
payload: StorePostPaymentCollectionsBatchSessionsAuthorizeReq,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionRes> {
|
||||
): ResponsePromise<StorePaymentCollectionsRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions/batch/authorize`
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
}
|
||||
|
||||
managePaymentSessionsBatch(
|
||||
id: string,
|
||||
payload: StorePostPaymentCollectionsBatchSessionsReq,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionsRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions/batch`
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
}
|
||||
|
||||
managePaymentSession(
|
||||
id: string,
|
||||
payload: StorePaymentCollectionSessionsReq,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionsRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions`
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
}
|
||||
@@ -45,11 +65,10 @@ class PaymentCollectionsResource extends BaseResource {
|
||||
refreshPaymentSession(
|
||||
id: string,
|
||||
session_id: string,
|
||||
payload: StoreRefreshPaymentCollectionSessionRequest,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StorePaymentCollectionSessionRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions/${session_id}/refresh`
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
): ResponsePromise<StorePaymentCollectionsSessionRes> {
|
||||
const path = `/store/payment-collections/${id}/sessions/${session_id}`
|
||||
return this.client.request("POST", path, undefined, {}, customHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user