From 56752039cfb8df126c69434d90907e89d0a186c6 Mon Sep 17 00:00:00 2001 From: fPolic Date: Mon, 15 Jan 2024 15:18:02 +0100 Subject: [PATCH] wip: interface and types --- packages/types/src/payment/common.ts | 30 ++++++++++ packages/types/src/payment/index.ts | 3 + packages/types/src/payment/mutations.ts | 3 + packages/types/src/payment/service.ts | 73 ++++++++++++++++++++++++- 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 packages/types/src/payment/common.ts create mode 100644 packages/types/src/payment/mutations.ts diff --git a/packages/types/src/payment/common.ts b/packages/types/src/payment/common.ts new file mode 100644 index 0000000000..01788395ed --- /dev/null +++ b/packages/types/src/payment/common.ts @@ -0,0 +1,30 @@ +import { BaseFilterable } from "../dal" +import { OperatorMap } from "../dal/utils" + +/* ********** PAYMENT COLLECTION ********** */ + +export interface PaymentCollectionDTO { + /** + * The ID of the Payment Collection + */ + id: string +} + +export interface FilterablePaymentCollectionProps + extends BaseFilterable { + id?: string | string[] + + region_id?: string | string[] | OperatorMap + + created_at?: OperatorMap + updated_at?: OperatorMap +} + +/* ********** PAYMENT ********** */ + +export interface PaymentDTO { + /** + * The ID of the Payment Collection + */ + id: string +} diff --git a/packages/types/src/payment/index.ts b/packages/types/src/payment/index.ts index 9376fea807..a83c8a61ef 100644 --- a/packages/types/src/payment/index.ts +++ b/packages/types/src/payment/index.ts @@ -1 +1,4 @@ +export * from "./common" +export * from "./mutations" export * from "./service" + diff --git a/packages/types/src/payment/mutations.ts b/packages/types/src/payment/mutations.ts new file mode 100644 index 0000000000..2785309646 --- /dev/null +++ b/packages/types/src/payment/mutations.ts @@ -0,0 +1,3 @@ +export interface CreatePaymentCollectionDTO {} + +export interface UpdatePaymentCollectionDTO {} diff --git a/packages/types/src/payment/service.ts b/packages/types/src/payment/service.ts index 80c70e30da..63d40b1680 100644 --- a/packages/types/src/payment/service.ts +++ b/packages/types/src/payment/service.ts @@ -1,3 +1,74 @@ import { IModuleService } from "../modules-sdk" +import { Context } from "../shared-context" +import { + CreatePaymentCollectionDTO, + UpdatePaymentCollectionDTO, +} from "./mutations" +import { + FilterablePaymentCollectionProps, + PaymentCollectionDTO, + PaymentDTO, +} from "./common" +import { FindConfig } from "../common" -export interface IPaymentModuleService extends IModuleService {} +export interface IPaymentModuleService extends IModuleService { + createPaymentCollection( + data: CreatePaymentCollectionDTO[], + sharedContext?: Context + ): Promise + createPaymentCollection( + data: CreatePaymentCollectionDTO, + sharedContext?: Context + ): Promise + + retrievePaymentCollection( + paymentCollectionId: string, + config?: FindConfig, + sharedContext?: Context + ): Promise + + listPaymentCollections( + filters?: FilterablePaymentCollectionProps, + config?: FindConfig, + sharedContext?: Context + ): Promise<[PaymentCollectionDTO[], number]> + + listAndCountPaymentCollections( + filters?: FilterablePaymentCollectionProps, + config?: FindConfig, + sharedContext?: Context + ): Promise<[PaymentCollectionDTO[], number]> + + updatePaymentCollection( + data: UpdatePaymentCollectionDTO[], + sharedContext?: Context + ): Promise + updatePaymentCollection( + data: UpdatePaymentCollectionDTO, + sharedContext?: Context + ): Promise + + deletePaymentCollection( + paymentCollectionId: string[], + sharedContext?: Context + ): Promise + deletePaymentCollection( + paymentCollectionId: string, + sharedContext?: Context + ): Promise + + authorizePaymentCollection( + paymentCollectionId: string, + sharedContext?: Context + ): Promise + + completePaymentCollection( + paymentCollectionId: string, + sharedContext?: Context + ): Promise + + capturePayment(paymentId: string): Promise + refundPayment(paymentId: string): Promise + + createPayment() +}