From fbd3fedb68838928b92b974ac6ff91a12457485f Mon Sep 17 00:00:00 2001 From: fPolic Date: Mon, 15 Jan 2024 17:15:49 +0100 Subject: [PATCH] wip: service --- packages/types/src/payment/mutations.ts | 21 +++++++++++++++++++++ packages/types/src/payment/service.ts | 12 +++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/packages/types/src/payment/mutations.ts b/packages/types/src/payment/mutations.ts index 2785309646..e5535aafbb 100644 --- a/packages/types/src/payment/mutations.ts +++ b/packages/types/src/payment/mutations.ts @@ -1,3 +1,24 @@ +/** + * TODO + */ + export interface CreatePaymentCollectionDTO {} export interface UpdatePaymentCollectionDTO {} + +export interface CreatePaymentDTO { + amount: number + currency_code: string + provider_id: string + data: Record + + cart_id?: string + order_id?: string + customer_id?: string +} + +export interface UpdatePaymentDTO { + cart_id?: string + order_id?: string + customer_id?: string +} diff --git a/packages/types/src/payment/service.ts b/packages/types/src/payment/service.ts index 63d40b1680..4980c4a7a4 100644 --- a/packages/types/src/payment/service.ts +++ b/packages/types/src/payment/service.ts @@ -2,7 +2,9 @@ import { IModuleService } from "../modules-sdk" import { Context } from "../shared-context" import { CreatePaymentCollectionDTO, + CreatePaymentDTO, UpdatePaymentCollectionDTO, + UpdatePaymentDTO, } from "./mutations" import { FilterablePaymentCollectionProps, @@ -67,8 +69,12 @@ export interface IPaymentModuleService extends IModuleService { sharedContext?: Context ): Promise - capturePayment(paymentId: string): Promise - refundPayment(paymentId: string): Promise + createPayment(data: CreatePaymentDTO): Promise - createPayment() + capturePayment(paymentId: string, amount: number): Promise + refundPayment(paymentId: string, amount: number): Promise + + updatePayment(data: UpdatePaymentDTO): Promise + + // TODO: PaymentSession methods }