From 9e57d95c35a2170a72b4e0add0a7ae59df06bf54 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Wed, 5 Jan 2022 13:11:35 +0100 Subject: [PATCH 01/12] feat: started typescript declaration efforts --- package.json | 1 + types/index.d.ts | 29 ++++++++++++++++++++ types/interfaces.d.ts | 61 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 types/index.d.ts create mode 100644 types/interfaces.d.ts diff --git a/package.json b/package.json index 8c77e93..46bf993 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "paystack-api", "version": "2.0.6", "main": "index.js", + "types": "./types/index.d.ts", "license": "MIT", "dependencies": { "mitt": "^1.1.3", diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..8837d1f --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,29 @@ +// types/index.d.ts + +/// + +declare module "paystack-api" { + interface API { + plan: PlanResource; + customer: CustomerResource; + } + + export default function Paystack(secretKey: string): API; + + class PlanResource { + get(options: GetPlanOptions): Promise; + list(options: ListOptions): Promise; + create(options: CreatePlanOptions): Promise; + update(options: UpdatePlanOptions): Promise; + } + + class CustomerResource { + get(options: GetCustomerOptions): Promise; + list(options: ListOptions): Promise; + create(options: CreateCustomerOptions): Promise; + update(options: UpdateCustomerOptions): Promise; + validate(options: ValidateCustomerOptions): Promise; + setRiskAction(options: SetCustomerRiskActionOptions): Promise; + deactivateAuth(options: DeactivateCustomerAuthOptions): Promise; + } +} diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts new file mode 100644 index 0000000..5406993 --- /dev/null +++ b/types/interfaces.d.ts @@ -0,0 +1,61 @@ +// types/interfaces.d.ts + +interface ListOptions { + page: Number; + perPage: Number; + [key: string]: any; +} + +// Plan Resource + +interface GetPlanOptions { + id: string; +} + +interface CreatePlanOptions { + name: string; + amount: Number; + interval: string; +} + +interface UpdatePlanOptions { + [key: string]: any; +} + +// Customer Resource + +interface GetCustomerOptions { + id: string; +} + +interface CreateCustomerOptions { + first_name: string; + last_name: string; + email: string; + phone: string; + metadata: Object; +} + +interface UpdateCustomerOptions { + first_name: string; + last_name: string; + phone: string; + metadata: Object; +} + +interface ValidateCustomerOptions { + first_name: string; + last_name: string; + type: string; + value: string; + country: string; +} + +interface SetCustomerRiskActionOptions { + customer: string; + risk_action: string; +} + +interface DeactivateCustomerAuthOptions { + authorization_code: string; +} From 0d57bf6f45e80a60b399a5be85575612e589f7c9 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Sat, 8 Jan 2022 01:06:51 +0100 Subject: [PATCH 02/12] added PaymentPageResource --- types/index.d.ts | 9 +++++++++ types/interfaces.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 8837d1f..62d38d0 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,6 +5,7 @@ declare module "paystack-api" { interface API { plan: PlanResource; + page: PaymentPageResource; customer: CustomerResource; } @@ -26,4 +27,12 @@ declare module "paystack-api" { setRiskAction(options: SetCustomerRiskActionOptions): Promise; deactivateAuth(options: DeactivateCustomerAuthOptions): Promise; } + + class PaymentPageResource { + get(options: GetPaymentPageOptions): Promise; + list(options: ListPaymentPagesOption): Promise; + create(options: CreatePaymentPageOptions): Promise; + update(options: UpdatePaymentPageOptions): Promise; + slugAvailable(options: CheckSlugAvailablilityOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 5406993..495a1d1 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -59,3 +59,36 @@ interface SetCustomerRiskActionOptions { interface DeactivateCustomerAuthOptions { authorization_code: string; } + +// Payment Page Resource + +interface GetPaymentPageOptions { + id: string; +} + +interface ListPaymentPagesOption extends ListOptions { + to: string; + from: string; +} + +interface CreatePaymentPageOptions { + name: string; + description: string; + amount: Number; + slug: string; + metadata: Object; + redirect_url: string; + custom_fields: [any]; +} + +interface UpdatePaymentPageOptions { + id: string; + name: string; + description: string; + amount: Number; + active: boolean; +} + +interface CheckSlugAvailablilityOptions { + slug: string; +} From 4d72420f5c7ebcac96328a8da653be5a5f4a9aa6 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Sat, 8 Jan 2022 01:15:22 +0100 Subject: [PATCH 03/12] updated Customer Resource --- types/index.d.ts | 2 +- types/interfaces.d.ts | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 62d38d0..8c2f833 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -20,7 +20,7 @@ declare module "paystack-api" { class CustomerResource { get(options: GetCustomerOptions): Promise; - list(options: ListOptions): Promise; + list(options: ListCustomersOptions): Promise; create(options: CreateCustomerOptions): Promise; update(options: UpdateCustomerOptions): Promise; validate(options: ValidateCustomerOptions): Promise; diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 495a1d1..7b07820 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -25,13 +25,19 @@ interface UpdatePlanOptions { // Customer Resource interface GetCustomerOptions { + // id can be email or customer code id: string; } +interface ListCustomersOptions extends ListOptions { + to: string; + from: string; +} + interface CreateCustomerOptions { + email: string; first_name: string; last_name: string; - email: string; phone: string; metadata: Object; } @@ -43,17 +49,24 @@ interface UpdateCustomerOptions { metadata: Object; } +type ValidateCustomerIdentification = "bvn" | "bank_account"; + interface ValidateCustomerOptions { first_name: string; last_name: string; - type: string; + type: ValidateCustomerIdentification; value: string; country: string; + bvn: string; + bank_code: string; + account_number: string; } +type CustomerRiskAction = "default" | "allow" | "deny"; + interface SetCustomerRiskActionOptions { customer: string; - risk_action: string; + risk_action: CustomerRiskAction; } interface DeactivateCustomerAuthOptions { From 49f9121474746499a39380f1e10f499a57a24de7 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Sat, 8 Jan 2022 01:20:52 +0100 Subject: [PATCH 04/12] update Plan Resource --- types/index.d.ts | 2 +- types/interfaces.d.ts | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 8c2f833..07128f9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,7 +13,7 @@ declare module "paystack-api" { class PlanResource { get(options: GetPlanOptions): Promise; - list(options: ListOptions): Promise; + list(options: ListPlansOptions): Promise; create(options: CreatePlanOptions): Promise; update(options: UpdatePlanOptions): Promise; } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 7b07820..f45a2e3 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -1,5 +1,7 @@ // types/interfaces.d.ts +type Currency = "NGN" | "GHS" | "ZAR" | "USD"; + interface ListOptions { page: Number; perPage: Number; @@ -12,14 +14,35 @@ interface GetPlanOptions { id: string; } +type PlanInterval = "daily" | "weekly" | "monthly" | "biannually" | "annually"; + +interface ListPlansOptions extends ListOptions { + status: string; + amount: Number; + interval: PlanInterval; +} + interface CreatePlanOptions { name: string; amount: Number; - interval: string; + interval: PlanInterval; + description: string; + send_sms: boolean; + send_invoices: boolean; + currency: Currency; + invoice_limit: Number; } interface UpdatePlanOptions { - [key: string]: any; + id: string; + name: string; + amount: Number; + interval: PlanInterval; + description: string; + send_sms: boolean; + send_invoices: boolean; + currency: Currency; + invoice_limit: Number; } // Customer Resource From d795973602a84d1d22750a1fc83690b97eca0c66 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Tue, 11 Jan 2022 22:18:21 +0100 Subject: [PATCH 05/12] added control panel resource --- types/index.d.ts | 6 ++++++ types/interfaces.d.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 07128f9..083ac8c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -7,6 +7,7 @@ declare module "paystack-api" { plan: PlanResource; page: PaymentPageResource; customer: CustomerResource; + control_panel: ControlPanelResource; } export default function Paystack(secretKey: string): API; @@ -35,4 +36,9 @@ declare module "paystack-api" { update(options: UpdatePaymentPageOptions): Promise; slugAvailable(options: CheckSlugAvailablilityOptions): Promise; } + + class ControlPanelResource { + getSessionTimeout(): Promise; + updeteSessionTimeout(options: UpdateSessionTimeoutOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index f45a2e3..597d19d 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -128,3 +128,9 @@ interface UpdatePaymentPageOptions { interface CheckSlugAvailablilityOptions { slug: string; } + +// Control Panel Resource + +interface UpdateSessionTimeoutOptions { + timeout: Number; +} From 9350a6bd5eed0709fcd7600861b909392a23fdff Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Tue, 11 Jan 2022 22:20:59 +0100 Subject: [PATCH 06/12] added settlement resource --- types/index.d.ts | 4 ++++ types/interfaces.d.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 083ac8c..b70fca5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -41,4 +41,8 @@ declare module "paystack-api" { getSessionTimeout(): Promise; updeteSessionTimeout(options: UpdateSessionTimeoutOptions): Promise; } + + class SettlementResource { + list(options: ListSettlementOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 597d19d..e3c7ec6 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -134,3 +134,11 @@ interface CheckSlugAvailablilityOptions { interface UpdateSessionTimeoutOptions { timeout: Number; } + +// Settlement Resource + +interface ListSettlementOptions extends ListOptions { + id: string; + to: string; + from: string; +} From d2bb4caed833caeee97a9c60fa78aea76fde36f6 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Tue, 11 Jan 2022 22:28:56 +0100 Subject: [PATCH 07/12] added transfer control resource --- types/index.d.ts | 9 +++++++++ types/interfaces.d.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index b70fca5..f11501d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -8,6 +8,7 @@ declare module "paystack-api" { page: PaymentPageResource; customer: CustomerResource; control_panel: ControlPanelResource; + transfer_control: TransferControlResource; } export default function Paystack(secretKey: string): API; @@ -45,4 +46,12 @@ declare module "paystack-api" { class SettlementResource { list(options: ListSettlementOptions): Promise; } + + class TransferControlResource { + balance(): Promise; + enableOTP(): Promise; + disableOTP(): Promise; + resendOTP(options: ResendOTPOptions): Promise; + finalizeDisableOTP(options: FinalizeDisableOTPOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index e3c7ec6..b6a0179 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -142,3 +142,16 @@ interface ListSettlementOptions extends ListOptions { to: string; from: string; } + +// Transfer Control Resource + +type ResendOTPReason = "resend_otp" | "transfer"; + +interface ResendOTPOptions { + transfer_code: string; + reason: ResendOTPReason; +} + +interface FinalizeDisableOTPOptions { + otp: string; +} \ No newline at end of file From e462c6b875dd8b45b173b86012c567d18dde3ca2 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Tue, 11 Jan 2022 22:36:42 +0100 Subject: [PATCH 08/12] added refund resource --- types/index.d.ts | 7 +++++++ types/interfaces.d.ts | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index f11501d..2066f88 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -9,6 +9,7 @@ declare module "paystack-api" { customer: CustomerResource; control_panel: ControlPanelResource; transfer_control: TransferControlResource; + refund: RefundResource; } export default function Paystack(secretKey: string): API; @@ -54,4 +55,10 @@ declare module "paystack-api" { resendOTP(options: ResendOTPOptions): Promise; finalizeDisableOTP(options: FinalizeDisableOTPOptions): Promise; } + + class RefundResource { + get(options: GetRefundOptions): Promise; + list(options: ListRefundsOptions): Promise; + create(options: CreateRefundOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index b6a0179..ae2e6df 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -154,4 +154,25 @@ interface ResendOTPOptions { interface FinalizeDisableOTPOptions { otp: string; -} \ No newline at end of file +} + +// Refund Resource + +interface GetRefundOptions { + reference: string; +} + +interface ListRefundsOptions extends ListOptions { + to: string; + from: string; + reference: string; + currency: Currency; +} + +interface CreateRefundOptions { + transaction: string; + amount: Number; + currency: Currency; + customer_note: string; + merchant_note: string; +} From 222df5b340390c17abe94a1581eff06b32ae17d8 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Tue, 11 Jan 2022 22:38:04 +0100 Subject: [PATCH 09/12] fix invalid key in GetRefundOptions --- types/interfaces.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index ae2e6df..6cf3afc 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -159,7 +159,7 @@ interface FinalizeDisableOTPOptions { // Refund Resource interface GetRefundOptions { - reference: string; + trans_id: string; } interface ListRefundsOptions extends ListOptions { From aaa955355145245c88b44d36a805c80078d46fde Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Thu, 13 Jan 2022 01:15:31 +0100 Subject: [PATCH 10/12] added subaccount resource --- types/index.d.ts | 11 ++++++++++- types/interfaces.d.ts | 30 +++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 2066f88..2f3567b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -10,6 +10,8 @@ declare module "paystack-api" { control_panel: ControlPanelResource; transfer_control: TransferControlResource; refund: RefundResource; + settlement: SettlementResource; + subaccount: SubaccountResource; } export default function Paystack(secretKey: string): API; @@ -33,7 +35,7 @@ declare module "paystack-api" { class PaymentPageResource { get(options: GetPaymentPageOptions): Promise; - list(options: ListPaymentPagesOption): Promise; + list(options: ListPaymentPagesOptions): Promise; create(options: CreatePaymentPageOptions): Promise; update(options: UpdatePaymentPageOptions): Promise; slugAvailable(options: CheckSlugAvailablilityOptions): Promise; @@ -61,4 +63,11 @@ declare module "paystack-api" { list(options: ListRefundsOptions): Promise; create(options: CreateRefundOptions): Promise; } + + class SubaccountResource { + get(options: GetSubaccountOptions): Promise; + list(options: ListSubaccountOptions): Promise; + create(options: CreateSubaccountOptions): Promise; + update(options: UpdateSubaccountOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 6cf3afc..d52bee9 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -102,7 +102,7 @@ interface GetPaymentPageOptions { id: string; } -interface ListPaymentPagesOption extends ListOptions { +interface ListPaymentPagesOptions extends ListOptions { to: string; from: string; } @@ -176,3 +176,31 @@ interface CreateRefundOptions { customer_note: string; merchant_note: string; } + +// Subaccount Resource + +interface GetSubaccountOptions { + id: string; +} + +interface ListSubaccountOptions extends ListOptions { + to: string; + from: string; +} + +interface CreateSubaccountOptions { + business_name: string; + settlement_bank: string; + account_number: string; + percentage_charge: Number; + description: string; +} + +interface UpdateSubaccountOptions { + id: string; + business_name: string; + settlement_bank: string; + account_number: string; + percentage_charge: Number; + description: string; +} From 4b6d6654f375061e495ea7993f8a15d545d46df5 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Thu, 13 Jan 2022 01:25:21 +0100 Subject: [PATCH 11/12] added transfer recipient resource --- types/index.d.ts | 8 ++++++++ types/interfaces.d.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 2f3567b..a307f40 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -9,6 +9,7 @@ declare module "paystack-api" { customer: CustomerResource; control_panel: ControlPanelResource; transfer_control: TransferControlResource; + transfer_recipient: TransferRecipientResource; refund: RefundResource; settlement: SettlementResource; subaccount: SubaccountResource; @@ -58,6 +59,13 @@ declare module "paystack-api" { finalizeDisableOTP(options: FinalizeDisableOTPOptions): Promise; } + class TransferRecipientResource { + list(options: ListTransferRecipientOptions): Promise; + create(options: CreateTransferRecipientOptions): Promise; + update(options: UpdateTransferRecipientOptions): Promise; + remove(options: RemoveTransferRecipientOptions): Promise; + } + class RefundResource { get(options: GetRefundOptions): Promise; list(options: ListRefundsOptions): Promise; diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index d52bee9..3e13ccd 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -156,6 +156,34 @@ interface FinalizeDisableOTPOptions { otp: string; } +// Transfer Recipient + +interface ListTransferRecipientOptions extends ListOptions { + to: string; + from: string; +} + +interface CreateTransferRecipientOptions { + type: string; + name: string; + account_number: string; + bank_code: string; + description: string; + currency: string; + authorization_code: string; + metadata: Object; +} + +interface UpdateTransferRecipientOptions { + id: string; + name: string; + email: string; +} + +interface RemoveTransferRecipientOptions { + id: string; +} + // Refund Resource interface GetRefundOptions { From 754eef8ac933af85ce009a3f21d5457ba5319141 Mon Sep 17 00:00:00 2001 From: Blessing Pariola Date: Thu, 13 Jan 2022 16:31:15 +0100 Subject: [PATCH 12/12] added typings for - invoice - bulk_charge - charge --- types/index.d.ts | 33 ++++++++ types/interfaces.d.ts | 173 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 183 insertions(+), 23 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index a307f40..7ec1938 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,6 +13,9 @@ declare module "paystack-api" { refund: RefundResource; settlement: SettlementResource; subaccount: SubaccountResource; + charge: ChargeResource; + bulk_charge: BulkChargeResource; + invoice: InvoiceResource; } export default function Paystack(secretKey: string): API; @@ -78,4 +81,34 @@ declare module "paystack-api" { create(options: CreateSubaccountOptions): Promise; update(options: UpdateSubaccountOptions): Promise; } + + class ChargeResource { + charge(options: CreateChargeOptions): Promise; + submitPIN(options: SubmitPINOptions): Promise; + submitOTP(options: SubmitOTPOptions): Promise; + submitPhone(options: SubmitPhoneOptions): Promise; + submitBirthday(options: SubmitBirthdayOptions): Promise; + checkCharge(options: CheckChargeOptions): Promise; + } + + class BulkChargeResource { + get(options: GetBulkChargeOptions): Promise; + list(options: ListBulkChargesOptions): Promise; + pause(options: PauseBulkChargeOptions): Promise; + resume(options: ResumeBulkChargeOptions): Promise; + create(options: CreateBulkChargeOptions): Promise; + getCharges(options: GetChargesInBulkChargeOptions): Promise; + } + + class InvoiceResource { + get(options: GetInvoiceOptions): Promise; + list(options: ListInvoicesOptions): Promise; + create(options: CreateInvoiceOptions): Promise; + verify(options: VerifyInvoiceOptions): Promise; + notify(options: SendInvoiceNotificationOptions): Promise; + invoiceMetrics(options: GetInvoiceTotalsOptions): Promise; + updateInvoice(options: UpdateInvoiceOptions): Promise; + archiveInvoice(options: ArchiveInvoiceOptions): Promise; + draftInvoice(options: FinalizeInvoiceOptions): Promise; + } } diff --git a/types/interfaces.d.ts b/types/interfaces.d.ts index 3e13ccd..81b2b58 100644 --- a/types/interfaces.d.ts +++ b/types/interfaces.d.ts @@ -5,7 +5,11 @@ type Currency = "NGN" | "GHS" | "ZAR" | "USD"; interface ListOptions { page: Number; perPage: Number; - [key: string]: any; +} + +interface DateFilterableListOptions extends ListOptions { + to: string; + from: string; } // Plan Resource @@ -52,10 +56,7 @@ interface GetCustomerOptions { id: string; } -interface ListCustomersOptions extends ListOptions { - to: string; - from: string; -} +interface ListCustomersOptions extends DateFilterableListOptions {} interface CreateCustomerOptions { email: string; @@ -102,10 +103,7 @@ interface GetPaymentPageOptions { id: string; } -interface ListPaymentPagesOptions extends ListOptions { - to: string; - from: string; -} +interface ListPaymentPagesOptions extends DateFilterableListOptions {} interface CreatePaymentPageOptions { name: string; @@ -137,10 +135,8 @@ interface UpdateSessionTimeoutOptions { // Settlement Resource -interface ListSettlementOptions extends ListOptions { +interface ListSettlementOptions extends DateFilterableListOptions { id: string; - to: string; - from: string; } // Transfer Control Resource @@ -158,10 +154,7 @@ interface FinalizeDisableOTPOptions { // Transfer Recipient -interface ListTransferRecipientOptions extends ListOptions { - to: string; - from: string; -} +interface ListTransferRecipientOptions extends DateFilterableListOptions {} interface CreateTransferRecipientOptions { type: string; @@ -190,9 +183,7 @@ interface GetRefundOptions { trans_id: string; } -interface ListRefundsOptions extends ListOptions { - to: string; - from: string; +interface ListRefundsOptions extends DateFilterableListOptions { reference: string; currency: Currency; } @@ -211,10 +202,7 @@ interface GetSubaccountOptions { id: string; } -interface ListSubaccountOptions extends ListOptions { - to: string; - from: string; -} +interface ListSubaccountOptions extends DateFilterableListOptions {} interface CreateSubaccountOptions { business_name: string; @@ -232,3 +220,142 @@ interface UpdateSubaccountOptions { percentage_charge: Number; description: string; } + +// Charge Resource + +interface CreateChargeOptions { + email: string; + amount: Number; + bank: string; + authorization_code: string; + pin: string; + metadata: Object; + reference: string; + ussd: Object; + mobile_money: Object; + device_id: string; +} + +interface SubmitPINOptions { + pin: string; + reference: string; +} + +interface SubmitOTPOptions { + otp: string; + reference: string; +} + +interface SubmitPhoneOptions { + phone: string; + reference: string; +} +interface SubmitBirthdayOptions { + birthday: string; + reference: string; +} + +interface CheckChargeOptions { + reference: string; +} + +// Bulk Charge Resource + +interface GetBulkChargeOptions { + id: string; +} + +interface ListBulkChargesOptions extends DateFilterableListOptions {} + +interface PauseBulkChargeOptions { + batch_code: string; +} + +interface ResumeBulkChargeOptions { + batch_code: string; +} + +interface CreateBulkChargeOption { + amount: Number; + authorization: string; +} + +interface CreateBulkChargeOptions extends Array {} + +interface GetChargesInBulkChargeOptions extends DateFilterableListOptions { + id: string; + status: string; +} + +// Invoice Resource + +interface GetInvoiceOptions { + invoice_id: string; +} + +interface ListInvoicesOptions extends DateFilterableListOptions { + status: string; + customer: string; + currency: Currency; + include_archive: string; +} + +interface Tax { + name: string; + amount: Number; +} + +interface LineItem { + name: string; + amount: Number; + quantity: Number; +} + +interface CreateInvoiceOptions { + customer: string; + amount: Number; + due_date: string; + description: string; + curreny: Currency; + tax: [Tax]; + line_items: [LineItem]; + send_notification: boolean; + draft: boolean; + has_invoice: boolean; + invoice_number: Number; + split_code: string; +} + +interface VerifyInvoiceOptions { + invoice_code: string; +} + +interface SendInvoiceNotificationOptions { + id: string; +} + +interface GetInvoiceTotalsOptions {} + +interface UpdateInvoiceOptions { + id: string; + customer: string; + amount: Number; + due_date: string; + description: string; + curreny: Currency; + tax: [Tax]; + line_items: [LineItem]; + send_notification: boolean; + draft: boolean; + has_invoice: boolean; + invoice_number: Number; + split_code: string; +} + +interface ArchiveInvoiceOptions { + id: string; +} + +interface FinalizeInvoiceOptions { + id: string; +}