feat: Sessions API update

This commit is contained in:
fPolic committed 2024-01-16 09:56:54 +01:00
1 parent 66ec3d0931
commit 1cc888df80
2 files changed
+45 -10

No files matched your search

+15 -1
View File
@@ -25,4 +25,18 @@ export interface UpdatePaymentDTO {
customer_id?: string customer_id?: string
} }
export interface CreatePaymentSessionDTO {} export interface CreatePaymentSessionDTO {
amount: number
currency_code: string
provider_id: string
cart_id?: string
resource_id?: string
customer_id?: string
}
export interface SetPaymentSessionsDTO {
provider_id: string
amount: number
session_id?: string
}
+30 -9
View File
@@ -4,6 +4,7 @@ import {
CreatePaymentCollectionDTO, CreatePaymentCollectionDTO,
CreatePaymentDTO, CreatePaymentDTO,
CreatePaymentSessionDTO, CreatePaymentSessionDTO,
SetPaymentSessionsDTO,
UpdatePaymentCollectionDTO, UpdatePaymentCollectionDTO,
UpdatePaymentDTO, UpdatePaymentDTO,
} from "./mutations" } from "./mutations"
@@ -15,6 +16,8 @@ import {
import { FindConfig } from "../common" import { FindConfig } from "../common"
export interface IPaymentModuleService extends IModuleService { export interface IPaymentModuleService extends IModuleService {
/* ********** PAYMENT COLLECTION ********** */
createPaymentCollection( createPaymentCollection(
data: CreatePaymentCollectionDTO[], data: CreatePaymentCollectionDTO[],
sharedContext?: Context sharedContext?: Context
@@ -70,31 +73,49 @@ export interface IPaymentModuleService extends IModuleService {
sharedContext?: Context sharedContext?: Context
): Promise<PaymentCollectionDTO> ): Promise<PaymentCollectionDTO>
/* ********** PAYMENTS ********** */ /* ********** PAYMENT ********** */
createPayment(data: CreatePaymentDTO): Promise<PaymentDTO> createPayment(data: CreatePaymentDTO): Promise<PaymentDTO>
capturePayment(paymentId: string, amount: number): Promise<PaymentDTO> capturePayment(
refundPayment(paymentId: string, amount: number): Promise<PaymentDTO> paymentId: string,
amount: number,
sharedContext?: Context
): Promise<PaymentDTO>
refundPayment(
paymentId: string,
amount: number,
sharedContext?: Context
): Promise<PaymentDTO>
updatePayment(data: UpdatePaymentDTO): Promise<PaymentDTO> updatePayment(
data: UpdatePaymentDTO,
sharedContext?: Context
): Promise<PaymentDTO>
/* ********** PAYMENT SESSIONS ********** */ /* ********** PAYMENT SESSION ********** */
createPaymentSession( createPaymentSession(
paymentCollectionId: string, paymentCollectionId: string,
data: CreatePaymentSessionDTO data: CreatePaymentSessionDTO,
sharedContext?: Context
): Promise<PaymentCollectionDTO> ): Promise<PaymentCollectionDTO>
authorizePaymentSessions( authorizePaymentSessions(
paymentCollectionId: string, paymentCollectionId: string,
sessionIds: string[] sessionIds: string[],
sharedContext?: Context
): Promise<PaymentCollectionDTO> ): Promise<PaymentCollectionDTO>
completePaymentSessions( completePaymentSessions(
paymentCollectionId: string, paymentCollectionId: string,
sessionIds: string[] sessionIds: string[],
sharedContext?: Context
): Promise<PaymentCollectionDTO> ): Promise<PaymentCollectionDTO>
// TODO: PaymentSession set session setPaymentSessions(
paymentCollectionId: string,
data: SetPaymentSessionsDTO[],
sharedContext?: Context
): Promise<PaymentCollectionDTO>
} }