From f4e6960e815deb15d41670fc6b5b892be6335a42 Mon Sep 17 00:00:00 2001 From: weaver-bot Date: Thu, 2 Jul 2026 15:19:02 +0000 Subject: [PATCH] chore: regenerate node-sdk from weaver@87360b9 --- .github/ISSUE_TEMPLATE/bug_report.md | 27 - .github/ISSUE_TEMPLATE/feature_request.md | 20 - .github/pull_request_template.md | 13 - .gitignore | 5 - .npmignore | 2 - .openapi-generator-ignore | 23 - .openapi-generator/FILES | 87 - .openapi-generator/VERSION | 1 - LICENSE | 21 - README.md | 249 +- docs/applePay.md | 78 + docs/balance.md | 51 + docs/bank.md | 95 + docs/bulkCharge.md | 147 ++ docs/charge.md | 183 ++ docs/customer.md | 305 +++ docs/dedicatedVirtualAccount.md | 225 ++ docs/directDebit.md | 56 + docs/dispute.md | 208 ++ docs/integration.md | 48 + docs/miscellaneous.md | 70 + docs/order.md | 131 ++ docs/page.md | 164 ++ docs/paymentRequest.md | 231 ++ docs/plan.md | 118 + docs/product.md | 139 ++ docs/refund.md | 106 + docs/settlement.md | 55 + docs/split.md | 161 ++ docs/storefront.md | 261 +++ docs/subaccount.md | 118 + docs/subscription.md | 174 ++ docs/terminal.md | 194 ++ docs/transaction.md | 260 +++ docs/transfer.md | 260 +++ docs/transferRecipient.md | 155 ++ docs/virtualTerminal.md | 217 ++ package-lock.json | 2066 ----------------- package.json | 58 +- src/apis/Balance.ts | 83 - src/apis/BulkCharge.ts | 174 -- src/apis/Charge.ts | 350 --- src/apis/Customer.ts | 357 --- src/apis/DedicatedVirtualAccount.ts | 273 --- src/apis/Dispute.ts | 359 --- src/apis/Integration.ts | 64 - src/apis/Page.ts | 252 -- src/apis/PaymentRequest.ts | 383 --- src/apis/Plan.ts | 236 -- src/apis/Product.ts | 237 -- src/apis/Refund.ts | 139 -- src/apis/Settlement.ts | 79 - src/apis/Split.ts | 287 --- src/apis/Subaccount.ts | 244 -- src/apis/Subscription.ts | 269 --- src/apis/Transaction.ts | 556 ----- src/apis/Transfer.ts | 393 ---- src/apis/TransferRecipient.ts | 253 -- src/apis/Verification.ts | 183 -- src/apis/apple-pay.ts | 31 + src/apis/balance.ts | 19 + src/apis/bank.ts | 27 + src/apis/bulk-charge.ts | 53 + src/apis/charge.ts | 57 + src/apis/customer.ts | 98 + src/apis/dedicated-virtual-account.ts | 70 + src/apis/direct-debit.ts | 19 + src/apis/dispute.ts | 71 + src/apis/index.ts | 20 - src/apis/integration.ts | 19 + src/apis/miscellaneous.ts | 27 + src/apis/order.ts | 44 + src/apis/page.ts | 55 + src/apis/payment-request.ts | 75 + src/apis/plan.ts | 36 + src/apis/product.ts | 44 + src/apis/refund.ts | 37 + src/apis/settlement.ts | 21 + src/apis/split.ts | 54 + src/apis/storefront.ts | 92 + src/apis/subaccount.ts | 37 + src/apis/subscription.ts | 57 + src/apis/terminal.ts | 67 + src/apis/transaction.ts | 72 + src/apis/transfer-recipient.ts | 51 + src/apis/transfer.ts | 86 + src/apis/virtual-terminal.ts | 78 + src/core/api-client.ts | 73 + src/core/errors.ts | 13 + src/core/types.ts | 17 + src/index.ts | 151 +- src/models/Accepted.ts | 65 - src/models/Bank.ts | 65 - src/models/BulkChargeInitiate.ts | 65 - src/models/ChargeCreate.ts | 114 - src/models/ChargeSubmitAddress.ts | 89 - src/models/ChargeSubmitBirthday.ts | 65 - src/models/ChargeSubmitOTP.ts | 65 - src/models/ChargeSubmitPhone.ts | 65 - src/models/ChargeSubmitPin.ts | 65 - src/models/CustomerCreate.ts | 89 - src/models/CustomerDeactivateAuthorization.ts | 57 - src/models/CustomerRiskAction.ts | 66 - src/models/CustomerUpdate.ts | 81 - src/models/CustomerValidate.ts | 89 - src/models/CustomerValidation.ts | 113 - src/models/DedicatedVirtualAccountCreate.ts | 81 - src/models/DedicatedVirtualAccountSplit.ts | 73 - src/models/DisputeEvidence.ts | 97 - src/models/DisputeResolve.ts | 89 - src/models/DisputeUpdate.ts | 65 - src/models/EFT.ts | 57 - src/models/MobileMoney.ts | 65 - src/models/ModelError.ts | 65 - src/models/PageCreate.ts | 105 - src/models/PageProduct.ts | 57 - src/models/PageUpdate.ts | 81 - src/models/PaymentRequestCreate.ts | 148 -- src/models/PaymentRequestUpdate.ts | 148 -- src/models/PlanCreate.ts | 114 - src/models/PlanUpdate.ts | 114 - src/models/ProductCreate.ts | 97 - src/models/ProductUpdate.ts | 97 - src/models/RefundCreate.ts | 90 - src/models/Response.ts | 73 - src/models/SplitCreate.ts | 104 - src/models/SplitSubaccounts.ts | 65 - src/models/SplitUpdate.ts | 81 - src/models/SubaccountCreate.ts | 121 - src/models/SubaccountUpdate.ts | 129 - src/models/SubscriptionCreate.ts | 82 - src/models/SubscriptionToggle.ts | 65 - src/models/TransactionChargeAuthorization.ts | 138 -- src/models/TransactionCheckAuthorization.ts | 81 - src/models/TransactionInitialize.ts | 155 -- src/models/TransactionPartialDebit.ts | 97 - src/models/TransferBulk.ts | 72 - src/models/TransferFinalize.ts | 65 - src/models/TransferFinalizeDisableOTP.ts | 57 - src/models/TransferInitiate.ts | 98 - src/models/TransferRecipientBulk.ts | 65 - src/models/TransferRecipientCreate.ts | 113 - src/models/TransferRecipientUpdate.ts | 65 - src/models/TransferResendOTP.ts | 65 - src/models/USSD.ts | 57 - src/models/VerificationBVNMatch.ts | 97 - src/models/apple-pay-list-domain-data.ts | 2 + src/models/apple-pay-list-domain-query.ts | 10 + src/models/apple-pay-register-domain-body.ts | 4 + .../apple-pay-unregister-domain-body.ts | 4 + .../apple-pay-unregister-domain-data.ts | 2 + src/models/balance-fetch-data.ts | 2 + src/models/balance-ledger-data.ts | 2 + src/models/balance-ledger-query.ts | 10 + src/models/bank-list-data.ts | 2 + src/models/bank-list-query.ts | 36 + .../bank-resolve-account-number-data.ts | 8 + .../bank-resolve-account-number-query.ts | 6 + .../bank-validate-account-number-body.ts | 16 + .../bank-validate-account-number-data.ts | 16 + src/models/bulk-charge-charges-data.ts | 2 + src/models/bulk-charge-charges-query.ts | 8 + src/models/bulk-charge-fetch-data.ts | 22 + src/models/bulk-charge-initiate-body.ts | 4 + src/models/bulk-charge-initiate-data.ts | 22 + src/models/bulk-charge-list-data.ts | 2 + src/models/bulk-charge-list-query.ts | 8 + src/models/charge-check-data.ts | 30 + src/models/charge-create-body.ts | 27 + src/models/charge-create-data.ts | 66 + src/models/charge-submit-address-body.ts | 12 + src/models/charge-submit-address-data.ts | 2 + src/models/charge-submit-birthday-body.ts | 6 + src/models/charge-submit-birthday-data.ts | 6 + src/models/charge-submit-otp-body.ts | 6 + src/models/charge-submit-otp-data.ts | 30 + src/models/charge-submit-phone-body.ts | 6 + src/models/charge-submit-phone-data.ts | 32 + src/models/charge-submit-pin-body.ts | 6 + src/models/charge-submit-pin-data.ts | 30 + src/models/customer-create-body.ts | 12 + src/models/customer-create-data.ts | 36 + .../customer-deactivate-authorization-body.ts | 4 + ...mer-direct-debit-activation-charge-body.ts | 4 + src/models/customer-fetch-data.ts | 48 + ...tomer-fetch-mandate-authorizations-data.ts | 2 + .../customer-initialize-authorization-body.ts | 12 + .../customer-initialize-authorization-data.ts | 8 + .../customer-initialize-direct-debit-body.ts | 6 + .../customer-initialize-direct-debit-data.ts | 8 + src/models/customer-list-data.ts | 2 + src/models/customer-list-query.ts | 18 + src/models/customer-risk-action-body.ts | 6 + src/models/customer-risk-action-data.ts | 36 + src/models/customer-update-body.ts | 10 + src/models/customer-update-data.ts | 30 + src/models/customer-validate-body.ts | 20 + .../customer-verify-authorization-data.ts | 12 + ...ccount-dedicated-account-add-split-body.ts | 8 + ...ccount-dedicated-account-add-split-data.ts | 2 + ...l-account-dedicated-account-assign-body.ts | 26 + ...l-account-dedicated-account-assign-data.ts | 2 + ...icated-account-available-providers-data.ts | 2 + ...l-account-dedicated-account-create-body.ts | 10 + ...l-account-dedicated-account-create-data.ts | 26 + ...count-dedicated-account-deactivate-data.ts | 24 + ...al-account-dedicated-account-fetch-data.ts | 24 + ...ual-account-dedicated-account-list-data.ts | 2 + ...al-account-dedicated-account-list-query.ts | 16 + ...unt-dedicated-account-remove-split-body.ts | 4 + ...unt-dedicated-account-remove-split-data.ts | 2 + ...-account-dedicated-account-requery-data.ts | 2 + ...account-dedicated-account-requery-query.ts | 8 + ...tdebit-list-mandate-authorizations-data.ts | 2 + ...debit-list-mandate-authorizations-query.ts | 8 + ...ectdebit-trigger-activation-charge-body.ts | 4 + src/models/dispute-download-data.ts | 6 + src/models/dispute-download-query.ts | 12 + src/models/dispute-evidence-body.ts | 14 + src/models/dispute-evidence-data.ts | 22 + src/models/dispute-fetch-data.ts | 44 + src/models/dispute-list-data.ts | 2 + src/models/dispute-list-query.ts | 14 + src/models/dispute-resolve-body.ts | 12 + src/models/dispute-resolve-data.ts | 46 + src/models/dispute-transaction-data.ts | 48 + src/models/dispute-update-body.ts | 6 + src/models/dispute-update-data.ts | 44 + src/models/dispute-upload-url-data.ts | 6 + src/models/index.ts | 295 ++- ...tion-fetch-payment-session-timeout-data.ts | 4 + ...ion-update-payment-session-timeout-body.ts | 4 + ...ion-update-payment-session-timeout-data.ts | 4 + src/models/miscellaneous-avs-data.ts | 2 + src/models/miscellaneous-avs-query.ts | 4 + .../miscellaneous-list-countries-data.ts | 2 + .../miscellaneous-resolve-card-bin-data.ts | 20 + src/models/order-create-body.ts | 20 + src/models/order-create-data.ts | 50 + src/models/order-fetch-data.ts | 62 + src/models/order-list-data.ts | 2 + src/models/order-list-query.ts | 10 + src/models/order-product-data.ts | 2 + src/models/order-validate-data.ts | 50 + src/models/page-add-products-body.ts | 4 + src/models/page-add-products-data.ts | 48 + src/models/page-create-body.ts | 37 + src/models/page-create-data.ts | 28 + src/models/page-fetch-data.ts | 44 + src/models/page-list-data.ts | 2 + src/models/page-list-query.ts | 10 + src/models/page-update-body.ts | 10 + src/models/page-update-data.ts | 46 + src/models/payment-request-create-body.ts | 27 + src/models/payment-request-create-data.ts | 44 + src/models/payment-request-fetch-data.ts | 2 + src/models/payment-request-finalize-data.ts | 50 + src/models/payment-request-list-data.ts | 2 + src/models/payment-request-list-query.ts | 16 + src/models/payment-request-totals-data.ts | 8 + src/models/payment-request-update-body.ts | 27 + src/models/payment-request-update-data.ts | 48 + src/models/payment-request-verify-data.ts | 50 + src/models/plan-create-body.ts | 19 + src/models/plan-create-data.ts | 34 + src/models/plan-fetch-data.ts | 58 + src/models/plan-list-data.ts | 2 + src/models/plan-list-query.ts | 14 + src/models/plan-update-body.ts | 19 + src/models/product-create-body.ts | 23 + src/models/product-create-data.ts | 58 + src/models/product-fetch-data.ts | 68 + src/models/product-list-data.ts | 2 + src/models/product-list-query.ts | 12 + src/models/product-update-body.ts | 23 + src/models/product-update-data.ts | 66 + src/models/refund-create-body.ts | 12 + src/models/refund-create-data.ts | 34 + src/models/refund-fetch-data.ts | 54 + src/models/refund-list-data.ts | 2 + src/models/refund-list-query.ts | 10 + src/models/refund-retry-body.ts | 4 + src/models/refund-retry-data.ts | 48 + .../settlement-settlements-fetch-data.ts | 2 + .../settlement-settlements-fetch-query.ts | 6 + ...settlement-settlements-transaction-data.ts | 2 + src/models/split-add-subaccount-body.ts | 6 + src/models/split-add-subaccount-data.ts | 32 + src/models/split-create-body.ts | 14 + src/models/split-create-data.ts | 32 + src/models/split-fetch-data.ts | 32 + src/models/split-list-data.ts | 2 + src/models/split-list-query.ts | 16 + src/models/split-remove-subaccount-body.ts | 6 + src/models/split-update-body.ts | 10 + src/models/split-update-data.ts | 32 + src/models/storefront-add-products-body.ts | 4 + src/models/storefront-add-products-data.ts | 2 + src/models/storefront-create-body.ts | 11 + src/models/storefront-create-data.ts | 46 + src/models/storefront-duplicate-data.ts | 2 + src/models/storefront-fetch-data.ts | 46 + src/models/storefront-fetch-orders-data.ts | 2 + src/models/storefront-list-data.ts | 2 + src/models/storefront-list-products-data.ts | 2 + src/models/storefront-list-query.ts | 8 + src/models/storefront-publish-data.ts | 2 + src/models/storefront-update-body.ts | 10 + src/models/storefront-verify-slug-data.ts | 2 + src/models/subaccount-create-body.ts | 20 + src/models/subaccount-create-data.ts | 50 + src/models/subaccount-fetch-data.ts | 50 + src/models/subaccount-list-data.ts | 2 + src/models/subaccount-list-query.ts | 8 + src/models/subaccount-update-body.ts | 22 + src/models/subaccount-update-data.ts | 50 + src/models/subscription-create-body.ts | 11 + src/models/subscription-create-data.ts | 46 + src/models/subscription-disable-body.ts | 6 + src/models/subscription-enable-body.ts | 6 + src/models/subscription-enable-data.ts | 2 + src/models/subscription-fetch-data.ts | 46 + src/models/subscription-list-data.ts | 2 + src/models/subscription-list-query.ts | 14 + src/models/subscription-manage-email-data.ts | 2 + src/models/subscription-manage-link-data.ts | 2 + src/models/terminal-commission-body.ts | 4 + src/models/terminal-decommission-body.ts | 4 + src/models/terminal-fetch-data.ts | 22 + .../terminal-fetch-event-status-data.ts | 2 + .../terminal-fetch-terminal-status-data.ts | 6 + src/models/terminal-list-data.ts | 2 + src/models/terminal-list-query.ts | 8 + src/models/terminal-send-event-body.ts | 10 + src/models/terminal-send-event-data.ts | 2 + src/models/terminal-update-body.ts | 6 + .../transaction-charge-authorization-body.ts | 28 + .../transaction-charge-authorization-data.ts | 36 + src/models/transaction-export-data.ts | 6 + src/models/transaction-export-query.ts | 14 + src/models/transaction-fetch-data.ts | 64 + src/models/transaction-initialize-body.ts | 39 + src/models/transaction-initialize-data.ts | 8 + src/models/transaction-list-data.ts | 2 + src/models/transaction-list-query.ts | 38 + src/models/transaction-partial-debit-body.ts | 14 + src/models/transaction-partial-debit-data.ts | 38 + src/models/transaction-timeline-data.ts | 2 + src/models/transaction-totals-data.ts | 12 + src/models/transaction-totals-query.ts | 6 + src/models/transaction-verify-data.ts | 66 + src/models/transfer-bulk-body.ts | 8 + src/models/transfer-bulk-data.ts | 2 + .../transfer-disable-otp-finalize-body.ts | 4 + src/models/transfer-export-transfer-data.ts | 2 + src/models/transfer-export-transfer-query.ts | 10 + src/models/transfer-fetch-data.ts | 46 + src/models/transfer-finalize-body.ts | 6 + src/models/transfer-finalize-data.ts | 2 + src/models/transfer-initiate-body.ts | 15 + src/models/transfer-initiate-data.ts | 42 + src/models/transfer-list-data.ts | 2 + src/models/transfer-list-query.ts | 22 + ...r-recipient-transferrecipient-bulk-body.ts | 4 + ...r-recipient-transferrecipient-bulk-data.ts | 6 + ...recipient-transferrecipient-create-body.ts | 18 + ...recipient-transferrecipient-create-data.ts | 34 + ...-recipient-transferrecipient-fetch-data.ts | 36 + ...r-recipient-transferrecipient-list-data.ts | 2 + ...-recipient-transferrecipient-list-query.ts | 14 + ...recipient-transferrecipient-update-body.ts | 6 + src/models/transfer-resend-otp-body.ts | 6 + src/models/transfer-verify-data.ts | 40 + .../virtual-terminal-add-split-code-body.ts | 4 + .../virtual-terminal-add-split-code-data.ts | 32 + src/models/virtual-terminal-create-body.ts | 10 + src/models/virtual-terminal-create-data.ts | 22 + ...virtual-terminal-delete-split-code-body.ts | 4 + ...irtual-terminal-destination-assign-body.ts | 4 + ...irtual-terminal-destination-assign-data.ts | 2 + ...tual-terminal-destination-unassign-body.ts | 4 + src/models/virtual-terminal-fetch-data.ts | 24 + src/models/virtual-terminal-list-data.ts | 2 + src/models/virtual-terminal-list-query.ts | 6 + src/models/virtual-terminal-update-body.ts | 4 + src/models/virtual-terminal-update-data.ts | 24 + src/runtime.ts | 118 - tests/api-client.test.ts | 9 + tests/apple-pay.test.ts | 78 + tests/balance.test.ts | 58 + tests/bank.test.ts | 78 + tests/bulk-charge.test.ts | 132 ++ tests/charge.test.ts | 153 ++ tests/customer.test.ts | 246 ++ tests/dedicated-virtual-account.test.ts | 189 ++ tests/direct-debit.test.ts | 59 + tests/dispute.test.ts | 170 ++ tests/integration.test.ts | 58 + tests/miscellaneous.test.ts | 76 + tests/order.test.ts | 113 + tests/page.test.ts | 133 ++ tests/payment-request.test.ts | 186 ++ tests/plan.test.ts | 96 + tests/product.test.ts | 114 + tests/refund.test.ts | 96 + tests/settlement.test.ts | 58 + tests/split.test.ts | 134 ++ tests/storefront.test.ts | 223 ++ tests/subaccount.test.ts | 96 + tests/subscription.test.ts | 151 ++ tests/terminal.test.ts | 170 ++ tests/transaction.test.ts | 189 ++ tests/transfer-recipient.test.ts | 133 ++ tests/transfer.test.ts | 226 ++ tests/virtual-terminal.test.ts | 190 ++ tsconfig.cjs.json | 7 - tsconfig.esm.json | 8 - tsconfig.json | 11 +- tsconfig.types.json | 8 - tsup.config.ts | 16 + 420 files changed, 13954 insertions(+), 12536 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/pull_request_template.md delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .openapi-generator-ignore delete mode 100644 .openapi-generator/FILES delete mode 100644 .openapi-generator/VERSION delete mode 100644 LICENSE create mode 100644 docs/applePay.md create mode 100644 docs/balance.md create mode 100644 docs/bank.md create mode 100644 docs/bulkCharge.md create mode 100644 docs/charge.md create mode 100644 docs/customer.md create mode 100644 docs/dedicatedVirtualAccount.md create mode 100644 docs/directDebit.md create mode 100644 docs/dispute.md create mode 100644 docs/integration.md create mode 100644 docs/miscellaneous.md create mode 100644 docs/order.md create mode 100644 docs/page.md create mode 100644 docs/paymentRequest.md create mode 100644 docs/plan.md create mode 100644 docs/product.md create mode 100644 docs/refund.md create mode 100644 docs/settlement.md create mode 100644 docs/split.md create mode 100644 docs/storefront.md create mode 100644 docs/subaccount.md create mode 100644 docs/subscription.md create mode 100644 docs/terminal.md create mode 100644 docs/transaction.md create mode 100644 docs/transfer.md create mode 100644 docs/transferRecipient.md create mode 100644 docs/virtualTerminal.md delete mode 100644 package-lock.json delete mode 100644 src/apis/Balance.ts delete mode 100644 src/apis/BulkCharge.ts delete mode 100644 src/apis/Charge.ts delete mode 100644 src/apis/Customer.ts delete mode 100644 src/apis/DedicatedVirtualAccount.ts delete mode 100644 src/apis/Dispute.ts delete mode 100644 src/apis/Integration.ts delete mode 100644 src/apis/Page.ts delete mode 100644 src/apis/PaymentRequest.ts delete mode 100644 src/apis/Plan.ts delete mode 100644 src/apis/Product.ts delete mode 100644 src/apis/Refund.ts delete mode 100644 src/apis/Settlement.ts delete mode 100644 src/apis/Split.ts delete mode 100644 src/apis/Subaccount.ts delete mode 100644 src/apis/Subscription.ts delete mode 100644 src/apis/Transaction.ts delete mode 100644 src/apis/Transfer.ts delete mode 100644 src/apis/TransferRecipient.ts delete mode 100644 src/apis/Verification.ts create mode 100644 src/apis/apple-pay.ts create mode 100644 src/apis/balance.ts create mode 100644 src/apis/bank.ts create mode 100644 src/apis/bulk-charge.ts create mode 100644 src/apis/charge.ts create mode 100644 src/apis/customer.ts create mode 100644 src/apis/dedicated-virtual-account.ts create mode 100644 src/apis/direct-debit.ts create mode 100644 src/apis/dispute.ts delete mode 100644 src/apis/index.ts create mode 100644 src/apis/integration.ts create mode 100644 src/apis/miscellaneous.ts create mode 100644 src/apis/order.ts create mode 100644 src/apis/page.ts create mode 100644 src/apis/payment-request.ts create mode 100644 src/apis/plan.ts create mode 100644 src/apis/product.ts create mode 100644 src/apis/refund.ts create mode 100644 src/apis/settlement.ts create mode 100644 src/apis/split.ts create mode 100644 src/apis/storefront.ts create mode 100644 src/apis/subaccount.ts create mode 100644 src/apis/subscription.ts create mode 100644 src/apis/terminal.ts create mode 100644 src/apis/transaction.ts create mode 100644 src/apis/transfer-recipient.ts create mode 100644 src/apis/transfer.ts create mode 100644 src/apis/virtual-terminal.ts create mode 100644 src/core/api-client.ts create mode 100644 src/core/errors.ts create mode 100644 src/core/types.ts delete mode 100644 src/models/Accepted.ts delete mode 100644 src/models/Bank.ts delete mode 100644 src/models/BulkChargeInitiate.ts delete mode 100644 src/models/ChargeCreate.ts delete mode 100644 src/models/ChargeSubmitAddress.ts delete mode 100644 src/models/ChargeSubmitBirthday.ts delete mode 100644 src/models/ChargeSubmitOTP.ts delete mode 100644 src/models/ChargeSubmitPhone.ts delete mode 100644 src/models/ChargeSubmitPin.ts delete mode 100644 src/models/CustomerCreate.ts delete mode 100644 src/models/CustomerDeactivateAuthorization.ts delete mode 100644 src/models/CustomerRiskAction.ts delete mode 100644 src/models/CustomerUpdate.ts delete mode 100644 src/models/CustomerValidate.ts delete mode 100644 src/models/CustomerValidation.ts delete mode 100644 src/models/DedicatedVirtualAccountCreate.ts delete mode 100644 src/models/DedicatedVirtualAccountSplit.ts delete mode 100644 src/models/DisputeEvidence.ts delete mode 100644 src/models/DisputeResolve.ts delete mode 100644 src/models/DisputeUpdate.ts delete mode 100644 src/models/EFT.ts delete mode 100644 src/models/MobileMoney.ts delete mode 100644 src/models/ModelError.ts delete mode 100644 src/models/PageCreate.ts delete mode 100644 src/models/PageProduct.ts delete mode 100644 src/models/PageUpdate.ts delete mode 100644 src/models/PaymentRequestCreate.ts delete mode 100644 src/models/PaymentRequestUpdate.ts delete mode 100644 src/models/PlanCreate.ts delete mode 100644 src/models/PlanUpdate.ts delete mode 100644 src/models/ProductCreate.ts delete mode 100644 src/models/ProductUpdate.ts delete mode 100644 src/models/RefundCreate.ts delete mode 100644 src/models/Response.ts delete mode 100644 src/models/SplitCreate.ts delete mode 100644 src/models/SplitSubaccounts.ts delete mode 100644 src/models/SplitUpdate.ts delete mode 100644 src/models/SubaccountCreate.ts delete mode 100644 src/models/SubaccountUpdate.ts delete mode 100644 src/models/SubscriptionCreate.ts delete mode 100644 src/models/SubscriptionToggle.ts delete mode 100644 src/models/TransactionChargeAuthorization.ts delete mode 100644 src/models/TransactionCheckAuthorization.ts delete mode 100644 src/models/TransactionInitialize.ts delete mode 100644 src/models/TransactionPartialDebit.ts delete mode 100644 src/models/TransferBulk.ts delete mode 100644 src/models/TransferFinalize.ts delete mode 100644 src/models/TransferFinalizeDisableOTP.ts delete mode 100644 src/models/TransferInitiate.ts delete mode 100644 src/models/TransferRecipientBulk.ts delete mode 100644 src/models/TransferRecipientCreate.ts delete mode 100644 src/models/TransferRecipientUpdate.ts delete mode 100644 src/models/TransferResendOTP.ts delete mode 100644 src/models/USSD.ts delete mode 100644 src/models/VerificationBVNMatch.ts create mode 100644 src/models/apple-pay-list-domain-data.ts create mode 100644 src/models/apple-pay-list-domain-query.ts create mode 100644 src/models/apple-pay-register-domain-body.ts create mode 100644 src/models/apple-pay-unregister-domain-body.ts create mode 100644 src/models/apple-pay-unregister-domain-data.ts create mode 100644 src/models/balance-fetch-data.ts create mode 100644 src/models/balance-ledger-data.ts create mode 100644 src/models/balance-ledger-query.ts create mode 100644 src/models/bank-list-data.ts create mode 100644 src/models/bank-list-query.ts create mode 100644 src/models/bank-resolve-account-number-data.ts create mode 100644 src/models/bank-resolve-account-number-query.ts create mode 100644 src/models/bank-validate-account-number-body.ts create mode 100644 src/models/bank-validate-account-number-data.ts create mode 100644 src/models/bulk-charge-charges-data.ts create mode 100644 src/models/bulk-charge-charges-query.ts create mode 100644 src/models/bulk-charge-fetch-data.ts create mode 100644 src/models/bulk-charge-initiate-body.ts create mode 100644 src/models/bulk-charge-initiate-data.ts create mode 100644 src/models/bulk-charge-list-data.ts create mode 100644 src/models/bulk-charge-list-query.ts create mode 100644 src/models/charge-check-data.ts create mode 100644 src/models/charge-create-body.ts create mode 100644 src/models/charge-create-data.ts create mode 100644 src/models/charge-submit-address-body.ts create mode 100644 src/models/charge-submit-address-data.ts create mode 100644 src/models/charge-submit-birthday-body.ts create mode 100644 src/models/charge-submit-birthday-data.ts create mode 100644 src/models/charge-submit-otp-body.ts create mode 100644 src/models/charge-submit-otp-data.ts create mode 100644 src/models/charge-submit-phone-body.ts create mode 100644 src/models/charge-submit-phone-data.ts create mode 100644 src/models/charge-submit-pin-body.ts create mode 100644 src/models/charge-submit-pin-data.ts create mode 100644 src/models/customer-create-body.ts create mode 100644 src/models/customer-create-data.ts create mode 100644 src/models/customer-deactivate-authorization-body.ts create mode 100644 src/models/customer-direct-debit-activation-charge-body.ts create mode 100644 src/models/customer-fetch-data.ts create mode 100644 src/models/customer-fetch-mandate-authorizations-data.ts create mode 100644 src/models/customer-initialize-authorization-body.ts create mode 100644 src/models/customer-initialize-authorization-data.ts create mode 100644 src/models/customer-initialize-direct-debit-body.ts create mode 100644 src/models/customer-initialize-direct-debit-data.ts create mode 100644 src/models/customer-list-data.ts create mode 100644 src/models/customer-list-query.ts create mode 100644 src/models/customer-risk-action-body.ts create mode 100644 src/models/customer-risk-action-data.ts create mode 100644 src/models/customer-update-body.ts create mode 100644 src/models/customer-update-data.ts create mode 100644 src/models/customer-validate-body.ts create mode 100644 src/models/customer-verify-authorization-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-add-split-body.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-add-split-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-assign-body.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-assign-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-available-providers-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-create-body.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-create-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-deactivate-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-fetch-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-list-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-list-query.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-remove-split-body.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-remove-split-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-requery-data.ts create mode 100644 src/models/dedicated-virtual-account-dedicated-account-requery-query.ts create mode 100644 src/models/direct-debit-directdebit-list-mandate-authorizations-data.ts create mode 100644 src/models/direct-debit-directdebit-list-mandate-authorizations-query.ts create mode 100644 src/models/direct-debit-directdebit-trigger-activation-charge-body.ts create mode 100644 src/models/dispute-download-data.ts create mode 100644 src/models/dispute-download-query.ts create mode 100644 src/models/dispute-evidence-body.ts create mode 100644 src/models/dispute-evidence-data.ts create mode 100644 src/models/dispute-fetch-data.ts create mode 100644 src/models/dispute-list-data.ts create mode 100644 src/models/dispute-list-query.ts create mode 100644 src/models/dispute-resolve-body.ts create mode 100644 src/models/dispute-resolve-data.ts create mode 100644 src/models/dispute-transaction-data.ts create mode 100644 src/models/dispute-update-body.ts create mode 100644 src/models/dispute-update-data.ts create mode 100644 src/models/dispute-upload-url-data.ts create mode 100644 src/models/integration-fetch-payment-session-timeout-data.ts create mode 100644 src/models/integration-update-payment-session-timeout-body.ts create mode 100644 src/models/integration-update-payment-session-timeout-data.ts create mode 100644 src/models/miscellaneous-avs-data.ts create mode 100644 src/models/miscellaneous-avs-query.ts create mode 100644 src/models/miscellaneous-list-countries-data.ts create mode 100644 src/models/miscellaneous-resolve-card-bin-data.ts create mode 100644 src/models/order-create-body.ts create mode 100644 src/models/order-create-data.ts create mode 100644 src/models/order-fetch-data.ts create mode 100644 src/models/order-list-data.ts create mode 100644 src/models/order-list-query.ts create mode 100644 src/models/order-product-data.ts create mode 100644 src/models/order-validate-data.ts create mode 100644 src/models/page-add-products-body.ts create mode 100644 src/models/page-add-products-data.ts create mode 100644 src/models/page-create-body.ts create mode 100644 src/models/page-create-data.ts create mode 100644 src/models/page-fetch-data.ts create mode 100644 src/models/page-list-data.ts create mode 100644 src/models/page-list-query.ts create mode 100644 src/models/page-update-body.ts create mode 100644 src/models/page-update-data.ts create mode 100644 src/models/payment-request-create-body.ts create mode 100644 src/models/payment-request-create-data.ts create mode 100644 src/models/payment-request-fetch-data.ts create mode 100644 src/models/payment-request-finalize-data.ts create mode 100644 src/models/payment-request-list-data.ts create mode 100644 src/models/payment-request-list-query.ts create mode 100644 src/models/payment-request-totals-data.ts create mode 100644 src/models/payment-request-update-body.ts create mode 100644 src/models/payment-request-update-data.ts create mode 100644 src/models/payment-request-verify-data.ts create mode 100644 src/models/plan-create-body.ts create mode 100644 src/models/plan-create-data.ts create mode 100644 src/models/plan-fetch-data.ts create mode 100644 src/models/plan-list-data.ts create mode 100644 src/models/plan-list-query.ts create mode 100644 src/models/plan-update-body.ts create mode 100644 src/models/product-create-body.ts create mode 100644 src/models/product-create-data.ts create mode 100644 src/models/product-fetch-data.ts create mode 100644 src/models/product-list-data.ts create mode 100644 src/models/product-list-query.ts create mode 100644 src/models/product-update-body.ts create mode 100644 src/models/product-update-data.ts create mode 100644 src/models/refund-create-body.ts create mode 100644 src/models/refund-create-data.ts create mode 100644 src/models/refund-fetch-data.ts create mode 100644 src/models/refund-list-data.ts create mode 100644 src/models/refund-list-query.ts create mode 100644 src/models/refund-retry-body.ts create mode 100644 src/models/refund-retry-data.ts create mode 100644 src/models/settlement-settlements-fetch-data.ts create mode 100644 src/models/settlement-settlements-fetch-query.ts create mode 100644 src/models/settlement-settlements-transaction-data.ts create mode 100644 src/models/split-add-subaccount-body.ts create mode 100644 src/models/split-add-subaccount-data.ts create mode 100644 src/models/split-create-body.ts create mode 100644 src/models/split-create-data.ts create mode 100644 src/models/split-fetch-data.ts create mode 100644 src/models/split-list-data.ts create mode 100644 src/models/split-list-query.ts create mode 100644 src/models/split-remove-subaccount-body.ts create mode 100644 src/models/split-update-body.ts create mode 100644 src/models/split-update-data.ts create mode 100644 src/models/storefront-add-products-body.ts create mode 100644 src/models/storefront-add-products-data.ts create mode 100644 src/models/storefront-create-body.ts create mode 100644 src/models/storefront-create-data.ts create mode 100644 src/models/storefront-duplicate-data.ts create mode 100644 src/models/storefront-fetch-data.ts create mode 100644 src/models/storefront-fetch-orders-data.ts create mode 100644 src/models/storefront-list-data.ts create mode 100644 src/models/storefront-list-products-data.ts create mode 100644 src/models/storefront-list-query.ts create mode 100644 src/models/storefront-publish-data.ts create mode 100644 src/models/storefront-update-body.ts create mode 100644 src/models/storefront-verify-slug-data.ts create mode 100644 src/models/subaccount-create-body.ts create mode 100644 src/models/subaccount-create-data.ts create mode 100644 src/models/subaccount-fetch-data.ts create mode 100644 src/models/subaccount-list-data.ts create mode 100644 src/models/subaccount-list-query.ts create mode 100644 src/models/subaccount-update-body.ts create mode 100644 src/models/subaccount-update-data.ts create mode 100644 src/models/subscription-create-body.ts create mode 100644 src/models/subscription-create-data.ts create mode 100644 src/models/subscription-disable-body.ts create mode 100644 src/models/subscription-enable-body.ts create mode 100644 src/models/subscription-enable-data.ts create mode 100644 src/models/subscription-fetch-data.ts create mode 100644 src/models/subscription-list-data.ts create mode 100644 src/models/subscription-list-query.ts create mode 100644 src/models/subscription-manage-email-data.ts create mode 100644 src/models/subscription-manage-link-data.ts create mode 100644 src/models/terminal-commission-body.ts create mode 100644 src/models/terminal-decommission-body.ts create mode 100644 src/models/terminal-fetch-data.ts create mode 100644 src/models/terminal-fetch-event-status-data.ts create mode 100644 src/models/terminal-fetch-terminal-status-data.ts create mode 100644 src/models/terminal-list-data.ts create mode 100644 src/models/terminal-list-query.ts create mode 100644 src/models/terminal-send-event-body.ts create mode 100644 src/models/terminal-send-event-data.ts create mode 100644 src/models/terminal-update-body.ts create mode 100644 src/models/transaction-charge-authorization-body.ts create mode 100644 src/models/transaction-charge-authorization-data.ts create mode 100644 src/models/transaction-export-data.ts create mode 100644 src/models/transaction-export-query.ts create mode 100644 src/models/transaction-fetch-data.ts create mode 100644 src/models/transaction-initialize-body.ts create mode 100644 src/models/transaction-initialize-data.ts create mode 100644 src/models/transaction-list-data.ts create mode 100644 src/models/transaction-list-query.ts create mode 100644 src/models/transaction-partial-debit-body.ts create mode 100644 src/models/transaction-partial-debit-data.ts create mode 100644 src/models/transaction-timeline-data.ts create mode 100644 src/models/transaction-totals-data.ts create mode 100644 src/models/transaction-totals-query.ts create mode 100644 src/models/transaction-verify-data.ts create mode 100644 src/models/transfer-bulk-body.ts create mode 100644 src/models/transfer-bulk-data.ts create mode 100644 src/models/transfer-disable-otp-finalize-body.ts create mode 100644 src/models/transfer-export-transfer-data.ts create mode 100644 src/models/transfer-export-transfer-query.ts create mode 100644 src/models/transfer-fetch-data.ts create mode 100644 src/models/transfer-finalize-body.ts create mode 100644 src/models/transfer-finalize-data.ts create mode 100644 src/models/transfer-initiate-body.ts create mode 100644 src/models/transfer-initiate-data.ts create mode 100644 src/models/transfer-list-data.ts create mode 100644 src/models/transfer-list-query.ts create mode 100644 src/models/transfer-recipient-transferrecipient-bulk-body.ts create mode 100644 src/models/transfer-recipient-transferrecipient-bulk-data.ts create mode 100644 src/models/transfer-recipient-transferrecipient-create-body.ts create mode 100644 src/models/transfer-recipient-transferrecipient-create-data.ts create mode 100644 src/models/transfer-recipient-transferrecipient-fetch-data.ts create mode 100644 src/models/transfer-recipient-transferrecipient-list-data.ts create mode 100644 src/models/transfer-recipient-transferrecipient-list-query.ts create mode 100644 src/models/transfer-recipient-transferrecipient-update-body.ts create mode 100644 src/models/transfer-resend-otp-body.ts create mode 100644 src/models/transfer-verify-data.ts create mode 100644 src/models/virtual-terminal-add-split-code-body.ts create mode 100644 src/models/virtual-terminal-add-split-code-data.ts create mode 100644 src/models/virtual-terminal-create-body.ts create mode 100644 src/models/virtual-terminal-create-data.ts create mode 100644 src/models/virtual-terminal-delete-split-code-body.ts create mode 100644 src/models/virtual-terminal-destination-assign-body.ts create mode 100644 src/models/virtual-terminal-destination-assign-data.ts create mode 100644 src/models/virtual-terminal-destination-unassign-body.ts create mode 100644 src/models/virtual-terminal-fetch-data.ts create mode 100644 src/models/virtual-terminal-list-data.ts create mode 100644 src/models/virtual-terminal-list-query.ts create mode 100644 src/models/virtual-terminal-update-body.ts create mode 100644 src/models/virtual-terminal-update-data.ts delete mode 100644 src/runtime.ts create mode 100644 tests/api-client.test.ts create mode 100644 tests/apple-pay.test.ts create mode 100644 tests/balance.test.ts create mode 100644 tests/bank.test.ts create mode 100644 tests/bulk-charge.test.ts create mode 100644 tests/charge.test.ts create mode 100644 tests/customer.test.ts create mode 100644 tests/dedicated-virtual-account.test.ts create mode 100644 tests/direct-debit.test.ts create mode 100644 tests/dispute.test.ts create mode 100644 tests/integration.test.ts create mode 100644 tests/miscellaneous.test.ts create mode 100644 tests/order.test.ts create mode 100644 tests/page.test.ts create mode 100644 tests/payment-request.test.ts create mode 100644 tests/plan.test.ts create mode 100644 tests/product.test.ts create mode 100644 tests/refund.test.ts create mode 100644 tests/settlement.test.ts create mode 100644 tests/split.test.ts create mode 100644 tests/storefront.test.ts create mode 100644 tests/subaccount.test.ts create mode 100644 tests/subscription.test.ts create mode 100644 tests/terminal.test.ts create mode 100644 tests/transaction.test.ts create mode 100644 tests/transfer-recipient.test.ts create mode 100644 tests/transfer.test.ts create mode 100644 tests/virtual-terminal.test.ts delete mode 100644 tsconfig.cjs.json delete mode 100644 tsconfig.esm.json delete mode 100644 tsconfig.types.json create mode 100644 tsup.config.ts diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c7d988c..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG] Bug name goes here" -labels: bug -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 7827f32..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "[FEAT] Feature name goes here" -labels: enhancement -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index b7330a9..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,13 +0,0 @@ -## Type of change - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] Documentation update - -## What issue does this change solve? -A clear and concise description of what the solution is. - - -# Additional context -Add any other context or screenshots about the change. \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e1f0ba4..0000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist -.DS_Store \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index b81264f..0000000 --- a/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -src/ -.openapi-generator \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES deleted file mode 100644 index 9b62513..0000000 --- a/.openapi-generator/FILES +++ /dev/null @@ -1,87 +0,0 @@ -.gitignore -.npmignore -README.md -package.json -src/apis/Balance.ts -src/apis/BulkCharge.ts -src/apis/Charge.ts -src/apis/Customer.ts -src/apis/DedicatedVirtualAccount.ts -src/apis/Dispute.ts -src/apis/Integration.ts -src/apis/Page.ts -src/apis/PaymentRequest.ts -src/apis/Plan.ts -src/apis/Product.ts -src/apis/Refund.ts -src/apis/Settlement.ts -src/apis/Split.ts -src/apis/Subaccount.ts -src/apis/Subscription.ts -src/apis/Transaction.ts -src/apis/Transfer.ts -src/apis/TransferRecipient.ts -src/apis/Verification.ts -src/apis/index.ts -src/index.ts -src/models/Accepted.ts -src/models/Bank.ts -src/models/BulkChargeInitiate.ts -src/models/ChargeCreate.ts -src/models/ChargeSubmitAddress.ts -src/models/ChargeSubmitBirthday.ts -src/models/ChargeSubmitOTP.ts -src/models/ChargeSubmitPhone.ts -src/models/ChargeSubmitPin.ts -src/models/CustomerCreate.ts -src/models/CustomerDeactivateAuthorization.ts -src/models/CustomerRiskAction.ts -src/models/CustomerUpdate.ts -src/models/CustomerValidate.ts -src/models/CustomerValidation.ts -src/models/DedicatedVirtualAccountCreate.ts -src/models/DedicatedVirtualAccountSplit.ts -src/models/DisputeEvidence.ts -src/models/DisputeResolve.ts -src/models/DisputeUpdate.ts -src/models/EFT.ts -src/models/MobileMoney.ts -src/models/ModelError.ts -src/models/PageCreate.ts -src/models/PageProduct.ts -src/models/PageUpdate.ts -src/models/PaymentRequestCreate.ts -src/models/PaymentRequestUpdate.ts -src/models/PlanCreate.ts -src/models/PlanUpdate.ts -src/models/ProductCreate.ts -src/models/ProductUpdate.ts -src/models/RefundCreate.ts -src/models/Response.ts -src/models/SplitCreate.ts -src/models/SplitSubaccounts.ts -src/models/SplitUpdate.ts -src/models/SubaccountCreate.ts -src/models/SubaccountUpdate.ts -src/models/SubscriptionCreate.ts -src/models/SubscriptionToggle.ts -src/models/TransactionChargeAuthorization.ts -src/models/TransactionCheckAuthorization.ts -src/models/TransactionInitialize.ts -src/models/TransactionPartialDebit.ts -src/models/TransferBulk.ts -src/models/TransferFinalize.ts -src/models/TransferFinalizeDisableOTP.ts -src/models/TransferInitiate.ts -src/models/TransferRecipientBulk.ts -src/models/TransferRecipientCreate.ts -src/models/TransferRecipientUpdate.ts -src/models/TransferResendOTP.ts -src/models/USSD.ts -src/models/VerificationBVNMatch.ts -src/models/index.ts -src/runtime.ts -tsconfig.cjs.json -tsconfig.esm.json -tsconfig.json -tsconfig.types.json diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION deleted file mode 100644 index 8044406..0000000 --- a/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.2.1 \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 5d7ee64..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 PaystackOSS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 179e2df..fd78877 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,228 @@ -## Paystack Node Library +# Paystack Node.js SDK -A Node client library for consuming the Paystack API +> The official Node.js SDK for the Paystack API: fully typed, dual ESM/CJS, zero dependencies. -## Prerequisite -Your need to [create a Paystack account](https://dashboard.paystack.com/#/signup), if you don't have one already, to get your test and -live secret keys. +[![npm version](https://img.shields.io/npm/v/@paystack/paystack-sdk)](https://www.npmjs.com/package/@paystack/paystack-sdk) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Node.js ≥ 18](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org) + +--- + +## Requirements + +- **Node.js 18 or later** - the SDK uses the native `fetch` API available since Node 18 +- No additional runtime dependencies + +--- ## Installation + +```bash +npm install @paystack/paystack-sdk +# or +pnpm add @paystack/paystack-sdk ``` -npm install @paystack/paystack-sdk --save + +--- + +## Quick Start + +#### ESM + TypeScript + +```ts +import { Paystack } from "@paystack/paystack-sdk"; + +const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! }); + +const result = await paystack.transaction.initialize({ + amount: 100_000, // kobo + email: "customer@example.com", +}); + +console.log(result.data.authorization_url); ``` -## Usage -Import and initialize the library: -```javascript -const { Paystack } = require('@paystack/paystack-sdk') -const paystack = new Paystack("sk_test_xxxxxx") +#### ESM + JavaScript -paystack.transaction.initialize({email: "test@example.com", amount: 20000}) - .then(response => console.log(response)) - .catch(error => console.log(error)) +```js +import { Paystack } from "@paystack/paystack-sdk"; + +const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY }); + +const result = await paystack.transaction.initialize({ + amount: 100_000, + email: "customer@example.com", +}); + +console.log(result.data.authorization_url); ``` -Import and initialize the library using ES module with `async/await`: -```javascript -import { Paystack } from '@paystack/paystack-sdk' -const paystack = new Paystack("sk_test_xxxxxx") +#### CJS + TypeScript -const initialize = async(email, amount) => { - const response = await paystack.transaction.initialize({ - email, - amount - }) +```ts +// TypeScript with "module": "CommonJS" - tsc compiles import to require() +import { Paystack } from "@paystack/paystack-sdk"; - console.log(response) -} +const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! }); -const email = 'test@example.com' -const amount = 2000 -initialize(email, amount) +const result = await paystack.transaction.initialize({ + amount: 100_000, + email: "customer@example.com", +}); + +console.log(result.data.authorization_url); ``` -### Typescript -```typescript -import { Paystack } from '@paystack/paystack-sdk'; -const paystack = new Paystack("sk_test_xxxxxx"); +#### CJS + JavaScript -const initialize = async(email, amount) => { - const response = await paystack.transaction.initialize({ - email, - amount - }); +```js +const { Paystack } = require("@paystack/paystack-sdk"); + +const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY }); + +paystack.transaction + .initialize({ amount: 100_000, email: "customer@example.com" }) + .then((result) => console.log(result.data.authorization_url)); +``` + +--- + +## Configuration + +Pass options to the `Paystack` constructor: - console.log(response); +```ts +const paystack = new Paystack({ + secretKey: "sk_live_xxxxxxxxxxxx", // required +}); +``` + +| Option | Type | Required | Default | +|---|---|---|---| +| `secretKey` | `string` | ✅ | N/A | + +--- + +## Typed Responses + +Every method returns `Promise>`, mirroring the Paystack API envelope: + +```ts +interface ApiResponse { + status: boolean; + message: string; + data: T; // fully typed per endpoint } +``` -const email = 'test@example.com'; -const amount = 2000; -initialize(email, amount); +The `data` field is typed to the exact response shape for each endpoint: + +```ts +const { data } = await paystack.transaction.initialize({ amount: 100_000, email: "..." }); +// ^? TransactionInitializeData - { authorization_url, access_code, reference } +``` + +Import model types directly when you need them explicitly: + +```ts +import type { TransactionInitializeBody, TransactionInitializeData } from "@paystack/paystack-sdk/models"; +``` + +--- + +## Typed Query Parameters + +List and filter endpoints accept a strongly-typed query object instead of a generic record: + +```ts +import type { TransactionListQuery } from "@paystack/paystack-sdk/models"; + +const query: TransactionListQuery = { + per_page: 20, + page: 1, + status: "success", // "success" | "failed" | "abandoned" | "reversed" + from: "2024-01-01", + to: "2024-12-31", +}; + +const transactions = await paystack.transaction.list(query); ``` -## Issues -Kindly [open an issue](https://github.com/PaystackOSS/paystack-node/issues) if you discover any bug or have problems using this library. +--- + +## Error Handling + +Failed API calls throw an `ApiError` with the HTTP status, status text, and the parsed response body: + +```ts +import { Paystack, ApiError } from "@paystack/paystack-sdk"; + +try { + const result = await paystack.transaction.initialize({ + amount: 100_000, + email: "customer@example.com", + }); +} catch (err) { + if (err instanceof ApiError) { + console.error(err.status); // HTTP status code, e.g. 400 + console.error(err.statusText); // e.g. "Bad Request" + console.error(err.payload); // parsed JSON response body + } +} +``` + +Requests that exceed the SDK timeout throw a native `DOMException` with `name: "AbortError"`. + +--- + +## API Reference + +The SDK exposes one property per API resource on the `Paystack` instance. + +| Resource | Property | Description | Methods | +|---|---|---|---| +| [TransactionApi](./docs/transaction.md) | `paystack.transaction` | A collection of endpoints for managing payments | 9 | +| [ChargeApi](./docs/charge.md) | `paystack.charge` | A collection of endpoints for configuring and managing the payment channels when initiating a payment | 7 | +| [BulkChargeApi](./docs/bulkCharge.md) | `paystack.bulkCharge` | A collection of endpoints for creating and managing multiple recurring payments | 6 | +| [SubaccountApi](./docs/subaccount.md) | `paystack.subaccount` | A collection of endpoints for creating and managing accounts for sharing a transaction with | 4 | +| [SplitApi](./docs/split.md) | `paystack.split` | A collection of endpoints for spliting a transaction and managing the splits | 6 | +| [TerminalApi](./docs/terminal.md) | `paystack.terminal` | A collection of endpoints for building delightful in-person payment experiences | 8 | +| [VirtualTerminalApi](./docs/virtualTerminal.md) | `paystack.virtualTerminal` | A collection of endpoints for building in-person payments without a physical terminal | 9 | +| [CustomerApi](./docs/customer.md) | `paystack.customer` | A collection of endpoints for creating and managing customers on an integration | 12 | +| [DirectDebitApi](./docs/directDebit.md) | `paystack.directDebit` | A collection of endpoints for managing Direct Debit | 2 | +| [DedicatedVirtualAccountApi](./docs/dedicatedVirtualAccount.md) | `paystack.dedicatedVirtualAccount` | A collection of endpoints for creating and managing payment accounts for customers | 9 | +| [ApplePayApi](./docs/applePay.md) | `paystack.applePay` | A collection of endpoints for managing application's top-level domain or subdomain accepting payment via Apple Pay | 3 | +| [PlanApi](./docs/plan.md) | `paystack.plan` | A collection of endpoints for creating and managing recurring payment configuration | 4 | +| [SubscriptionApi](./docs/subscription.md) | `paystack.subscription` | A collection of endpoints for creating and managing recurring payments | 7 | +| [TransferRecipientApi](./docs/transferRecipient.md) | `paystack.transferRecipient` | A collection of endpoints for creating and managing beneficiaries that you send money to | 6 | +| [TransferApi](./docs/transfer.md) | `paystack.transfer` | A collection of endpoints for automating sending money to beneficiaries | 11 | +| [BalanceApi](./docs/balance.md) | `paystack.balance` | A collection of endpoints gaining insights into the amount on an integration | 2 | +| [PaymentRequestApi](./docs/paymentRequest.md) | `paystack.paymentRequest` | A collection of endpoints for managing invoices for the payment of goods and services | 9 | +| [ProductApi](./docs/product.md) | `paystack.product` | A collection of endpoints for creating and managing inventories | 5 | +| [StorefrontApi](./docs/storefront.md) | `paystack.storefront` | A collection of endpoints for creating and managing storefronts | 11 | +| [OrderApi](./docs/order.md) | `paystack.order` | A collection of endpoints for creating and managing orders | 5 | +| [PageApi](./docs/page.md) | `paystack.page` | A collection of endpoints for creating and managing links for the collection of payment for products | 6 | +| [SettlementApi](./docs/settlement.md) | `paystack.settlement` | A collection of endpoints for gaining insights into payouts | 2 | +| [IntegrationApi](./docs/integration.md) | `paystack.integration` | A collection of endpoints for managing some settings on an integration | 2 | +| [RefundApi](./docs/refund.md) | `paystack.refund` | A collection of endpoints for creating and managing transaction reimbursement | 4 | +| [DisputeApi](./docs/dispute.md) | `paystack.dispute` | A collection of endpoints for managing transactions complaint made by customers | 8 | +| [BankApi](./docs/bank.md) | `paystack.bank` | A collection of endpoints for managing bank details | 3 | +| [MiscellaneousApi](./docs/miscellaneous.md) | `paystack.miscellaneous` | A collection of endpoints that provides utility functions | 3 | + +Detailed method signatures, parameters, and response types for each resource are documented in [`docs/`](./docs/). + +--- + +## Contributing + +> ⚠️ **This SDK is auto-generated** from the Paystack OpenAPI specification. Do not edit files in `src/` directly - they will be overwritten on the next generation run. + +To propose a change to an API method, request body, response type, or query parameter, open an issue or pull request against the [Paystack OpenAPI specification](https://github.com/PaystackOSS/openapi). + +Bug reports and documentation improvements for this SDK are welcome via [GitHub Issues](../../issues). + +--- ## License -This repository is made available under the MIT license. Kindly read the [LICENSE](https://github.com/PaystackOSS/paystack-node/blob/main/LICENSE) file for more information. + +MIT © Paystack diff --git a/docs/applePay.md b/docs/applePay.md new file mode 100644 index 0000000..289bc4b --- /dev/null +++ b/docs/applePay.md @@ -0,0 +1,78 @@ +# ApplePayApi + +A collection of endpoints for managing application's top-level domain or subdomain accepting payment via Apple Pay + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `listDomain` | `GET` | `/apple-pay/domain` | Lists all registered domains on your integration. Returns an empty array if no domains have been added. | +| `registerDomain` | `POST` | `/apple-pay/domain` | Register a top-level domain or subdomain for your Apple Pay integration. > This endpoint can only be called with one domain or subdomain at a time. | +| `unregisterDomain` | `DELETE` | `/apple-pay/domain` | Unregister a top-level domain or subdomain previously used for your Apple Pay integration. | + +--- + +## `listDomain` + +Lists all registered domains on your integration. Returns an empty array if no domains have been added. + +```ts +async listDomain(query?: ApplePayListDomainQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | + +### Example + +```ts +const result = await paystack.applePay.listDomain({ /* query params */ }); +console.log(result.data); +``` + +## `registerDomain` + +Register a top-level domain or subdomain for your Apple Pay integration. > This endpoint can only be called with one domain or subdomain at a time. + +```ts +async registerDomain(payload: ApplePayRegisterDomainBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `domainName` | `string` | true | The domain or subdomain for your application | + +### Example + +```ts +const result = await paystack.applePay.registerDomain({ domainName: "domainName_value" }); +console.log(result.data); +``` + +## `unregisterDomain` + +Unregister a top-level domain or subdomain previously used for your Apple Pay integration. + +```ts +async unregisterDomain(payload: ApplePayUnregisterDomainBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `domainName` | `string` | true | The domain or subdomain for your application | + +### Example + +```ts +const result = await paystack.applePay.unregisterDomain({ domainName: "domainName_value" }); +console.log(result.data); +``` diff --git a/docs/balance.md b/docs/balance.md new file mode 100644 index 0000000..5e0bdab --- /dev/null +++ b/docs/balance.md @@ -0,0 +1,51 @@ +# BalanceApi + +A collection of endpoints gaining insights into the amount on an integration + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `fetch` | `GET` | `/balance` | Fetch the available balance on your integration | +| `ledger` | `GET` | `/balance/ledger` | Fetch all pay-ins and pay-outs that occured on your integration | + +--- + +## `fetch` + +Fetch the available balance on your integration + +```ts +async fetch(): Promise>; +``` + +### Example + +```ts +const result = await paystack.balance.fetch(); +console.log(result.data); +``` + +## `ledger` + +Fetch all pay-ins and pay-outs that occured on your integration + +```ts +async ledger(query?: BalanceLedgerQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.balance.ledger({ /* query params */ }); +console.log(result.data); +``` diff --git a/docs/bank.md b/docs/bank.md new file mode 100644 index 0000000..0b78580 --- /dev/null +++ b/docs/bank.md @@ -0,0 +1,95 @@ +# BankApi + +A collection of endpoints for managing bank details + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/bank` | List banks supported on Paystack | +| `resolveAccountNumber` | `GET` | `/bank/resolve` | Resolve an account number to confirm the name associated with it | +| `validateAccountNumber` | `POST` | `/bank/validate` | Confirm the authenticity of a customer's account number before sending money | + +--- + +## `list` + +List banks supported on Paystack + +```ts +async list(query?: BankListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `country` | `string` | false | The country from which to obtain the list of supported banks | +| `currency` | `string` | false | The country from which to obtain the list of supported banks | +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `perPage` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | +| `pay_with_bank_transfer` | `boolean` | false | A flag to filter for available banks a customer can make a transfer to complete a payment | +| `pay_with_bank` | `boolean` | false | A flag to filter for banks a customer can pay directly from | +| `enabled_for_verification` | `boolean` | false | A flag to filter the banks that are supported for account verification in South Africa. You need to combine this with either the `currency` or `country` filter. | +| `gateway` | `string` | false | The type of gateway for a Nigerian bank | +| `type` | `string` | false | Type of financial channel | +| `include_nip_sort_code` | `boolean` | false | A flag that returns Nigerian banks with their NIP institution code. The returned value can be used in identifying institutions on NIP. | + +### Example + +```ts +const result = await paystack.bank.list({ /* query params */ }); +console.log(result.data); +``` + +## `resolveAccountNumber` + +Resolve an account number to confirm the name associated with it + +```ts +async resolveAccountNumber(query?: BankResolveAccountNumberQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `account_number` | `integer` | false | The account number of interest | +| `bank_code` | `integer` | false | The bank code associated with the account number | + +### Example + +```ts +const result = await paystack.bank.resolveAccountNumber({ /* query params */ }); +console.log(result.data); +``` + +## `validateAccountNumber` + +Confirm the authenticity of a customer's account number before sending money + +```ts +async validateAccountNumber(payload: BankValidateAccountNumberBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `account_name` | `string` | true | Customer's first and last name registered with their bank | +| `account_number` | `string` | true | Customer's account number | +| `account_type` | `"personal" \| "business"` | true | The type of the customer's account number | +| `bank_code` | `string` | true | The bank code of the customer’s bank. You can fetch the bank codes by using our List Banks endpoint | +| `country_code` | `string` | true | The two digit ISO code of the customer’s bank | +| `document_type` | `"identityNumber" \| "passportNumber" \| "businessRegistrationNumber"` | true | Customer’s mode of identity | +| `document_number` | `string` | false | Customer’s mode of identity number | + +### Example + +```ts +const result = await paystack.bank.validateAccountNumber({ account_name: "account_name_value", account_number: "account_number_value", account_type: "personal", document_number: "document_number_value" }); +console.log(result.data); +``` diff --git a/docs/bulkCharge.md b/docs/bulkCharge.md new file mode 100644 index 0000000..9c46025 --- /dev/null +++ b/docs/bulkCharge.md @@ -0,0 +1,147 @@ +# BulkChargeApi + +A collection of endpoints for creating and managing multiple recurring payments + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/bulkcharge` | List all bulk charge batches. | +| `initiate` | `POST` | `/bulkcharge` | Charge multiple customers in batches | +| `fetch` | `GET` | `/bulkcharge/{code}` | This endpoint retrieves a specific batch code. It also returns useful information on its progress by way of the `total_charges` and `pending_charges` attributes. | +| `charges` | `GET` | `/bulkcharge/{code}/charges` | This endpoint retrieves the charges associated with a specified batch code | +| `pause` | `GET` | `/bulkcharge/pause/{code}` | Pause the processing of a charge batch | +| `resume` | `GET` | `/bulkcharge/resume/{code}` | Resume the processing of a previously paused charge batch | + +--- + +## `list` + +List all bulk charge batches. + +```ts +async list(query?: BulkChargeListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The offset to retrieve data from | +| `status` | `string` | false | Filter by the status of the charges | + +### Example + +```ts +const result = await paystack.bulkCharge.list({ /* query params */ }); +console.log(result.data); +``` + +## `initiate` + +Charge multiple customers in batches + +```ts +async initiate(payload: BulkChargeInitiateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `body` | `Array<{ authorization: string; amount: number; reference?: string; attempt_partial_debit?: boolean; at_least?: number; metadata?: Record }>` | true | | + +### Example + +```ts +const result = await paystack.bulkCharge.initiate({ body: [] }); +console.log(result.data); +``` + +## `fetch` + +This endpoint retrieves a specific batch code. It also returns useful information on its progress by way of the `total_charges` and `pending_charges` attributes. + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The code for the charge whose batches you want to retrieve | + +### Example + +```ts +const result = await paystack.bulkCharge.fetch(code); +console.log(result.data); +``` + +## `charges` + +This endpoint retrieves the charges associated with a specified batch code + +```ts +async charges(code: string, query?: BulkChargeChargesQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | An code for the batch whose charges you want to retrieve | +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The offset to retrieve data from | +| `status` | `string` | false | Filter by the status of the charges | + +### Example + +```ts +const result = await paystack.bulkCharge.charges(code, { /* query params */ }); +console.log(result.data); +``` + +## `pause` + +Pause the processing of a charge batch + +```ts +async pause(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The batch code for the bulk charge you want to pause | + +### Example + +```ts +const result = await paystack.bulkCharge.pause(code); +console.log(result.data); +``` + +## `resume` + +Resume the processing of a previously paused charge batch + +```ts +async resume(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The batch code for the bulk charge you want to pause | + +### Example + +```ts +const result = await paystack.bulkCharge.resume(code); +console.log(result.data); +``` diff --git a/docs/charge.md b/docs/charge.md new file mode 100644 index 0000000..6e8c20c --- /dev/null +++ b/docs/charge.md @@ -0,0 +1,183 @@ +# ChargeApi + +A collection of endpoints for configuring and managing the payment channels when initiating a payment + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `create` | `POST` | `/charge` | Initiate a payment by integrating the payment channel of your choice. | +| `submitPin` | `POST` | `/charge/submit_pin` | Submit PIN to continue a charge | +| `submitOtp` | `POST` | `/charge/submit_otp` | Submit OTP to complete a charge | +| `submitPhone` | `POST` | `/charge/submit_phone` | Submit phone number when requested | +| `submitBirthday` | `POST` | `/charge/submit_birthday` | Submit the customer's birthday when requested | +| `submitAddress` | `POST` | `/charge/submit_address` | Send the details of the customer's address for address verification | +| `check` | `GET` | `/charge/{reference}` | When you get `pending` as a charge status or if there was an exception when calling any of the `/charge` endpoints, wait 10 seconds or more, then make a check to see if its status has changed. Don't call too early as you may get a lot more pending than you should. | + +--- + +## `create` + +Initiate a payment by integrating the payment channel of your choice. + +```ts +async create(payload: ChargeCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `amount` | `number` | true | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `authorization_code` | `string` | false | An authorization code to charge. | +| `pin` | `string` | false | 4-digit PIN (send with a non-reusable authorization code) | +| `reference` | `string` | false | Unique transaction reference. Only -, .`, = and alphanumeric characters allowed. | +| `birthday` | `string` | false | The customer's birthday in the format YYYY-MM-DD e.g 2017-05-16 | +| `device_id` | `string` | false | This is the unique identifier of the device a user uses in making payment. Only -, .`, = and alphanumeric characters are allowed. | +| `metadata` | `Record` | false | JSON object of custom data | +| `bank` | `{ code?: string; account_number?: string }` | false | The bank object if charging a bank account | +| `mobile_money` | `{ phone?: string; provider?: string }` | false | Details of the mobile service provider | +| `ussd` | `{ type?: "737" \| "919" \| "822" \| "966" }` | false | The USSD code for the provider to charge | +| `eft` | `{ provider?: string }` | false | Details of the EFT provider | + +### Example + +```ts +const result = await paystack.charge.create({ email: "email_value", amount: 0, authorization_code: "authorization_code_value" }); +console.log(result.data); +``` + +## `submitPin` + +Submit PIN to continue a charge + +```ts +async submitPin(payload: ChargeSubmitPinBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `pin` | `string` | true | Customer's PIN for the ongoing transaction | +| `reference` | `string` | true | Transaction reference that requires the PIN | + +### Example + +```ts +const result = await paystack.charge.submitPin({ pin: "pin_value", reference: "reference_value" }); +console.log(result.data); +``` + +## `submitOtp` + +Submit OTP to complete a charge + +```ts +async submitOtp(payload: ChargeSubmitOtpBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `otp` | `string` | true | Customer's OTP for ongoing transaction | +| `reference` | `string` | true | The reference of the ongoing transaction | + +### Example + +```ts +const result = await paystack.charge.submitOtp({ otp: "otp_value", reference: "reference_value" }); +console.log(result.data); +``` + +## `submitPhone` + +Submit phone number when requested + +```ts +async submitPhone(payload: ChargeSubmitPhoneBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `phone` | `string` | true | Customer's mobile number | +| `reference` | `string` | true | The reference of the ongoing transaction | + +### Example + +```ts +const result = await paystack.charge.submitPhone({ phone: "phone_value", reference: "reference_value" }); +console.log(result.data); +``` + +## `submitBirthday` + +Submit the customer's birthday when requested + +```ts +async submitBirthday(payload: ChargeSubmitBirthdayBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `birthday` | `string` | true | Customer's birthday in the format YYYY-MM-DD e.g 2016-09-21 | +| `reference` | `string` | true | The reference of the ongoing transaction | + +### Example + +```ts +const result = await paystack.charge.submitBirthday({ birthday: "birthday_value", reference: "reference_value" }); +console.log(result.data); +``` + +## `submitAddress` + +Send the details of the customer's address for address verification + +```ts +async submitAddress(payload: ChargeSubmitAddressBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `address` | `string` | true | Customer's address | +| `city` | `string` | true | Customer's city | +| `state` | `string` | true | Customer's state | +| `zip_code` | `string` | true | Customer's zipcode | +| `reference` | `string` | true | The reference of the ongoing transaction | + +### Example + +```ts +const result = await paystack.charge.submitAddress({ address: "address_value", city: "city_value", state: "state_value" }); +console.log(result.data); +``` + +## `check` + +When you get `pending` as a charge status or if there was an exception when calling any of the `/charge` endpoints, wait 10 seconds or more, then make a check to see if its status has changed. Don't call too early as you may get a lot more pending than you should. + +```ts +async check(reference: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `reference` | `string` | true | The reference of the ongoing transaction | + +### Example + +```ts +const result = await paystack.charge.check(reference); +console.log(result.data); +``` diff --git a/docs/customer.md b/docs/customer.md new file mode 100644 index 0000000..01121a9 --- /dev/null +++ b/docs/customer.md @@ -0,0 +1,305 @@ +# CustomerApi + +A collection of endpoints for creating and managing customers on an integration + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/customer` | List customers on your integration | +| `create` | `POST` | `/customer` | Create a customer on your integration | +| `fetch` | `GET` | `/customer/{code}` | Get details of a customer on your integration. | +| `update` | `PUT` | `/customer/{code}` | Update a customer's details on your integration | +| `riskAction` | `POST` | `/customer/set_risk_action` | Set customer's risk action by whitelisting or blacklisting the customer | +| `validate` | `POST` | `/customer/{code}/identification` | Validate a customer's identity | +| `initializeAuthorization` | `POST` | `/customer/authorization/initialize` | Initiate a request to create a reusable authorization code for recurring transactions | +| `verifyAuthorization` | `GET` | `/customer/authorization/verify/{reference}` | Check the status of an authorization request | +| `deactivateAuthorization` | `POST` | `/customer/authorization/deactivate` | Deactivate an authorization for any payment channel. | +| `initializeDirectDebit` | `POST` | `/customer/{id}/initialize-direct-debit` | Initialize the process of linking an account to a customer for Direct Debit transactions | +| `directDebitActivationCharge` | `PUT` | `/customer/{id}/directdebit-activation-charge` | Trigger an activation charge on an inactive mandate on behalf of your customer | +| `fetchMandateAuthorizations` | `GET` | `/customer/{id}/directdebit-mandate-authorizations` | Get the list of direct debit mandates associated with a customer | + +--- + +## `list` + +List customers on your integration + +```ts +async list(query?: CustomerListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | +| `perPage` | `string` | false | The number of records to fetch per request | +| `page` | `string` | false | The offset to retrieve data from | + +### Example + +```ts +const result = await paystack.customer.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a customer on your integration + +```ts +async create(payload: CustomerCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `first_name` | `string` | false | Customer's first name | +| `last_name` | `string` | false | Customer's last name | +| `phone` | `string` | false | Customer's phone number | +| `metadata` | `string` | false | Stringified JSON object of custom data | + +### Example + +```ts +const result = await paystack.customer.create({ email: "email_value", first_name: "first_name_value" }); +console.log(result.data); +``` + +## `fetch` + +Get details of a customer on your integration. + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The code for the customer gotten from the response of the customer creation | + +### Example + +```ts +const result = await paystack.customer.fetch(code); +console.log(result.data); +``` + +## `update` + +Update a customer's details on your integration + +```ts +async update(code: string, payload: CustomerUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The code for the customer gotten from the response of the customer creation | +| `first_name` | `string` | false | Customer's first name | +| `last_name` | `string` | false | Customer's last name | +| `phone` | `string` | false | Customer's phone number | +| `metadata` | `string` | false | Stringified JSON object of custom data | + +### Example + +```ts +const result = await paystack.customer.update(code, { first_name: "first_name_value" }); +console.log(result.data); +``` + +## `riskAction` + +Set customer's risk action by whitelisting or blacklisting the customer + +```ts +async riskAction(payload: CustomerRiskActionBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `customer` | `string` | true | The customer code from the response of the customer creation | +| `risk_action` | `"allow" \| "deny" \| "default"` | false | This determines the fraud rules that should be applied to the customer | + +### Example + +```ts +const result = await paystack.customer.riskAction({ customer: "customer_value", risk_action: "allow" }); +console.log(result.data); +``` + +## `validate` + +Validate a customer's identity + +```ts +async validate(code: string, payload: CustomerValidateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The code for the customer gotten from the response of the customer creation | +| `first_name` | `string` | true | Customer's first name | +| `middle_name` | `string` | false | Customer's middle name | +| `last_name` | `string` | true | Customer's last name | +| `type` | `string` | true | Predefined types of identification. | +| `value` | `string` | false | Customer's identification number. | +| `country` | `string` | true | Two-letter country code of identification issuer | +| `bvn` | `string` | true | Customer's Bank Verification Number | +| `bank_code` | `string` | true | You can get the list of bank codes by calling the List Banks endpoint (https://api.paystack.co/bank). | +| `account_number` | `string` | true | Customer's bank account number. | + +### Example + +```ts +const result = await paystack.customer.validate(code, { first_name: "first_name_value", last_name: "last_name_value", type: "type_value", middle_name: "middle_name_value" }); +console.log(result.data); +``` + +## `initializeAuthorization` + +Initiate a request to create a reusable authorization code for recurring transactions + +```ts +async initializeAuthorization(payload: CustomerInitializeAuthorizationBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `channel` | `"direct_debit"` | true | direct_debit is the only supported option for now | +| `callback_url` | `string` | false | Fully qualified url (e.g. https://example.com/) to redirect your customer to | +| `account` | `{ number: string; bank_code: string }` | false | | +| `address` | `{ street: string; city: string; state: string }` | false | | + +### Example + +```ts +const result = await paystack.customer.initializeAuthorization({ email: "email_value", channel: "direct_debit", callback_url: "callback_url_value" }); +console.log(result.data); +``` + +## `verifyAuthorization` + +Check the status of an authorization request + +```ts +async verifyAuthorization(reference: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `reference` | `string` | true | The reference returned in the initialization response | + +### Example + +```ts +const result = await paystack.customer.verifyAuthorization(reference); +console.log(result.data); +``` + +## `deactivateAuthorization` + +Deactivate an authorization for any payment channel. + +```ts +async deactivateAuthorization(payload: CustomerDeactivateAuthorizationBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `authorization_code` | `string` | true | Authorization code to be deactivated | + +### Example + +```ts +const result = await paystack.customer.deactivateAuthorization({ authorization_code: "authorization_code_value" }); +console.log(result.data); +``` + +## `initializeDirectDebit` + +Initialize the process of linking an account to a customer for Direct Debit transactions + +```ts +async initializeDirectDebit(id: string, payload: CustomerInitializeDirectDebitBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the customer to initialize the direct debit for | +| `account` | `{ number: string; bank_code: string }` | true | | +| `address` | `{ street: string; city: string; state: string }` | true | | + +### Example + +```ts +const result = await paystack.customer.initializeDirectDebit(id, { account: {}, address: {} }); +console.log(result.data); +``` + +## `directDebitActivationCharge` + +Trigger an activation charge on an inactive mandate on behalf of your customer + +```ts +async directDebitActivationCharge(id: string, payload: CustomerDirectDebitActivationChargeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The customer ID attached to the authorization | +| `authorization_id` | `number` | true | The authorization ID gotten from the initiation response | + +### Example + +```ts +const result = await paystack.customer.directDebitActivationCharge(id, { authorization_id: 0 }); +console.log(result.data); +``` + +## `fetchMandateAuthorizations` + +Get the list of direct debit mandates associated with a customer + +```ts +async fetchMandateAuthorizations(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The customer ID for the authorizations to fetch | + +### Example + +```ts +const result = await paystack.customer.fetchMandateAuthorizations(id); +console.log(result.data); +``` diff --git a/docs/dedicatedVirtualAccount.md b/docs/dedicatedVirtualAccount.md new file mode 100644 index 0000000..1423dcd --- /dev/null +++ b/docs/dedicatedVirtualAccount.md @@ -0,0 +1,225 @@ +# DedicatedVirtualAccountApi + +A collection of endpoints for creating and managing payment accounts for customers + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `dedicatedAccountList` | `GET` | `/dedicated_account` | List dedicated virtual accounts available on your integration. | +| `dedicatedAccountCreate` | `POST` | `/dedicated_account` | Create a dedicated virtual account for an existing customer | +| `dedicatedAccountAssign` | `POST` | `/dedicated_account/assign` | With this endpoint, you can create a customer, validate the customer, and assign a DVA to the customer. | +| `dedicatedAccountFetch` | `GET` | `/dedicated_account/{id}` | Get details of a dedicated virtual account on your integration. | +| `dedicatedAccountDeactivate` | `DELETE` | `/dedicated_account/{id}` | Deactivate a dedicated virtual account on your integration. | +| `dedicatedAccountRequery` | `GET` | `/dedicated_account/requery` | Requery Dedicated Virtual Account for new transactions | +| `dedicatedAccountAddSplit` | `POST` | `/dedicated_account/split` | Split a dedicated virtual account transaction with one or more accounts | +| `dedicatedAccountRemoveSplit` | `DELETE` | `/dedicated_account/split` | If you've previously set up split payment for transactions on a dedicated virtual account, you can remove it with this endpoint | +| `dedicatedAccountAvailableProviders` | `GET` | `/dedicated_account/available_providers` | Get available bank providers for a dedicated virtual account | + +--- + +## `dedicatedAccountList` + +List dedicated virtual accounts available on your integration. + +```ts +async dedicatedAccountList(query?: DedicatedVirtualAccountDedicatedAccountListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `active` | `boolean` | false | Status of the dedicated virtual account | +| `customer` | `integer` | false | The customer's ID | +| `currency` | `string` | false | The currency of the dedicated virtual account | +| `provider_slug` | `string` | false | The bank's slug in lowercase, without spaces | +| `bank_id` | `string` | false | The bank's ID | +| `perPage` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountList({ /* query params */ }); +console.log(result.data); +``` + +## `dedicatedAccountCreate` + +Create a dedicated virtual account for an existing customer + +```ts +async dedicatedAccountCreate(payload: DedicatedVirtualAccountDedicatedAccountCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `customer` | `string` | true | The code for the previously created customer | +| `preferred_bank` | `string` | false | The bank slug for preferred bank. To get a list of available banks, use the List Providers endpoint | +| `subaccount` | `string` | false | Subaccount code of the account you want to split the transaction with | +| `split_code` | `string` | false | Split code consisting of the lists of accounts you want to split the transaction with | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountCreate({ customer: "customer_value", preferred_bank: "preferred_bank_value" }); +console.log(result.data); +``` + +## `dedicatedAccountAssign` + +With this endpoint, you can create a customer, validate the customer, and assign a DVA to the customer. + +```ts +async dedicatedAccountAssign(payload: DedicatedVirtualAccountDedicatedAccountAssignBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `first_name` | `string` | true | Customer's first name | +| `last_name` | `string` | true | Customer's last name | +| `phone` | `string` | true | Customer's phone name | +| `preferred_bank` | `string` | true | The bank slug for preferred bank. To get a list of available banks, use the List Banks endpoint, passing `pay_with_bank_transfer=true` query parameter | +| `country` | `"NG" \| "GH"` | true | The two letter code country | +| `account_number` | `string` | false | Customer's account number | +| `bvn` | `string` | false | Customer's Bank Verification Number | +| `bank_code` | `string` | false | Customer's bank code | +| `subaccount` | `string` | false | Subaccount code of the account you want to split the transaction with | +| `split_code` | `string` | false | Split code consisting of the lists of accounts you want to split the transaction with | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountAssign({ email: "email_value", first_name: "first_name_value", last_name: "last_name_value", account_number: "account_number_value" }); +console.log(result.data); +``` + +## `dedicatedAccountFetch` + +Get details of a dedicated virtual account on your integration. + +```ts +async dedicatedAccountFetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `string` | true | ID of dedicated virtual account | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountFetch(id); +console.log(result.data); +``` + +## `dedicatedAccountDeactivate` + +Deactivate a dedicated virtual account on your integration. + +```ts +async dedicatedAccountDeactivate(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `string` | true | ID of dedicated virtual account | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountDeactivate(id); +console.log(result.data); +``` + +## `dedicatedAccountRequery` + +Requery Dedicated Virtual Account for new transactions + +```ts +async dedicatedAccountRequery(query?: DedicatedVirtualAccountDedicatedAccountRequeryQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `account_number` | `string` | false | Virtual account number to requery | +| `provider_slug` | `string` | false | The bank's slug in lowercase, without spaces. | +| `date` | `string` | false | The day the transfer was made | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountRequery({ /* query params */ }); +console.log(result.data); +``` + +## `dedicatedAccountAddSplit` + +Split a dedicated virtual account transaction with one or more accounts + +```ts +async dedicatedAccountAddSplit(payload: DedicatedVirtualAccountDedicatedAccountAddSplitBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `account_number` | `string` | true | Valid Dedicated virtual account | +| `subaccount` | `string` | false | Subaccount code of the account you want to split the transaction with | +| `split_code` | `string` | false | Split code consisting of the lists of accounts you want to split the transaction with | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountAddSplit({ account_number: "account_number_value", subaccount: "subaccount_value" }); +console.log(result.data); +``` + +## `dedicatedAccountRemoveSplit` + +If you've previously set up split payment for transactions on a dedicated virtual account, you can remove it with this endpoint + +```ts +async dedicatedAccountRemoveSplit(payload: DedicatedVirtualAccountDedicatedAccountRemoveSplitBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `account_number` | `string` | true | Valid Dedicated virtual account | + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountRemoveSplit({ account_number: "account_number_value" }); +console.log(result.data); +``` + +## `dedicatedAccountAvailableProviders` + +Get available bank providers for a dedicated virtual account + +```ts +async dedicatedAccountAvailableProviders(): Promise>; +``` + +### Example + +```ts +const result = await paystack.dedicatedVirtualAccount.dedicatedAccountAvailableProviders(); +console.log(result.data); +``` diff --git a/docs/directDebit.md b/docs/directDebit.md new file mode 100644 index 0000000..ba190d3 --- /dev/null +++ b/docs/directDebit.md @@ -0,0 +1,56 @@ +# DirectDebitApi + +A collection of endpoints for managing Direct Debit + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `directdebitTriggerActivationCharge` | `PUT` | `/directdebit/activation-charge` | Trigger activation charge for specified customers | +| `directdebitListMandateAuthorizations` | `GET` | `/directdebit/mandate-authorizations` | Get a list of all the direct debit mandates on your integration | + +--- + +## `directdebitTriggerActivationCharge` + +Trigger activation charge for specified customers + +```ts +async directdebitTriggerActivationCharge(payload: DirectDebitDirectdebitTriggerActivationChargeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `customer_ids` | `Array` | true | Array of customer IDs to trigger activation charge for | + +### Example + +```ts +const result = await paystack.directDebit.directdebitTriggerActivationCharge({ customer_ids: [] }); +console.log(result.data); +``` + +## `directdebitListMandateAuthorizations` + +Get a list of all the direct debit mandates on your integration + +```ts +async directdebitListMandateAuthorizations(query?: DirectDebitDirectdebitListMandateAuthorizationsQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `cursor` | `string` | false | The cursor value of the next set of authorizations to fetch. You can get this from the meta object of the response | +| `status` | `string` | false | Filter by the authorization status | +| `per_page` | `integer` | false | The number of authorizations to fetch per request | + +### Example + +```ts +const result = await paystack.directDebit.directdebitListMandateAuthorizations({ /* query params */ }); +console.log(result.data); +``` diff --git a/docs/dispute.md b/docs/dispute.md new file mode 100644 index 0000000..898cd01 --- /dev/null +++ b/docs/dispute.md @@ -0,0 +1,208 @@ +# DisputeApi + +A collection of endpoints for managing transactions complaint made by customers + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/dispute` | List transaction disputes filed by customers | +| `fetch` | `GET` | `/dispute/{id}` | Fetch a transaction dispute | +| `update` | `PUT` | `/dispute/{id}` | Update a transaction dispute | +| `uploadUrl` | `GET` | `/dispute/{id}/upload_url` | Get the URL to upload a dispute evidence | +| `download` | `GET` | `/dispute/export` | Export the disputes available on your integration | +| `transaction` | `GET` | `/dispute/transaction/{id}` | List all disputes filed for a transaction | +| `resolve` | `PUT` | `/dispute/{id}/resolve` | Resolve a transaction dispute | +| `evidence` | `POST` | `/dispute/{id}/evidence` | Provide evidence for a dispute | + +--- + +## `list` + +List transaction disputes filed by customers + +```ts +async list(query?: DisputeListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `status` | `string` | false | Dispute status | +| `transaction` | `string` | false | Transaction ID | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.dispute.list({ /* query params */ }); +console.log(result.data); +``` + +## `fetch` + +Fetch a transaction dispute + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the dispute | + +### Example + +```ts +const result = await paystack.dispute.fetch(id); +console.log(result.data); +``` + +## `update` + +Update a transaction dispute + +```ts +async update(id: string, payload: DisputeUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the dispute | +| `refund_amount` | `number` | true | The amount to refund, in the subunit of your currency | +| `uploaded_filename` | `string` | false | Filename of attachment returned via response from the Dispute upload URL | + +### Example + +```ts +const result = await paystack.dispute.update(id, { refund_amount: 0, uploaded_filename: "uploaded_filename_value" }); +console.log(result.data); +``` + +## `uploadUrl` + +Get the URL to upload a dispute evidence + +```ts +async uploadUrl(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the dispute | + +### Example + +```ts +const result = await paystack.dispute.uploadUrl(id); +console.log(result.data); +``` + +## `download` + +Export the disputes available on your integration + +```ts +async download(query?: DisputeDownloadQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `status` | `string` | false | | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.dispute.download({ /* query params */ }); +console.log(result.data); +``` + +## `transaction` + +List all disputes filed for a transaction + +```ts +async transaction(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the transaction | + +### Example + +```ts +const result = await paystack.dispute.transaction(id); +console.log(result.data); +``` + +## `resolve` + +Resolve a transaction dispute + +```ts +async resolve(id: string, payload: DisputeResolveBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the dispute | +| `resolution` | `string` | true | Dispute resolution. Accepted values, merchant-accepted, declined | +| `message` | `string` | true | Reason for resolving | +| `refund_amount` | `number` | true | The amount to refund, in the subunit of your integration currency | +| `uploaded_filename` | `string` | true | Filename of attachment returned via response from the Dispute upload URL | +| `evidence` | `number` | false | Evidence Id for fraud claims | + +### Example + +```ts +const result = await paystack.dispute.resolve(id, { resolution: "resolution_value", message: "message_value", refund_amount: 0, evidence: 0 }); +console.log(result.data); +``` + +## `evidence` + +Provide evidence for a dispute + +```ts +async evidence(id: string, payload: DisputeEvidenceBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the dispute | +| `customer_email` | `string` | true | Customer email | +| `customer_name` | `string` | true | Customer name | +| `customer_phone` | `string` | true | Customer mobile number | +| `service_details` | `string` | true | Details of service offered | +| `delivery_address` | `string` | false | Delivery address | +| `delivery_date` | `string` | false | ISO 8601 representation of delivery date (YYYY-MM-DD) | + +### Example + +```ts +const result = await paystack.dispute.evidence(id, { customer_email: "customer_email_value", customer_name: "customer_name_value", customer_phone: "customer_phone_value", delivery_address: "delivery_address_value" }); +console.log(result.data); +``` diff --git a/docs/integration.md b/docs/integration.md new file mode 100644 index 0000000..ce37489 --- /dev/null +++ b/docs/integration.md @@ -0,0 +1,48 @@ +# IntegrationApi + +A collection of endpoints for managing some settings on an integration + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `fetchPaymentSessionTimeout` | `GET` | `/integration/payment_session_timeout` | Fetch the session timeout of a transaction | +| `updatePaymentSessionTimeout` | `PUT` | `/integration/payment_session_timeout` | Update the session timeout of a transaction | + +--- + +## `fetchPaymentSessionTimeout` + +Fetch the session timeout of a transaction + +```ts +async fetchPaymentSessionTimeout(): Promise>; +``` + +### Example + +```ts +const result = await paystack.integration.fetchPaymentSessionTimeout(); +console.log(result.data); +``` + +## `updatePaymentSessionTimeout` + +Update the session timeout of a transaction + +```ts +async updatePaymentSessionTimeout(payload: IntegrationUpdatePaymentSessionTimeoutBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `timeout` | `number` | true | Time in seconds before a transaction becomes invalid | + +### Example + +```ts +const result = await paystack.integration.updatePaymentSessionTimeout({ timeout: 0 }); +console.log(result.data); +``` diff --git a/docs/miscellaneous.md b/docs/miscellaneous.md new file mode 100644 index 0000000..f5eb658 --- /dev/null +++ b/docs/miscellaneous.md @@ -0,0 +1,70 @@ +# MiscellaneousApi + +A collection of endpoints that provides utility functions + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `resolveCardBin` | `GET` | `/decision/bin/{bin}` | Get the details of a card BIN | +| `listCountries` | `GET` | `/country` | List all supported countries on Paystack | +| `avs` | `GET` | `/address_verification/states` | Get a list of states for a country for address verification | + +--- + +## `resolveCardBin` + +Get the details of a card BIN + +```ts +async resolveCardBin(bin: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `bin` | `integer` | true | The card bank identification number | + +### Example + +```ts +const result = await paystack.miscellaneous.resolveCardBin(bin); +console.log(result.data); +``` + +## `listCountries` + +List all supported countries on Paystack + +```ts +async listCountries(): Promise>; +``` + +### Example + +```ts +const result = await paystack.miscellaneous.listCountries(); +console.log(result.data); +``` + +## `avs` + +Get a list of states for a country for address verification + +```ts +async avs(query?: MiscellaneousAvsQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `country` | `string` | false | The country code of the states to list. It is gotten after the charge request | + +### Example + +```ts +const result = await paystack.miscellaneous.avs({ /* query params */ }); +console.log(result.data); +``` diff --git a/docs/order.md b/docs/order.md new file mode 100644 index 0000000..d8550f5 --- /dev/null +++ b/docs/order.md @@ -0,0 +1,131 @@ +# OrderApi + +A collection of endpoints for creating and managing orders + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/order` | List the previously created orders | +| `create` | `POST` | `/order` | Create an order for selected items | +| `fetch` | `GET` | `/order/{id}` | Fetch the details of a previously created order | +| `product` | `GET` | `/order/product/{id}` | Fetch all orders for a particular product | +| `validate` | `GET` | `/order/{code}/validate` | Validate a pay for me order | + +--- + +## `list` + +List the previously created orders + +```ts +async list(query?: OrderListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.order.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create an order for selected items + +```ts +async create(payload: OrderCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | The email of the customer placing the order | +| `first_name` | `string` | true | The customer's first name | +| `last_name` | `string` | true | The customer's last name | +| `phone` | `string` | true | The customer's mobile number | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "USD" \| "ZAR"` | true | Currency in which amount is set | +| `items` | `Array<{ item: number; type: string; quantity: number; amount: number }>` | true | | +| `shipping` | `{ street_line: string; city: string; state: string; country: string; shipping_fee: number; delivery_note?: string }` | true | The shipping details of the order | +| `is_gift` | `boolean` | false | A flag to indicate if the order is for someone else | +| `pay_for_me` | `boolean` | false | A flag to indicate if the someone else should pay for the order | + +### Example + +```ts +const result = await paystack.order.create({ email: "email_value", first_name: "first_name_value", last_name: "last_name_value", is_gift: true }); +console.log(result.data); +``` + +## `fetch` + +Fetch the details of a previously created order + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the order | + +### Example + +```ts +const result = await paystack.order.fetch(id); +console.log(result.data); +``` + +## `product` + +Fetch all orders for a particular product + +```ts +async product(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the order | + +### Example + +```ts +const result = await paystack.order.product(id); +console.log(result.data); +``` + +## `validate` + +Validate a pay for me order + +```ts +async validate(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The unique code of a previously created order | + +### Example + +```ts +const result = await paystack.order.validate(code); +console.log(result.data); +``` diff --git a/docs/page.md b/docs/page.md new file mode 100644 index 0000000..589fb19 --- /dev/null +++ b/docs/page.md @@ -0,0 +1,164 @@ +# PageApi + +A collection of endpoints for creating and managing links for the collection of payment for products + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/page` | List all previously created payment pages | +| `create` | `POST` | `/page` | Create a webpage to receive payments | +| `fetch` | `GET` | `/page/{id}` | Get a previously created payment page | +| `update` | `PUT` | `/page/{id}` | Update a previously created payment page | +| `checkSlugAvailability` | `GET` | `/page/check_slug_availability/{slug}` | Check if a custom slug is available for use when creating a payment page | +| `addProducts` | `POST` | `/page/{id}/product` | Add products to a previously created payment page. You can only add products to pages that was created with a `product` type. | + +--- + +## `list` + +List all previously created payment pages + +```ts +async list(query?: PageListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.page.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a webpage to receive payments + +```ts +async create(payload: PageCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | Name of page | +| `description` | `string` | false | The description of the page | +| `amount` | `number` | false | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `currency` | `"NGN" \| "GHS" \| "ZAR" \| "KES" \| "USD"` | false | The transaction currency. Defaults to your integration currency. | +| `slug` | `string` | false | URL slug you would like to be associated with this page. Page will be accessible at `https://paystack.com/pay/[slug]` | +| `type` | `"payment" \| "subscription" \| "product" \| "plan"` | false | The type of payment page to create. Defaults to `payment` if no type is specified. | +| `plan` | `string` | false | The ID of the plan to subscribe customers on this payment page to when `type` is set to `subscription`. | +| `fixed_amount` | `boolean` | false | Specifies whether to collect a fixed amount on the payment page. If true, `amount` must be passed. | +| `split_code` | `string` | false | The split code of the transaction split. e.g. `SPL_98WF13Eb3w` | +| `metadata` | `Record` | false | JSON object of custom data | +| `redirect_url` | `string` | false | If you would like Paystack to redirect to a URL upon successful payment, specify the URL here. | +| `success_message` | `string` | false | A success message to display to the customer after a successful transaction | +| `notification_email` | `string` | false | An email address that will receive transaction notifications for this payment page | +| `collect_phone` | `boolean` | false | Specify whether to collect phone numbers on the payment page | +| `custom_fields` | `Array>` | false | If you would like to accept custom fields, specify them here. | + +### Example + +```ts +const result = await paystack.page.create({ name: "name_value", description: "description_value" }); +console.log(result.data); +``` + +## `fetch` + +Get a previously created payment page + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a payment page | + +### Example + +```ts +const result = await paystack.page.fetch(id); +console.log(result.data); +``` + +## `update` + +Update a previously created payment page + +```ts +async update(id: string, payload: PageUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a payment page | +| `name` | `string` | false | Name of page | +| `description` | `string` | false | The description of the page | +| `amount` | `number` | false | Amount should be in the subunit of the currency | +| `active` | `boolean` | false | Set to false to deactivate page url | + +### Example + +```ts +const result = await paystack.page.update(id, { name: "name_value" }); +console.log(result.data); +``` + +## `checkSlugAvailability` + +Check if a custom slug is available for use when creating a payment page + +```ts +async checkSlugAvailability(slug: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `slug` | `string` | true | The custom slug to check | + +### Example + +```ts +const result = await paystack.page.checkSlugAvailability(slug); +console.log(result.data); +``` + +## `addProducts` + +Add products to a previously created payment page. You can only add products to pages that was created with a `product` type. + +```ts +async addProducts(id: string, payload: PageAddProductsBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `string` | true | | +| `products` | `Array` | true | A list of IDs of products to add to a page. | + +### Example + +```ts +const result = await paystack.page.addProducts(id, { products: [] }); +console.log(result.data); +``` diff --git a/docs/paymentRequest.md b/docs/paymentRequest.md new file mode 100644 index 0000000..e5ea656 --- /dev/null +++ b/docs/paymentRequest.md @@ -0,0 +1,231 @@ +# PaymentRequestApi + +A collection of endpoints for managing invoices for the payment of goods and services + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/paymentrequest` | List all previously created payment requests to your customers | +| `create` | `POST` | `/paymentrequest` | Create a new payment request by issuing an invoice to a customer | +| `fetch` | `GET` | `/paymentrequest/{id}` | Fetch a previously created payment request | +| `update` | `PUT` | `/paymentrequest/{id}` | Update a previously created payment request | +| `verify` | `GET` | `/paymentrequest/verify/{id}` | Verify the status of a previously created payment request | +| `notify` | `POST` | `/paymentrequest/notify/{id}` | Trigger an email reminder to a customer for a previously created payment request | +| `totals` | `GET` | `/paymentrequest/totals` | Get the metric of all pending and successful payment requests | +| `finalize` | `POST` | `/paymentrequest/finalize/{id}` | Finalise the creation of a draft payment request for a customer | +| `archive` | `POST` | `/paymentrequest/archive/{id}` | Archive a payment request to clean up your records. An archived payment request cannot be verified and will not be returned when listing all previously created payment requests. | + +--- + +## `list` + +List all previously created payment requests to your customers + +```ts +async list(query?: PaymentRequestListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `customer` | `string` | false | Customer ID | +| `status` | `string` | false | Invoice status to filter | +| `currency` | `string` | false | If your integration supports more than one currency, choose the one to filter | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.paymentRequest.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a new payment request by issuing an invoice to a customer + +```ts +async create(payload: PaymentRequestCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `customer` | `string` | true | Customer id or code | +| `amount` | `number` | true | Payment request amount. Only useful if line items and tax values are ignored. The endpoint will throw a friendly warning if neither is available. | +| `currency` | `string` | false | Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN | +| `due_date` | `string` | false | ISO 8601 representation of request due date | +| `description` | `string` | false | A short description of the payment request | +| `line_items` | `Array>` | false | Array of line items | +| `tax` | `Array>` | false | Array of taxes | +| `send_notification` | `boolean` | false | Indicates whether Paystack sends an email notification to customer. Defaults to true | +| `draft` | `boolean` | false | Indicate if request should be saved as draft. Defaults to false and overrides send_notification | +| `has_invoice` | `boolean` | false | Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) even if there are no line_items or tax passed | +| `invoice_number` | `number` | false | Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. | +| `split_code` | `string` | false | The split code of the transaction split. | + +### Example + +```ts +const result = await paystack.paymentRequest.create({ customer: "customer_value", amount: 0, currency: "currency_value" }); +console.log(result.data); +``` + +## `fetch` + +Fetch a previously created payment request + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a previously created payment request | + +### Example + +```ts +const result = await paystack.paymentRequest.fetch(id); +console.log(result.data); +``` + +## `update` + +Update a previously created payment request + +```ts +async update(id: string, payload: PaymentRequestUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a previously created payment request | +| `customer` | `string` | false | Customer id or code | +| `amount` | `number` | false | Payment request amount. Only useful if line items and tax values are ignored. The endpoint will throw a friendly warning if neither is available. | +| `currency` | `string` | false | Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN | +| `due_date` | `string` | false | ISO 8601 representation of request due date | +| `description` | `string` | false | A short description of the payment request | +| `line_items` | `Array>` | false | Array of line items | +| `tax` | `Array>` | false | Array of taxes | +| `send_notification` | `boolean` | false | Indicates whether Paystack sends an email notification to customer. Defaults to true | +| `draft` | `boolean` | false | Indicate if request should be saved as draft. Defaults to false and overrides send_notification | +| `has_invoice` | `boolean` | false | Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) even if there are no line_items or tax passed | +| `invoice_number` | `number` | false | Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. | +| `split_code` | `string` | false | The split code of the transaction split. | + +### Example + +```ts +const result = await paystack.paymentRequest.update(id, { customer: "customer_value" }); +console.log(result.data); +``` + +## `verify` + +Verify the status of a previously created payment request + +```ts +async verify(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a previously created payment request | + +### Example + +```ts +const result = await paystack.paymentRequest.verify(id); +console.log(result.data); +``` + +## `notify` + +Trigger an email reminder to a customer for a previously created payment request + +```ts +async notify(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a previously created payment request | + +### Example + +```ts +const result = await paystack.paymentRequest.notify(id); +console.log(result.data); +``` + +## `totals` + +Get the metric of all pending and successful payment requests + +```ts +async totals(): Promise>; +``` + +### Example + +```ts +const result = await paystack.paymentRequest.totals(); +console.log(result.data); +``` + +## `finalize` + +Finalise the creation of a draft payment request for a customer + +```ts +async finalize(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a draft payment request | + +### Example + +```ts +const result = await paystack.paymentRequest.finalize(id); +console.log(result.data); +``` + +## `archive` + +Archive a payment request to clean up your records. An archived payment request cannot be verified and will not be returned when listing all previously created payment requests. + +```ts +async archive(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of a previously created payment request | + +### Example + +```ts +const result = await paystack.paymentRequest.archive(id); +console.log(result.data); +``` diff --git a/docs/plan.md b/docs/plan.md new file mode 100644 index 0000000..3e0ba0a --- /dev/null +++ b/docs/plan.md @@ -0,0 +1,118 @@ +# PlanApi + +A collection of endpoints for creating and managing recurring payment configuration + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/plan` | List all recurring payment plans | +| `create` | `POST` | `/plan` | Create a plan for recurring payments | +| `fetch` | `GET` | `/plan/{code}` | Get the details of a payment plan | +| `update` | `PUT` | `/plan/{code}` | Update a plan details on your integration | + +--- + +## `list` + +List all recurring payment plans + +```ts +async list(query?: PlanListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `interval` | `string` | false | Specify interval of the plan | +| `amount` | `integer` | false | The amount on the plans to retrieve | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.plan.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a plan for recurring payments + +```ts +async create(payload: PlanCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | Name of plan | +| `amount` | `number` | true | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `interval` | `"daily" \| "weekly" \| "monthly" \| "biannually" \| "annually"` | true | Payment interval | +| `description` | `string` | false | A description for this plan | +| `send_invoices` | `boolean` | false | Set to false if you don't want invoices to be sent to your customers | +| `send_sms` | `boolean` | false | Set to false if you don't want text messages to be sent to your customers | +| `currency` | `string` | false | Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD | +| `invoice_limit` | `number` | false | Number of invoices to raise during subscription to this plan. Can be overridden by specifying an invoice_limit while subscribing. | + +### Example + +```ts +const result = await paystack.plan.create({ name: "name_value", amount: 0, interval: "daily", description: "description_value" }); +console.log(result.data); +``` + +## `fetch` + +Get the details of a payment plan + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The plan code you want to fetch | + +### Example + +```ts +const result = await paystack.plan.fetch(code); +console.log(result.data); +``` + +## `update` + +Update a plan details on your integration + +```ts +async update(code: string, payload: PlanUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The plan code you want to fetch | +| `name` | `string` | false | Name of plan | +| `amount` | `number` | false | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `interval` | `"daily" \| "weekly" \| "monthly" \| "biannually" \| "annually"` | false | Payment interval | +| `description` | `boolean` | false | A description for this plan | +| `send_invoices` | `boolean` | false | Set to false if you don't want invoices to be sent to your customers | +| `send_sms` | `boolean` | false | Set to false if you don't want text messages to be sent to your customers | +| `currency` | `string` | false | Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD | +| `invoice_limit` | `number` | false | Number of invoices to raise during subscription to this plan. Can be overridden by specifying an invoice_limit while subscribing. | + +### Example + +```ts +const result = await paystack.plan.update(code, { name: "name_value" }); +console.log(result.data); +``` diff --git a/docs/product.md b/docs/product.md new file mode 100644 index 0000000..9d5564f --- /dev/null +++ b/docs/product.md @@ -0,0 +1,139 @@ +# ProductApi + +A collection of endpoints for creating and managing inventories + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/product` | List all previously created products | +| `create` | `POST` | `/product` | Create a new product on your integration | +| `fetch` | `GET` | `/product/{id}` | Fetch a previously created product | +| `update` | `PUT` | `/product/{id}` | Update a previously created product | +| `delete_` | `DELETE` | `/product/{id}` | Delete a previously created product | + +--- + +## `list` + +List all previously created products + +```ts +async list(query?: ProductListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `active` | `boolean` | false | The state of the product | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.product.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a new product on your integration + +```ts +async create(payload: ProductCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | Name of product | +| `description` | `string` | true | The description of the product | +| `price` | `number` | true | Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `currency` | `string` | true | Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD | +| `unlimited` | `boolean` | false | Set to true if the product has unlimited stock. Leave as false if the product has limited stock | +| `quantity` | `number` | false | Number of products in stock. Use if limited is true | +| `split_code` | `string` | false | The split code if sharing the transaction with partners | +| `metadata` | `string` | false | Stringified JSON object of custom data | + +### Example + +```ts +const result = await paystack.product.create({ name: "name_value", description: "description_value", price: 0, unlimited: true }); +console.log(result.data); +``` + +## `fetch` + +Fetch a previously created product + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the product | + +### Example + +```ts +const result = await paystack.product.fetch(id); +console.log(result.data); +``` + +## `update` + +Update a previously created product + +```ts +async update(id: string, payload: ProductUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the product | +| `name` | `string` | false | Name of product | +| `description` | `string` | false | The description of the product | +| `price` | `number` | false | Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR | +| `currency` | `string` | false | Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD | +| `unlimited` | `boolean` | false | Set to true if the product has unlimited stock. Leave as false if the product has limited stock | +| `quantity` | `number` | false | Number of products in stock. Use if limited is true | +| `split_code` | `string` | false | The split code if sharing the transaction with partners | +| `metadata` | `Record` | false | JSON object of custom data | + +### Example + +```ts +const result = await paystack.product.update(id, { name: "name_value" }); +console.log(result.data); +``` + +## `delete_` + +Delete a previously created product + +```ts +async delete_(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the product | + +### Example + +```ts +const result = await paystack.product.delete_(id); +console.log(result.data); +``` diff --git a/docs/refund.md b/docs/refund.md new file mode 100644 index 0000000..847dfed --- /dev/null +++ b/docs/refund.md @@ -0,0 +1,106 @@ +# RefundApi + +A collection of endpoints for creating and managing transaction reimbursement + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/refund` | List previously created refunds | +| `create` | `POST` | `/refund` | Initiate a refund for a previously completed transaction | +| `retry` | `POST` | `/refund/retry_with_customer_details/{id}` | Retry a refund with a `needs-attention` status by providing the bank account details of a customer. | +| `fetch` | `GET` | `/refund/{id}` | Get a previously created refund | + +--- + +## `list` + +List previously created refunds + +```ts +async list(query?: RefundListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.refund.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Initiate a refund for a previously completed transaction + +```ts +async create(payload: RefundCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `transaction` | `string` | true | The reference of a previosuly completed transaction | +| `amount` | `number` | false | Amount to be refunded to the customer. It cannot be more than the original transaction amount | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "USD" \| "ZAR"` | false | Three-letter ISO currency | +| `customer_note` | `string` | false | Customer reason | +| `merchant_note` | `string` | false | Merchant reason | + +### Example + +```ts +const result = await paystack.refund.create({ transaction: "transaction_value", amount: 0 }); +console.log(result.data); +``` + +## `retry` + +Retry a refund with a `needs-attention` status by providing the bank account details of a customer. + +```ts +async retry(id: string, payload: RefundRetryBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The identifier of the refund | +| `refund_account_details` | `{ currency: string; account_number: string; bank_id: string }` | true | An object that contains the customer’s account details for refund | + +### Example + +```ts +const result = await paystack.refund.retry(id, { refund_account_details: {} }); +console.log(result.data); +``` + +## `fetch` + +Get a previously created refund + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The identifier of the refund | + +### Example + +```ts +const result = await paystack.refund.fetch(id); +console.log(result.data); +``` diff --git a/docs/settlement.md b/docs/settlement.md new file mode 100644 index 0000000..6050d0f --- /dev/null +++ b/docs/settlement.md @@ -0,0 +1,55 @@ +# SettlementApi + +A collection of endpoints for gaining insights into payouts + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `settlementsFetch` | `GET` | `/settlement` | List settlements made to your settlement accounts | +| `settlementsTransaction` | `GET` | `/settlement/{id}/transactions` | Get the transactions that make up a particular settlement | + +--- + +## `settlementsFetch` + +List settlements made to your settlement accounts + +```ts +async settlementsFetch(query?: SettlementSettlementsFetchQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | + +### Example + +```ts +const result = await paystack.settlement.settlementsFetch({ /* query params */ }); +console.log(result.data); +``` + +## `settlementsTransaction` + +Get the transactions that make up a particular settlement + +```ts +async settlementsTransaction(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The settlement ID in which you want to fetch its transactions | + +### Example + +```ts +const result = await paystack.settlement.settlementsTransaction(id); +console.log(result.data); +``` diff --git a/docs/split.md b/docs/split.md new file mode 100644 index 0000000..cb82ef5 --- /dev/null +++ b/docs/split.md @@ -0,0 +1,161 @@ +# SplitApi + +A collection of endpoints for spliting a transaction and managing the splits + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/split` | List the transaction splits available on your integration | +| `create` | `POST` | `/split` | Create a split configuration for transactions | +| `fetch` | `GET` | `/split/{id}` | Get details of a split configuration for a transaction | +| `update` | `PUT` | `/split/{id}` | Update a split configuration for transactions | +| `addSubaccount` | `POST` | `/split/{id}/subaccount/add` | Add a subaccount to a split configuration, or update the share of an existing subaccount | +| `removeSubaccount` | `POST` | `/split/{id}/subaccount/remove` | Remove a subaccount from a split configuration | + +--- + +## `list` + +List the transaction splits available on your integration + +```ts +async list(query?: SplitListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `subaccount_code` | `string` | false | Filter by subaccount code | +| `name` | `string` | false | The name of the split | +| `active` | `boolean` | false | The status of the split | +| `per_page` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.split.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a split configuration for transactions + +```ts +async create(payload: SplitCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | Name of the transaction split | +| `type` | `"percentage" \| "flat"` | true | The type of transaction split you want to create. | +| `subaccounts` | `Array<{ subaccount?: string; share?: number }>` | true | A list of object containing subaccount code and number of shares | +| `currency` | `"NGN" \| "GHS" \| "ZAR" \| "USD"` | true | The transaction currency | +| `bearer_type` | `"subaccount" \| "account" \| "all-proportional" \| "all"` | false | This allows you specify how the transaction charge should be processed | +| `bearer_subaccount` | `string` | false | This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type | + +### Example + +```ts +const result = await paystack.split.create({ name: "name_value", type: "percentage", subaccounts: [], bearer_type: "subaccount" }); +console.log(result.data); +``` + +## `fetch` + +Get details of a split configuration for a transaction + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the split configuration to fetch | + +### Example + +```ts +const result = await paystack.split.fetch(id); +console.log(result.data); +``` + +## `update` + +Update a split configuration for transactions + +```ts +async update(id: string, payload: SplitUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `string` | true | | +| `name` | `string` | false | Name of the transaction split | +| `active` | `boolean` | false | Toggle status of split. When true, the split is active, else it's inactive | +| `bearer_type` | `"subaccount" \| "account" \| "all-proportional" \| "all"` | false | This allows you specify how the transaction charge should be processed | +| `bearer_subaccount` | `string` | false | This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type | + +### Example + +```ts +const result = await paystack.split.update(id, { name: "name_value" }); +console.log(result.data); +``` + +## `addSubaccount` + +Add a subaccount to a split configuration, or update the share of an existing subaccount + +```ts +async addSubaccount(id: string, payload: SplitAddSubaccountBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the split configuration to fetch | +| `subaccount` | `string` | false | Subaccount code of the customer or partner | +| `share` | `number` | false | The percentage or flat quota of the customer or partner | + +### Example + +```ts +const result = await paystack.split.addSubaccount(id, { subaccount: "subaccount_value" }); +console.log(result.data); +``` + +## `removeSubaccount` + +Remove a subaccount from a split configuration + +```ts +async removeSubaccount(id: string, payload: SplitRemoveSubaccountBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the split configuration to fetch | +| `subaccount` | `string` | false | Subaccount code of the customer or partner | +| `share` | `number` | false | The percentage or flat quota of the customer or partner | + +### Example + +```ts +const result = await paystack.split.removeSubaccount(id, { subaccount: "subaccount_value" }); +console.log(result.data); +``` diff --git a/docs/storefront.md b/docs/storefront.md new file mode 100644 index 0000000..4a26062 --- /dev/null +++ b/docs/storefront.md @@ -0,0 +1,261 @@ +# StorefrontApi + +A collection of endpoints for creating and managing storefronts + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/storefront` | List the storefronts you previously created | +| `create` | `POST` | `/storefront` | Create a digital shop to manage and display your products | +| `fetch` | `GET` | `/storefront/{id}` | Get the details of a previously created Storefront | +| `update` | `PUT` | `/storefront/{id}` | Update the details of a previously created Storefront | +| `delete_` | `DELETE` | `/storefront/{id}` | Delete a previously created Storefront | +| `verifySlug` | `GET` | `/storefront/verify/{slug}` | Verify the availability of a slug before using it for your Storefront | +| `fetchOrders` | `GET` | `/storefront/{id}/order` | Fetch all orders in your Storefront | +| `listProducts` | `GET` | `/storefront/{id}/product` | List the products in a Storefront | +| `addProducts` | `POST` | `/storefront/{id}/product` | Add previously created products to a Storefront | +| `publish` | `POST` | `/storefront/{id}/publish` | Make your Storefront publicly available | +| `duplicate` | `POST` | `/storefront/{id}/duplicate` | Duplicate a previously created Storefront | + +--- + +## `list` + +List the storefronts you previously created + +```ts +async list(query?: StorefrontListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `status` | `string` | false | | + +### Example + +```ts +const result = await paystack.storefront.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a digital shop to manage and display your products + +```ts +async create(payload: StorefrontCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | Name of the storefront | +| `slug` | `string` | true | A unique identifier to access your store. Once the storefront is created, it can be accessed from https://paystack.shop/your-slug | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "USD" \| "ZAR"` | true | Currency for prices of products in your storefront. | +| `description` | `string` | false | The description of the storefront | + +### Example + +```ts +const result = await paystack.storefront.create({ name: "name_value", slug: "slug_value", currency: "GHS", description: "description_value" }); +console.log(result.data); +``` + +## `fetch` + +Get the details of a previously created Storefront + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.fetch(id); +console.log(result.data); +``` + +## `update` + +Update the details of a previously created Storefront + +```ts +async update(id: string, payload: StorefrontUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | +| `name` | `string` | false | Name of the storefront | +| `slug` | `string` | false | A unique identifier to access your store. Once the storefront is created, it can be accessed from https://paystack.shop/your-slug | +| `description` | `string` | false | The description of the storefront | + +### Example + +```ts +const result = await paystack.storefront.update(id, { name: "name_value" }); +console.log(result.data); +``` + +## `delete_` + +Delete a previously created Storefront + +```ts +async delete_(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.delete_(id); +console.log(result.data); +``` + +## `verifySlug` + +Verify the availability of a slug before using it for your Storefront + +```ts +async verifySlug(slug: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `slug` | `string` | true | The custom slug to check | + +### Example + +```ts +const result = await paystack.storefront.verifySlug(slug); +console.log(result.data); +``` + +## `fetchOrders` + +Fetch all orders in your Storefront + +```ts +async fetchOrders(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.fetchOrders(id); +console.log(result.data); +``` + +## `listProducts` + +List the products in a Storefront + +```ts +async listProducts(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.listProducts(id); +console.log(result.data); +``` + +## `addProducts` + +Add previously created products to a Storefront + +```ts +async addProducts(id: string, payload: StorefrontAddProductsBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | +| `products` | `Array` | true | An array of product IDs | + +### Example + +```ts +const result = await paystack.storefront.addProducts(id, { products: [] }); +console.log(result.data); +``` + +## `publish` + +Make your Storefront publicly available + +```ts +async publish(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.publish(id); +console.log(result.data); +``` + +## `duplicate` + +Duplicate a previously created Storefront + +```ts +async duplicate(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The unique identifier of the Storefront | + +### Example + +```ts +const result = await paystack.storefront.duplicate(id); +console.log(result.data); +``` diff --git a/docs/subaccount.md b/docs/subaccount.md new file mode 100644 index 0000000..1ed30e0 --- /dev/null +++ b/docs/subaccount.md @@ -0,0 +1,118 @@ +# SubaccountApi + +A collection of endpoints for creating and managing accounts for sharing a transaction with + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/subaccount` | List subaccounts available on your integration | +| `create` | `POST` | `/subaccount` | Create a subacount for a partner | +| `fetch` | `GET` | `/subaccount/{code}` | Get details of a subaccount on your integration | +| `update` | `PUT` | `/subaccount/{code}` | Update a subaccount details on your integration | + +--- + +## `list` + +List subaccounts available on your integration + +```ts +async list(query?: SubaccountListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `active` | `boolean` | false | Filter by the state of the subaccounts | + +### Example + +```ts +const result = await paystack.subaccount.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a subacount for a partner + +```ts +async create(payload: SubaccountCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `business_name` | `string` | true | Name of business for subaccount | +| `settlement_bank` | `string` | true | Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. | +| `account_number` | `string` | true | Bank account number | +| `percentage_charge` | `number` | true | Customer's phone number | +| `description` | `string` | false | A description for this subaccount | +| `primary_contact_email` | `string` | false | A contact email for the subaccount | +| `primary_contact_name` | `string` | false | The name of the contact person for this subaccount | +| `primary_contact_phone` | `string` | false | A phone number to call for this subaccount | +| `metadata` | `string` | false | Stringified JSON object of custom data | + +### Example + +```ts +const result = await paystack.subaccount.create({ business_name: "business_name_value", settlement_bank: "settlement_bank_value", account_number: "account_number_value", description: "description_value" }); +console.log(result.data); +``` + +## `fetch` + +Get details of a subaccount on your integration + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The subaccount code you want to fetch | + +### Example + +```ts +const result = await paystack.subaccount.fetch(code); +console.log(result.data); +``` + +## `update` + +Update a subaccount details on your integration + +```ts +async update(code: string, payload: SubaccountUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The subaccount code you want to fetch | +| `business_name` | `string` | false | Name of business for subaccount | +| `settlement_bank` | `string` | false | Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. | +| `account_number` | `string` | false | Bank account number | +| `active` | `boolean` | false | Activate or deactivate a subaccount | +| `percentage_charge` | `number` | false | Customer's phone number | +| `description` | `string` | false | A description for this subaccount | +| `primary_contact_email` | `string` | false | A contact email for the subaccount | +| `primary_contact_name` | `string` | false | The name of the contact person for this subaccount | +| `primary_contact_phone` | `string` | false | A phone number to call for this subaccount | +| `metadata` | `string` | false | Stringified JSON object of custom data | + +### Example + +```ts +const result = await paystack.subaccount.update(code, { business_name: "business_name_value" }); +console.log(result.data); +``` diff --git a/docs/subscription.md b/docs/subscription.md new file mode 100644 index 0000000..227a349 --- /dev/null +++ b/docs/subscription.md @@ -0,0 +1,174 @@ +# SubscriptionApi + +A collection of endpoints for creating and managing recurring payments + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/subscription` | List all subscriptions available on your integration | +| `create` | `POST` | `/subscription` | Create a subscription a customer | +| `fetch` | `GET` | `/subscription/{code}` | Get details of a customer's subscription | +| `disable` | `POST` | `/subscription/disable` | Disable a subscription on your integration | +| `enable` | `POST` | `/subscription/enable` | Enable a subscription on your integration | +| `manageLink` | `GET` | `/subscription/{code}/manage/link` | Generate a link for updating the card on a subscription | +| `manageEmail` | `POST` | `/subscription/{code}/manage/email` | Email a customer a link for updating the card on their subscription | + +--- + +## `list` + +List all subscriptions available on your integration + +```ts +async list(query?: SubscriptionListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | Number of records to fetch per page | +| `page` | `integer` | false | The section to retrieve | +| `plan` | `integer` | false | Plan ID | +| `customer` | `string` | false | Customer ID | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.subscription.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a subscription a customer + +```ts +async create(payload: SubscriptionCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `customer` | `string` | true | Customer's email address or customer code | +| `plan` | `string` | true | Plan code | +| `authorization` | `string` | false | If customer has multiple authorizations, you can set the desired authorization you wish to use for this subscription here. If this is not supplied, the customer's most recent authorization would be used | +| `start_date` | `string` | false | Set the date for the first debit. (ISO 8601 format) e.g. 2017-05-16T00:30:13+01:00 | + +### Example + +```ts +const result = await paystack.subscription.create({ customer: "customer_value", plan: "plan_value", authorization: "authorization_value" }); +console.log(result.data); +``` + +## `fetch` + +Get details of a customer's subscription + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | The subscription code for the subscription you want to fetch | + +### Example + +```ts +const result = await paystack.subscription.fetch(code); +console.log(result.data); +``` + +## `disable` + +Disable a subscription on your integration + +```ts +async disable(payload: SubscriptionDisableBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Subscription code | +| `token` | `string` | true | Email token | + +### Example + +```ts +const result = await paystack.subscription.disable({ code: "code_value", token: "token_value" }); +console.log(result.data); +``` + +## `enable` + +Enable a subscription on your integration + +```ts +async enable(payload: SubscriptionEnableBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Subscription code | +| `token` | `string` | true | Email token | + +### Example + +```ts +const result = await paystack.subscription.enable({ code: "code_value", token: "token_value" }); +console.log(result.data); +``` + +## `manageLink` + +Generate a link for updating the card on a subscription + +```ts +async manageLink(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Subscription code | + +### Example + +```ts +const result = await paystack.subscription.manageLink(code); +console.log(result.data); +``` + +## `manageEmail` + +Email a customer a link for updating the card on their subscription + +```ts +async manageEmail(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Subscription code | + +### Example + +```ts +const result = await paystack.subscription.manageEmail(code); +console.log(result.data); +``` diff --git a/docs/terminal.md b/docs/terminal.md new file mode 100644 index 0000000..d6ca071 --- /dev/null +++ b/docs/terminal.md @@ -0,0 +1,194 @@ +# TerminalApi + +A collection of endpoints for building delightful in-person payment experiences + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `sendEvent` | `POST` | `/terminal/{id}/event` | Send an event from your application to the Paystack Terminal | +| `fetchEventStatus` | `GET` | `/terminal/{terminal_id}/event/{event_id}` | Check the status of an event sent to the Terminal | +| `fetchTerminalStatus` | `GET` | `/terminal/{terminal_id}/presence` | Check the availiability of a Terminal before sending an event to it | +| `list` | `GET` | `/terminal` | List the Terminals available on your integration | +| `fetch` | `GET` | `/terminal/{terminal_id}` | Get the details of a Terminal | +| `update` | `PUT` | `/terminal/{terminal_id}` | Update the details of a Terminal | +| `commission` | `POST` | `/terminal/commission_device` | Activate your debug device by linking it to your integration | +| `decommission` | `POST` | `/terminal/decommission_device` | Unlink your debug device from your integration | + +--- + +## `sendEvent` + +Send an event from your application to the Paystack Terminal + +```ts +async sendEvent(id: string, payload: TerminalSendEventBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `string` | true | The ID of the Terminal the event should be sent to. | +| `type` | `"invoice" \| "transaction"` | false | The type of event to push | +| `action` | `"process" \| "view" \| "print"` | false | The action the Terminal needs to perform. For the invoice type, the action can either be process or view. For the transaction type, the action can either be process or print. | +| `data` | `{ id?: number; reference?: string }` | false | The parameters needed to perform the specified action | + +### Example + +```ts +const result = await paystack.terminal.sendEvent(id, { type: "invoice" }); +console.log(result.data); +``` + +## `fetchEventStatus` + +Check the status of an event sent to the Terminal + +```ts +async fetchEventStatus(terminal_id: string, event_id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `terminal_id` | `string` | true | The ID of the Terminal the event should be sent to. | +| `event_id` | `string` | true | The ID of the event that was sent to the Terminal | + +### Example + +```ts +const result = await paystack.terminal.fetchEventStatus(terminal_id, event_id); +console.log(result.data); +``` + +## `fetchTerminalStatus` + +Check the availiability of a Terminal before sending an event to it + +```ts +async fetchTerminalStatus(terminal_id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `terminal_id` | `string` | true | The ID of the Terminal the event should be sent to. | + +### Example + +```ts +const result = await paystack.terminal.fetchTerminalStatus(terminal_id); +console.log(result.data); +``` + +## `list` + +List the Terminals available on your integration + +```ts +async list(query?: TerminalListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `next` | `string` | false | A cursor that indicates your place in the list. It can be used to fetch the next page of the list | +| `previous` | `string` | false | A cursor that indicates your place in the list. It should be used to fetch the previous page of the list after an intial next request | +| `per_page` | `integer` | false | Specify how many records you want to retrieve per page | + +### Example + +```ts +const result = await paystack.terminal.list({ /* query params */ }); +console.log(result.data); +``` + +## `fetch` + +Get the details of a Terminal + +```ts +async fetch(terminal_id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `terminal_id` | `string` | true | The ID of the Terminal the event should be sent to. | + +### Example + +```ts +const result = await paystack.terminal.fetch(terminal_id); +console.log(result.data); +``` + +## `update` + +Update the details of a Terminal + +```ts +async update(terminal_id: string, payload: TerminalUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `terminal_id` | `string` | true | The ID of the Terminal the event should be sent to. | +| `name` | `string` | false | The new name for the Terminal | +| `address` | `string` | false | The new address for the Terminal | + +### Example + +```ts +const result = await paystack.terminal.update(terminal_id, { name: "name_value" }); +console.log(result.data); +``` + +## `commission` + +Activate your debug device by linking it to your integration + +```ts +async commission(payload: TerminalCommissionBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `serial_number` | `string` | true | Device Serial Number | + +### Example + +```ts +const result = await paystack.terminal.commission({ serial_number: "serial_number_value" }); +console.log(result.data); +``` + +## `decommission` + +Unlink your debug device from your integration + +```ts +async decommission(payload: TerminalDecommissionBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `serial_number` | `string` | true | Device Serial Number | + +### Example + +```ts +const result = await paystack.terminal.decommission({ serial_number: "serial_number_value" }); +console.log(result.data); +``` diff --git a/docs/transaction.md b/docs/transaction.md new file mode 100644 index 0000000..c806f64 --- /dev/null +++ b/docs/transaction.md @@ -0,0 +1,260 @@ +# TransactionApi + +A collection of endpoints for managing payments + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `initialize` | `POST` | `/transaction/initialize` | Create a new transaction | +| `chargeAuthorization` | `POST` | `/transaction/charge_authorization` | Charge all authorizations marked as reusable with this endpoint whenever you need to receive payments | +| `partialDebit` | `POST` | `/transaction/partial_debit` | Retrieve part of a payment from a customer | +| `verify` | `GET` | `/transaction/verify/{reference}` | Verify a previously initiated transaction using it's reference | +| `list` | `GET` | `/transaction` | List transactions that has occurred on your integration | +| `fetch` | `GET` | `/transaction/{id}` | Fetch a transaction to get its details | +| `timeline` | `GET` | `/transaction/timeline/{id}` | Fetch the steps taken from the initiation to the completion of a transaction | +| `totals` | `GET` | `/transaction/totals` | Get the total amount of all transactions | +| `export_` | `GET` | `/transaction/export` | Download transactions that occurred on your integration for a specific timeframe | + +--- + +## `initialize` + +Create a new transaction + +```ts +async initialize(payload: TransactionInitializeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `amount` | `number` | true | Amount should be in smallest denomination of the currency. | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "ZAR" \| "USD"` | false | List of all support currencies | +| `reference` | `string` | false | Unique transaction reference. Only -, ., = and alphanumeric characters allowed. | +| `channels` | `Array<"apple_pay" \| "bank" \| "bank_transfer" \| "capitec_pay" \| "card" \| "eft" \| "mobile_money" \| "payattitude" \| "qr" \| "ussd">` | false | An array of payment channels to control what channels you want to make available to the user to make a payment with | +| `callback_url` | `string` | false | Fully qualified url, e.g. https://example.com/ to redirect your customers to after a successful payment. Use this to override the callback url provided on the dashboard for this transaction | +| `plan` | `string` | false | If transaction is to create a subscription to a predefined plan, provide plan code here. This would invalidate the value provided in amount | +| `invoice_limit` | `number` | false | Number of times to charge customer during subscription to plan | +| `split_code` | `string` | false | The split code of the transaction split | +| `split` | `{ name: string; type: "percentage" \| "flat"; subaccounts: Array<{ subaccount?: string; share?: number }>; currency: "NGN" \| "GHS" \| "ZAR" \| "USD"; bearer_type?: "subaccount" \| "account" \| "all-proportional" \| "all"; bearer_subaccount?: string }` | false | Split configuration for transactions | +| `subaccount` | `string` | false | The code for the subaccount that owns the payment | +| `transaction_charge` | `string` | false | A flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created | +| `bearer` | `"account" \| "subaccount"` | false | The bearer of the transaction charge | +| `label` | `string` | false | Used to replace the email address shown on the Checkout | +| `metadata` | `Record` | false | JSON object of custom data | + +### Example + +```ts +const result = await paystack.transaction.initialize({ email: "email_value", amount: 0, currency: "GHS" }); +console.log(result.data); +``` + +## `chargeAuthorization` + +Charge all authorizations marked as reusable with this endpoint whenever you need to receive payments + +```ts +async chargeAuthorization(payload: TransactionChargeAuthorizationBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `amount` | `number` | true | Amount in the lower denomination of your currency | +| `authorization_code` | `string` | true | Valid authorization code to charge | +| `reference` | `string` | false | Unique transaction reference. Only -, ., = and alphanumeric characters allowed. | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "ZAR" \| "USD"` | false | List of all support currencies | +| `split_code` | `string` | false | The split code of the transaction split | +| `split` | `{ name: string; type: "percentage" \| "flat"; subaccounts: Array<{ subaccount?: string; share?: number }>; currency: "NGN" \| "GHS" \| "ZAR" \| "USD"; bearer_type?: "subaccount" \| "account" \| "all-proportional" \| "all"; bearer_subaccount?: string }` | false | Split configuration for transactions | +| `subaccount` | `string` | false | The code for the subaccount that owns the payment | +| `transaction_charge` | `string` | false | A flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created | +| `bearer` | `"account" \| "subaccount"` | false | The bearer of the transaction charge | +| `metadata` | `string` | false | Stringified JSON object of custom data | +| `queue` | `boolean` | false | If you are making a scheduled charge call, it is a good idea to queue them so the processing system does not get overloaded causing transaction processing errors. | + +### Example + +```ts +const result = await paystack.transaction.chargeAuthorization({ email: "email_value", amount: 0, authorization_code: "authorization_code_value", reference: "reference_value" }); +console.log(result.data); +``` + +## `partialDebit` + +Retrieve part of a payment from a customer + +```ts +async partialDebit(payload: TransactionPartialDebitBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `email` | `string` | true | Customer's email address | +| `amount` | `number` | true | Specified in the lowest denomination of your currency | +| `authorization_code` | `string` | true | Valid authorization code to charge | +| `currency` | `"GHS" \| "KES" \| "NGN" \| "ZAR" \| "USD"` | true | List of all support currencies | +| `at_least` | `string` | false | Minimum amount to charge | +| `reference` | `string` | false | Unique transaction reference. Only -, ., = and alphanumeric characters allowed. | + +### Example + +```ts +const result = await paystack.transaction.partialDebit({ email: "email_value", amount: 0, authorization_code: "authorization_code_value", at_least: "at_least_value" }); +console.log(result.data); +``` + +## `verify` + +Verify a previously initiated transaction using it's reference + +```ts +async verify(reference: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `reference` | `string` | true | The transaction reference to verify | + +### Example + +```ts +const result = await paystack.transaction.verify(reference); +console.log(result.data); +``` + +## `list` + +List transactions that has occurred on your integration + +```ts +async list(query?: TransactionListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | +| `per_page` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | +| `status` | `string` | false | Filter transaction by status | +| `source` | `string` | false | The origin of the payment | +| `terminal_id` | `string` | false | Filter transactions by a terminal ID | +| `virtual_account_number` | `string` | false | Filter transactions by a virtual account number | +| `customer_code` | `string` | false | Filter transactions by a customer code | +| `amount` | `integer` | false | Filter transactions by a specific amount | +| `settlement` | `integer` | false | The settlement ID to filter for settled transactions | +| `channel` | `string` | false | The payment method the customer used to complete the transaction | +| `subaccount_code` | `string` | false | Filter transaction by subaccount code | +| `split_code` | `string` | false | Filter transaction by split code | + +### Example + +```ts +const result = await paystack.transaction.list({ /* query params */ }); +console.log(result.data); +``` + +## `fetch` + +Fetch a transaction to get its details + +```ts +async fetch(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the transaction to fetch | + +### Example + +```ts +const result = await paystack.transaction.fetch(id); +console.log(result.data); +``` + +## `timeline` + +Fetch the steps taken from the initiation to the completion of a transaction + +```ts +async timeline(id: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `id` | `integer` | true | The ID of the transaction to fetch | + +### Example + +```ts +const result = await paystack.transaction.timeline(id); +console.log(result.data); +``` + +## `totals` + +Get the total amount of all transactions + +```ts +async totals(query?: TransactionTotalsQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.transaction.totals({ /* query params */ }); +console.log(result.data); +``` + +## `export_` + +Download transactions that occurred on your integration for a specific timeframe + +```ts +async export_(query?: TransactionExportQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | +| `status` | `string` | false | Filter by the status of the transaction | +| `customer` | `number` | false | Filter by customer ID | +| `subaccount_code` | `string` | false | Filter by subaccount code | +| `settlement` | `integer` | false | Filter by the settlement ID | + +### Example + +```ts +const result = await paystack.transaction.export_({ /* query params */ }); +console.log(result.data); +``` diff --git a/docs/transfer.md b/docs/transfer.md new file mode 100644 index 0000000..b3c85b1 --- /dev/null +++ b/docs/transfer.md @@ -0,0 +1,260 @@ +# TransferApi + +A collection of endpoints for automating sending money to beneficiaries + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/transfer` | List the transfers made on your integration | +| `initiate` | `POST` | `/transfer` | Send money to your customers | +| `finalize` | `POST` | `/transfer/finalize_transfer` | Finalize an initiated transfer | +| `bulk` | `POST` | `/transfer/bulk` | Batch multiple transfers in a single request. You need to disable the Transfers OTP requirement to use this endpoint. | +| `fetch` | `GET` | `/transfer/{code}` | Get details of a transfer on your integration | +| `verify` | `GET` | `/transfer/verify/{reference}` | Verify the status of a transfer on your integration | +| `exportTransfer` | `GET` | `/transfer/export` | Export a list of transfers carried out on your integration | +| `resendOtp` | `POST` | `/transfer/resend_otp` | Generates and send a new OTP to customer in the event they are having trouble receiving one. | +| `disableOtp` | `POST` | `/transfer/disable_otp` | This is used in the event that you want to be able to complete transfers programmatically without use of OTPs. No arguments required. You will get an OTP to complete the request. | +| `disableOtpFinalize` | `POST` | `/transfer/disable_otp_finalize` | Finalize the request to disable OTP on your transfers | +| `enableOtp` | `POST` | `/transfer/enable_otp` | In the event that a customer wants to stop being able to complete transfers programmatically, this endpoint helps turn OTP requirement back on. No arguments required. | + +--- + +## `list` + +List the transfers made on your integration + +```ts +async list(query?: TransferListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | +| `per_page` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | +| `recipient` | `string` | false | Filter transfer by the recipient code | +| `status` | `string` | false | Filter transfer by status | + +### Example + +```ts +const result = await paystack.transfer.list({ /* query params */ }); +console.log(result.data); +``` + +## `initiate` + +Send money to your customers + +```ts +async initiate(payload: TransferInitiateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `amount` | `number` | true | Amount to transfer in kobo if currency is NGN and pesewas if currency is GHS. | +| `recipient` | `string` | true | The transfer recipient's code | +| `reference` | `string` | true | To ensure idempotency, you need to provide e a unique identifier for the request. The identifier should be a lowercase alphanumeric string with only -,_ symbols allowed. | +| `reason` | `string` | false | The reason or narration for the transfer. | +| `source` | `string` | true | The source of funds to send from | +| `currency` | `"NGN" \| "ZAR" \| "KES" \| "GHS"` | false | Specify the currency of the transfer. | + +### Example + +```ts +const result = await paystack.transfer.initiate({ amount: 0, recipient: "recipient_value", reference: "reference_value", reason: "reason_value" }); +console.log(result.data); +``` + +## `finalize` + +Finalize an initiated transfer + +```ts +async finalize(payload: TransferFinalizeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `transfer_code` | `string` | true | The transfer code you want to finalize | +| `otp` | `string` | true | OTP sent to business phone to verify transfer | + +### Example + +```ts +const result = await paystack.transfer.finalize({ transfer_code: "transfer_code_value", otp: "otp_value" }); +console.log(result.data); +``` + +## `bulk` + +Batch multiple transfers in a single request. You need to disable the Transfers OTP requirement to use this endpoint. + +```ts +async bulk(payload: TransferBulkBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `source` | `string` | true | The source of funds for the transfer. | +| `currency` | `"NGN" \| "ZAR" \| "KES" \| "GHS"` | false | Specify the currency of the transfer. | +| `transfers` | `Array<{ amount: number; recipient: string; reference: string; reason?: string }>` | true | A list of transfer object | + +### Example + +```ts +const result = await paystack.transfer.bulk({ source: "source_value", transfers: [], currency: "NGN" }); +console.log(result.data); +``` + +## `fetch` + +Get details of a transfer on your integration + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Transfer code | + +### Example + +```ts +const result = await paystack.transfer.fetch(code); +console.log(result.data); +``` + +## `verify` + +Verify the status of a transfer on your integration + +```ts +async verify(reference: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `reference` | `string` | true | Transfer reference | + +### Example + +```ts +const result = await paystack.transfer.verify(reference); +console.log(result.data); +``` + +## `exportTransfer` + +Export a list of transfers carried out on your integration + +```ts +async exportTransfer(query?: TransferExportTransferQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `recipient` | `string` | false | Export transfer by the recipient code | +| `status` | `string` | false | Export transfer by status | +| `from` | `string` | false | The start date | +| `to` | `string` | false | The end date | + +### Example + +```ts +const result = await paystack.transfer.exportTransfer({ /* query params */ }); +console.log(result.data); +``` + +## `resendOtp` + +Generates and send a new OTP to customer in the event they are having trouble receiving one. + +```ts +async resendOtp(payload: TransferResendOtpBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `transfer_code` | `string` | true | The transfer code that requires an OTP validation | +| `reason` | `"disable_otp" \| "resend_otp" \| "transfer"` | true | Specify the flag to indicate the purpose of the OTP | + +### Example + +```ts +const result = await paystack.transfer.resendOtp({ transfer_code: "transfer_code_value", reason: "disable_otp" }); +console.log(result.data); +``` + +## `disableOtp` + +This is used in the event that you want to be able to complete transfers programmatically without use of OTPs. No arguments required. You will get an OTP to complete the request. + +```ts +async disableOtp(): Promise>; +``` + +### Example + +```ts +const result = await paystack.transfer.disableOtp(); +console.log(result.data); +``` + +## `disableOtpFinalize` + +Finalize the request to disable OTP on your transfers + +```ts +async disableOtpFinalize(payload: TransferDisableOtpFinalizeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `otp` | `string` | true | OTP sent to business phone to verify disabling OTP requirement | + +### Example + +```ts +const result = await paystack.transfer.disableOtpFinalize({ otp: "otp_value" }); +console.log(result.data); +``` + +## `enableOtp` + +In the event that a customer wants to stop being able to complete transfers programmatically, this endpoint helps turn OTP requirement back on. No arguments required. + +```ts +async enableOtp(): Promise>; +``` + +### Example + +```ts +const result = await paystack.transfer.enableOtp(); +console.log(result.data); +``` diff --git a/docs/transferRecipient.md b/docs/transferRecipient.md new file mode 100644 index 0000000..9a1b589 --- /dev/null +++ b/docs/transferRecipient.md @@ -0,0 +1,155 @@ +# TransferRecipientApi + +A collection of endpoints for creating and managing beneficiaries that you send money to + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `transferrecipientList` | `GET` | `/transferrecipient` | List transfer recipients available on your integration | +| `transferrecipientCreate` | `POST` | `/transferrecipient` | Creates a new recipient. A duplicate account number will lead to the retrieval of the existing record. | +| `transferrecipientBulk` | `POST` | `/transferrecipient/bulk` | Create multiple transfer recipients in batches. A duplicate account number will lead to the retrieval of the existing record. | +| `transferrecipientFetch` | `GET` | `/transferrecipient/{code}` | Fetch the details of a transfer recipient | +| `transferrecipientUpdate` | `PUT` | `/transferrecipient/{code}` | Update the details of a transfer recipient | +| `transferrecipientDelete` | `DELETE` | `/transferrecipient/{code}` | Delete a transfer recipient (sets the transfer recipient to inactive) | + +--- + +## `transferrecipientList` + +List transfer recipients available on your integration + +```ts +async transferrecipientList(query?: TransferRecipientTransferrecipientListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `use_cursor` | `boolean` | false | A flag to indicate if cursor based pagination should be used | +| `next` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data | +| `previous` | `string` | false | An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data | +| `per_page` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientList({ /* query params */ }); +console.log(result.data); +``` + +## `transferrecipientCreate` + +Creates a new recipient. A duplicate account number will lead to the retrieval of the existing record. + +```ts +async transferrecipientCreate(payload: TransferRecipientTransferrecipientCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `type` | `"nuban" \| "ghipss" \| "mobile_money" \| "basa" \| "authorization"` | true | Recipient Type | +| `name` | `string` | true | The recipient's name according to their account registration. | +| `account_number` | `string` | true | Recipient's bank account number | +| `bank_code` | `string` | true | Recipient's bank code. You can get the list of Bank Codes by calling the List Banks endpoint | +| `description` | `string` | false | A description for this recipient | +| `currency` | `string` | false | Currency for the account receiving the transfer | +| `authorization_code` | `string` | false | An authorization code from a previous transaction | +| `metadata` | `Record` | false | JSON object of custom data | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientCreate({ type: "nuban", name: "name_value", account_number: "account_number_value", description: "description_value" }); +console.log(result.data); +``` + +## `transferrecipientBulk` + +Create multiple transfer recipients in batches. A duplicate account number will lead to the retrieval of the existing record. + +```ts +async transferrecipientBulk(payload: TransferRecipientTransferrecipientBulkBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `batch` | `Array<{ type: "nuban" \| "ghipss" \| "mobile_money" \| "basa" \| "authorization"; name: string; account_number: string; bank_code: string; description?: string; currency?: string; authorization_code?: string; metadata?: Record }>` | true | A list of transfer recipient object. | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientBulk({ batch: [] }); +console.log(result.data); +``` + +## `transferrecipientFetch` + +Fetch the details of a transfer recipient + +```ts +async transferrecipientFetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Transfer recipient code | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientFetch(code); +console.log(result.data); +``` + +## `transferrecipientUpdate` + +Update the details of a transfer recipient + +```ts +async transferrecipientUpdate(code: string, payload: TransferRecipientTransferrecipientUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Transfer recipient code | +| `name` | `string` | false | Recipient's name | +| `email` | `string` | false | Recipient's email address | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientUpdate(code, { name: "name_value" }); +console.log(result.data); +``` + +## `transferrecipientDelete` + +Delete a transfer recipient (sets the transfer recipient to inactive) + +```ts +async transferrecipientDelete(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Transfer recipient code | + +### Example + +```ts +const result = await paystack.transferRecipient.transferrecipientDelete(code); +console.log(result.data); +``` diff --git a/docs/virtualTerminal.md b/docs/virtualTerminal.md new file mode 100644 index 0000000..e566600 --- /dev/null +++ b/docs/virtualTerminal.md @@ -0,0 +1,217 @@ +# VirtualTerminalApi + +A collection of endpoints for building in-person payments without a physical terminal + +## Methods + +| Method | HTTP | Path | Summary | +|---|---|---|---| +| `list` | `GET` | `/virtual_terminal` | List Virtual Terminals on your integration | +| `create` | `POST` | `/virtual_terminal` | Create a Virtual Terminal on your integration | +| `fetch` | `GET` | `/virtual_terminal/{code}` | Fetch a Virtual Terminal on your integration | +| `update` | `PUT` | `/virtual_terminal/{code}` | Update a Virtual Terminal on your integration | +| `deactivate` | `PUT` | `/virtual_terminal/{code}/deactivate` | Deactivate a Virtual Terminal on your integration | +| `destinationAssign` | `POST` | `/virtual_terminal/{code}/destination/assign` | Add a destination (WhatsApp number) to a Virtual Terminal on your integration | +| `destinationUnassign` | `POST` | `/virtual_terminal/{code}/destination/unassign` | Unassign a destination (WhatsApp Number) from a Virtual Terminal on your integration | +| `addSplitCode` | `PUT` | `/virtual_terminal/{code}/split_code` | Add Split Code to Virtual Terminal | +| `deleteSplitCode` | `DELETE` | `/virtual_terminal/{code}/split_code` | Remove Split Code from Virtual Terminal | + +--- + +## `list` + +List Virtual Terminals on your integration + +```ts +async list(query?: VirtualTerminalListQuery): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `perPage` | `integer` | false | The number of records to fetch per request | +| `page` | `integer` | false | The offset to retrieve data from | + +### Example + +```ts +const result = await paystack.virtualTerminal.list({ /* query params */ }); +console.log(result.data); +``` + +## `create` + +Create a Virtual Terminal on your integration + +```ts +async create(payload: VirtualTerminalCreateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `name` | `string` | true | The name of the virtual terminal | +| `destinations` | `Array<{ target?: string; name?: string }>` | true | Array of objects containing recipients for payment notifications for the Virtual Terminal. | +| `split_code` | `string` | false | Split code to associate with the virtual terminal | +| `metadata` | `Record` | false | Additional custom data as key-value pairs | + +### Example + +```ts +const result = await paystack.virtualTerminal.create({ name: "name_value", destinations: [], split_code: "split_code_value" }); +console.log(result.data); +``` + +## `fetch` + +Fetch a Virtual Terminal on your integration + +```ts +async fetch(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | + +### Example + +```ts +const result = await paystack.virtualTerminal.fetch(code); +console.log(result.data); +``` + +## `update` + +Update a Virtual Terminal on your integration + +```ts +async update(code: string, payload: VirtualTerminalUpdateBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | +| `name` | `string` | true | Name of the virtual terminal | + +### Example + +```ts +const result = await paystack.virtualTerminal.update(code, { name: "name_value" }); +console.log(result.data); +``` + +## `deactivate` + +Deactivate a Virtual Terminal on your integration + +```ts +async deactivate(code: string): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | + +### Example + +```ts +const result = await paystack.virtualTerminal.deactivate(code); +console.log(result.data); +``` + +## `destinationAssign` + +Add a destination (WhatsApp number) to a Virtual Terminal on your integration + +```ts +async destinationAssign(code: string, payload: VirtualTerminalDestinationAssignBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | +| `destinations` | `Array<{ target?: string; name?: string }>` | true | Array of objects containing recipients for payment notifications for the Virtual Terminal. | + +### Example + +```ts +const result = await paystack.virtualTerminal.destinationAssign(code, { destinations: [] }); +console.log(result.data); +``` + +## `destinationUnassign` + +Unassign a destination (WhatsApp Number) from a Virtual Terminal on your integration + +```ts +async destinationUnassign(code: string, payload: VirtualTerminalDestinationUnassignBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | +| `targets` | `Array` | true | Array of destination targets to unassign | + +### Example + +```ts +const result = await paystack.virtualTerminal.destinationUnassign(code, { targets: [] }); +console.log(result.data); +``` + +## `addSplitCode` + +Add Split Code to Virtual Terminal + +```ts +async addSplitCode(code: string, payload: VirtualTerminalAddSplitCodeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | +| `split_code` | `string` | true | The split code to assign to the virtual terminal | + +### Example + +```ts +const result = await paystack.virtualTerminal.addSplitCode(code, { split_code: "split_code_value" }); +console.log(result.data); +``` + +## `deleteSplitCode` + +Remove Split Code from Virtual Terminal + +```ts +async deleteSplitCode(code: string, payload: VirtualTerminalDeleteSplitCodeBody): Promise>; +``` + +### Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| `code` | `string` | true | Code of the Virtual Terminal | +| `split_code` | `string` | true | The split code to assign to the virtual terminal | + +### Example + +```ts +const result = await paystack.virtualTerminal.deleteSplitCode(code, { split_code: "split_code_value" }); +console.log(result.data); +``` diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index c621531..0000000 --- a/package-lock.json +++ /dev/null @@ -1,2066 +0,0 @@ -{ - "name": "@paystack/paystack-sdk", - "version": "1.2.1-beta.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@paystack/paystack-sdk", - "version": "1.2.1-beta.1", - "license": "MIT", - "devDependencies": { - "@types/node": "^15.0.3", - "tsup": "^8.1.0", - "typescript": "^5.5.2" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", - "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", - "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", - "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", - "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", - "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", - "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", - "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", - "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", - "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", - "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", - "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", - "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", - "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", - "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", - "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", - "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true - }, - "node_modules/@types/node": { - "version": "15.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.9.tgz", - "integrity": "sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==", - "dev": true - }, - "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bundle-require": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.2.1.tgz", - "integrity": "sha512-7Q/6vkyYAwOmQNRw75x+4yRtZCZJXUDmHHlFdkiV0wgv/reNjtJwpu1jPJ0w2kbEpIM0uoKI3S4/f39dU7AjSA==", - "dev": true, - "dependencies": { - "load-tsconfig": "^0.2.3" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "peerDependencies": { - "esbuild": ">=0.17" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/foreground-child": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", - "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", - "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/jackspeak": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", - "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/joycon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", - "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/lilconfig": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", - "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antonk52" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/load-tsconfig": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", - "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", - "dev": true, - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", - "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/postcss-load-config": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", - "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "lilconfig": "^3.0.0", - "yaml": "^2.3.4" - }, - "engines": { - "node": ">= 14" - }, - "peerDependencies": { - "postcss": ">=8.0.9", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "postcss": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", - "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.18.0", - "@rollup/rollup-android-arm64": "4.18.0", - "@rollup/rollup-darwin-arm64": "4.18.0", - "@rollup/rollup-darwin-x64": "4.18.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", - "@rollup/rollup-linux-arm-musleabihf": "4.18.0", - "@rollup/rollup-linux-arm64-gnu": "4.18.0", - "@rollup/rollup-linux-arm64-musl": "4.18.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", - "@rollup/rollup-linux-riscv64-gnu": "4.18.0", - "@rollup/rollup-linux-s390x-gnu": "4.18.0", - "@rollup/rollup-linux-x64-gnu": "4.18.0", - "@rollup/rollup-linux-x64-musl": "4.18.0", - "@rollup/rollup-win32-arm64-msvc": "4.18.0", - "@rollup/rollup-win32-ia32-msvc": "4.18.0", - "@rollup/rollup-win32-x64-msvc": "4.18.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.8.0-beta.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", - "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", - "dev": true, - "dependencies": { - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/sucrase": { - "version": "3.35.0", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", - "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.2", - "commander": "^4.0.0", - "glob": "^10.3.10", - "lines-and-columns": "^1.1.6", - "mz": "^2.7.0", - "pirates": "^4.0.1", - "ts-interface-checker": "^0.1.9" - }, - "bin": { - "sucrase": "bin/sucrase", - "sucrase-node": "bin/sucrase-node" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, - "bin": { - "tree-kill": "cli.js" - } - }, - "node_modules/ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", - "dev": true - }, - "node_modules/tsup": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.1.0.tgz", - "integrity": "sha512-UFdfCAXukax+U6KzeTNO2kAARHcWxmKsnvSPXUcfA1D+kU05XDccCrkffCQpFaWDsZfV0jMyTsxU39VfCp6EOg==", - "dev": true, - "dependencies": { - "bundle-require": "^4.0.0", - "cac": "^6.7.12", - "chokidar": "^3.5.1", - "debug": "^4.3.1", - "esbuild": "^0.21.4", - "execa": "^5.0.0", - "globby": "^11.0.3", - "joycon": "^3.0.1", - "postcss-load-config": "^4.0.1", - "resolve-from": "^5.0.0", - "rollup": "^4.0.2", - "source-map": "0.8.0-beta.0", - "sucrase": "^3.20.3", - "tree-kill": "^1.2.2" - }, - "bin": { - "tsup": "dist/cli-default.js", - "tsup-node": "dist/cli-node.js" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@microsoft/api-extractor": "^7.36.0", - "@swc/core": "^1", - "postcss": "^8.4.12", - "typescript": ">=4.5.0" - }, - "peerDependenciesMeta": { - "@microsoft/api-extractor": { - "optional": true - }, - "@swc/core": { - "optional": true - }, - "postcss": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yaml": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", - "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", - "dev": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - } - } -} diff --git a/package.json b/package.json index f86d7c9..0230bdd 100644 --- a/package.json +++ b/package.json @@ -1,43 +1,33 @@ { "name": "@paystack/paystack-sdk", "version": "1.2.1-beta.2", - "description": "Paystack API wrapper for Node", - "author": "Paystack (https://paystack.com/docs)", - "keywords": [ - "paystack", - "payment", - "cards", - "charge", - "recurring payment", - "subscriptions", - "transfers", - "single transfers", - "bulk transfers", - "send money", - "multi splits" - ], - "homepage": "https://github.com/PaystackOSS/paystack-node", - "bugs": "https://github.com/PaystackOSS/paystack-node/issues", - "license": "MIT", - "main": "./dist/index.js", + "description": "Generated Paystack Node.js SDK", + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + }, + "./models": { + "types": "./dist/models/index.d.ts", + "import": "./dist/models/index.mjs", + "require": "./dist/models/index.cjs" + } + }, + "main": "./dist/index.cjs", "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "tsup": { - "entry": [ - "src/index.ts" - ], - "splitting": true, - "sourcemap": false, - "clean": true - }, + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], "scripts": { - "build": "npm run clean && tsup --format esm,cjs --dts", - "clean": "rm -rf ./dist", - "compile": "tsc -p tsconfig.esm.json && tsc -p ./tsconfig.cjs.json && tsc -p ./tsconfig.types.json" + "build": "tsup", + "test": "vitest run" }, "devDependencies": { - "@types/node": "^15.0.3", - "tsup": "^8.1.0", - "typescript": "^5.5.2" + "tsup": "^8.0.0", + "typescript": "^5.0.0", + "vitest": "^1.0.0" } } diff --git a/src/apis/Balance.ts b/src/apis/Balance.ts deleted file mode 100644 index ef96d21..0000000 --- a/src/apis/Balance.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface LedgerRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -/** - * - */ -export class Balance extends BaseAPI { - - /** - * You can only transfer from what you have - * Fetch Balance - */ - async fetch(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/balance`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Balance Ledger - */ - async ledger(requestParameters: LedgerRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/balance/ledger`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/BulkCharge.ts b/src/apis/BulkCharge.ts deleted file mode 100644 index baebea5..0000000 --- a/src/apis/BulkCharge.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface ChargesRequest { - code: string; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface PauseRequest { - code: string; -} - -export interface ResumeRequest { - code: string; -} - -/** - * - */ -export class BulkCharge extends BaseAPI { - - /** - * Fetch Charges in a Batch - */ - async charges(requestParameters: ChargesRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling charges.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/bulkcharge/{code}/charges`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Bulk Charge Batch - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/bulkcharge/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Initiate Bulk Charge - */ - async initiate(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/bulkcharge`, - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Bulk Charge Batches - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/bulkcharge`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Pause Bulk Charge Batch - */ - async pause(requestParameters: PauseRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling pause.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/bulkcharge/pause/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Resume Bulk Charge Batch - */ - async resume(requestParameters: ResumeRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling resume.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/bulkcharge/resume/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Charge.ts b/src/apis/Charge.ts deleted file mode 100644 index f1da914..0000000 --- a/src/apis/Charge.ts +++ /dev/null @@ -1,350 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Bank, - EFT, - MobileMoney, - Response, - USSD, - ResponseFromJSON -} from '../models'; - -export interface CheckRequest { - reference: string; -} - -export interface CreateRequest { - email?: string; - amount?: string; - authorization_code?: string; - pin?: string; - reference?: string; - birthday?: Date; - device_id?: string; - metadata?: string; - bank?: Bank; - mobile_money?: MobileMoney; - ussd?: USSD; - eft?: EFT; -} - -export interface SubmitAddressRequest { - address: string; - city: string; - state: string; - zipcode: string; - reference: string; -} - -export interface SubmitBirthdayRequest { - birthday: string; - reference: string; -} - -export interface SubmitOtpRequest { - otp: string; - reference: string; -} - -export interface SubmitPhoneRequest { - phone: string; - reference: string; -} - -export interface SubmitPinRequest { - pin: string; - reference: string; -} - -/** - * - */ -export class Charge extends BaseAPI { - - /** - * Check pending charge - */ - async check(requestParameters: CheckRequest): Promise { - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling check.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/charge/{reference}`.replace(`{${"reference"}}`, encodeURIComponent(String(requestParameters.reference))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Charge - */ - async create(requestParameters: CreateRequest): Promise { - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - if (requestParameters.pin !== undefined) { - formParams['pin'] = requestParameters.pin; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - if (requestParameters.birthday !== undefined) { - formParams['birthday'] = requestParameters.birthday; - } - - if (requestParameters.device_id !== undefined) { - formParams['device_id'] = requestParameters.device_id; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - if (requestParameters.bank !== undefined) { - formParams['bank'] = requestParameters.bank; - } - - if (requestParameters.mobile_money !== undefined) { - formParams['mobile_money'] = requestParameters.mobile_money; - } - - if (requestParameters.ussd !== undefined) { - formParams['ussd'] = requestParameters.ussd; - } - - if (requestParameters.eft !== undefined) { - formParams['eft'] = requestParameters.eft; - } - - - const response = await this.request({ - path: `/charge`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Submit Address - */ - async submitAddress(requestParameters: SubmitAddressRequest): Promise { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new RequiredError('address','Required parameter address was null or undefined when calling submitAddress.'); - } - if (requestParameters.city === null || requestParameters.city === undefined) { - throw new RequiredError('city','Required parameter city was null or undefined when calling submitAddress.'); - } - if (requestParameters.state === null || requestParameters.state === undefined) { - throw new RequiredError('state','Required parameter state was null or undefined when calling submitAddress.'); - } - if (requestParameters.zipcode === null || requestParameters.zipcode === undefined) { - throw new RequiredError('zipcode','Required parameter zipcode was null or undefined when calling submitAddress.'); - } - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling submitAddress.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.address !== undefined) { - formParams['address'] = requestParameters.address; - } - - if (requestParameters.city !== undefined) { - formParams['city'] = requestParameters.city; - } - - if (requestParameters.state !== undefined) { - formParams['state'] = requestParameters.state; - } - - if (requestParameters.zipcode !== undefined) { - formParams['zipcode'] = requestParameters.zipcode; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/charge/submit_address`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Submit Birthday - */ - async submitBirthday(requestParameters: SubmitBirthdayRequest): Promise { - if (requestParameters.birthday === null || requestParameters.birthday === undefined) { - throw new RequiredError('birthday','Required parameter birthday was null or undefined when calling submitBirthday.'); - } - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling submitBirthday.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.birthday !== undefined) { - formParams['birthday'] = requestParameters.birthday; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/charge/submit_birthday`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Submit OTP - */ - async submitOtp(requestParameters: SubmitOtpRequest): Promise { - if (requestParameters.otp === null || requestParameters.otp === undefined) { - throw new RequiredError('otp','Required parameter otp was null or undefined when calling submitOtp.'); - } - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling submitOtp.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.otp !== undefined) { - formParams['otp'] = requestParameters.otp; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/charge/submit_otp`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Submit Phone - */ - async submitPhone(requestParameters: SubmitPhoneRequest): Promise { - if (requestParameters.phone === null || requestParameters.phone === undefined) { - throw new RequiredError('phone','Required parameter phone was null or undefined when calling submitPhone.'); - } - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling submitPhone.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.phone !== undefined) { - formParams['phone'] = requestParameters.phone; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/charge/submit_phone`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Submit PIN - */ - async submitPin(requestParameters: SubmitPinRequest): Promise { - if (requestParameters.pin === null || requestParameters.pin === undefined) { - throw new RequiredError('pin','Required parameter pin was null or undefined when calling submitPin.'); - } - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling submitPin.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.pin !== undefined) { - formParams['pin'] = requestParameters.pin; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/charge/submit_pin`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Customer.ts b/src/apis/Customer.ts deleted file mode 100644 index 123a117..0000000 --- a/src/apis/Customer.ts +++ /dev/null @@ -1,357 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Accepted, - Response, - ResponseFromJSON -} from '../models'; - -export interface CreateRequest { - email: string; - first_name?: string; - last_name?: string; - phone?: string; - metadata?: string; -} - -export interface DeactivateAuthorizationRequest { - authorization_code: string; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - use_cursor?: boolean; - next?: string; - previous?: string; - from?: string; - to?: string; - perPage?: string; - page?: string; -} - -export interface RiskActionRequest { - customer: string; - risk_action?: string; -} - -export interface UpdateRequest { - code: string; - first_name?: string; - last_name?: string; - phone?: string; - metadata?: string; -} - -export interface ValidateRequest { - code: string; - first_name: string; - last_name: string; - type: string; - country: string; - bvn: string; - bank_code: string; - account_number: string; - value?: string; -} - -/** - * - */ -export class Customer extends BaseAPI { - - /** - * Create Customer - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.email === null || requestParameters.email === undefined) { - throw new RequiredError('email','Required parameter email was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.first_name !== undefined) { - formParams['first_name'] = requestParameters.first_name; - } - - if (requestParameters.last_name !== undefined) { - formParams['last_name'] = requestParameters.last_name; - } - - if (requestParameters.phone !== undefined) { - formParams['phone'] = requestParameters.phone; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - - const response = await this.request({ - path: `/customer`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Deactivate a customer\'s card - * Deactivate Authorization - */ - async deactivateAuthorization(requestParameters: DeactivateAuthorizationRequest): Promise { - if (requestParameters.authorization_code === null || requestParameters.authorization_code === undefined) { - throw new RequiredError('authorization_code','Required parameter authorization_code was null or undefined when calling deactivateAuthorization.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - - const response = await this.request({ - path: `/customer/deactivate_authorization`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Customer - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/customer/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List customers on your integration - * List Customers - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.use_cursor !== undefined) { - queryParameters['use_cursor'] = requestParameters.use_cursor; - } - - if (requestParameters.next !== undefined) { - queryParameters['next'] = requestParameters.next; - } - - if (requestParameters.previous !== undefined) { - queryParameters['previous'] = requestParameters.previous; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = requestParameters.from; - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = requestParameters.to; - } - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - - const response = await this.request({ - path: `/customer`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Set customer\'s risk action by whitelisting or blacklisting the customer - * White/blacklist Customer - */ - async riskAction(requestParameters: RiskActionRequest): Promise { - if (requestParameters.customer === null || requestParameters.customer === undefined) { - throw new RequiredError('customer','Required parameter customer was null or undefined when calling riskAction.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer !== undefined) { - formParams['customer'] = requestParameters.customer; - } - - if (requestParameters.risk_action !== undefined) { - formParams['risk_action'] = requestParameters.risk_action; - } - - - const response = await this.request({ - path: `/customer/set_risk_action`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Customer - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.first_name !== undefined) { - formParams['first_name'] = requestParameters.first_name; - } - - if (requestParameters.last_name !== undefined) { - formParams['last_name'] = requestParameters.last_name; - } - - if (requestParameters.phone !== undefined) { - formParams['phone'] = requestParameters.phone; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - - const response = await this.request({ - path: `/customer/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Validate a customer\'s identity - * Validate Customer - */ - async validate(requestParameters: ValidateRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling validate.'); - } - if (requestParameters.first_name === null || requestParameters.first_name === undefined) { - throw new RequiredError('first_name','Required parameter first_name was null or undefined when calling validate.'); - } - if (requestParameters.last_name === null || requestParameters.last_name === undefined) { - throw new RequiredError('last_name','Required parameter last_name was null or undefined when calling validate.'); - } - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new RequiredError('type','Required parameter type was null or undefined when calling validate.'); - } - if (requestParameters.country === null || requestParameters.country === undefined) { - throw new RequiredError('country','Required parameter country was null or undefined when calling validate.'); - } - if (requestParameters.bvn === null || requestParameters.bvn === undefined) { - throw new RequiredError('bvn','Required parameter bvn was null or undefined when calling validate.'); - } - if (requestParameters.bank_code === null || requestParameters.bank_code === undefined) { - throw new RequiredError('bank_code','Required parameter bank_code was null or undefined when calling validate.'); - } - if (requestParameters.account_number === null || requestParameters.account_number === undefined) { - throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling validate.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.first_name !== undefined) { - formParams['first_name'] = requestParameters.first_name; - } - - if (requestParameters.last_name !== undefined) { - formParams['last_name'] = requestParameters.last_name; - } - - if (requestParameters.type !== undefined) { - formParams['type'] = requestParameters.type; - } - - if (requestParameters.country !== undefined) { - formParams['country'] = requestParameters.country; - } - - if (requestParameters.bvn !== undefined) { - formParams['bvn'] = requestParameters.bvn; - } - - if (requestParameters.bank_code !== undefined) { - formParams['bank_code'] = requestParameters.bank_code; - } - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.value !== undefined) { - formParams['value'] = requestParameters.value; - } - - - const response = await this.request({ - path: `/customer/{code}/identification`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/DedicatedVirtualAccount.ts b/src/apis/DedicatedVirtualAccount.ts deleted file mode 100644 index 2ad939e..0000000 --- a/src/apis/DedicatedVirtualAccount.ts +++ /dev/null @@ -1,273 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface AddSplitRequest { - account_number: string; - subaccount?: string; - split_code?: string; -} - -export interface CreateRequest { - customer: string; - preferred_bank?: string; - subaccount?: string; - split_code?: string; -} - -export interface DeactivateRequest { - account_id: string; -} - -export interface FetchRequest { - account_id: string; -} - -export interface ListRequest { - account_number?: string; - customer?: string; - active?: boolean; - currency?: string; - provider_slug?: string; - bank_id?: string; - perPage?: string; - page?: string; -} - -export interface RemoveSplitRequest { - account_number: string; - subaccount?: string; - split_code?: string; -} - -/** - * - */ -export class DedicatedVirtualAccount extends BaseAPI { - - /** - * Split Dedicated Account Transaction - */ - async addSplit(requestParameters: AddSplitRequest): Promise { - if (requestParameters.account_number === null || requestParameters.account_number === undefined) { - throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling addSplit.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - - const response = await this.request({ - path: `/dedicated_account/split`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Bank Providers - */ - async availableProviders(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dedicated_account/available_providers`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Dedicated Account - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.customer === null || requestParameters.customer === undefined) { - throw new RequiredError('customer','Required parameter customer was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer !== undefined) { - formParams['customer'] = requestParameters.customer; - } - - if (requestParameters.preferred_bank !== undefined) { - formParams['preferred_bank'] = requestParameters.preferred_bank; - } - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - - const response = await this.request({ - path: `/dedicated_account`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Deactivate Dedicated Account - */ - async deactivate(requestParameters: DeactivateRequest): Promise { - if (requestParameters.account_id === null || requestParameters.account_id === undefined) { - throw new RequiredError('account_id','Required parameter account_id was null or undefined when calling deactivate.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dedicated_account/{account_id}`.replace(`{${"account_id"}}`, encodeURIComponent(String(requestParameters.account_id))), - method: 'DELETE', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Dedicated Account - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.account_id === null || requestParameters.account_id === undefined) { - throw new RequiredError('account_id','Required parameter account_id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dedicated_account/{account_id}`.replace(`{${"account_id"}}`, encodeURIComponent(String(requestParameters.account_id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Dedicated Accounts - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.account_number !== undefined) { - queryParameters['account_number'] = requestParameters.account_number; - } - - if (requestParameters.customer !== undefined) { - queryParameters['customer'] = requestParameters.customer; - } - - if (requestParameters.active !== undefined) { - queryParameters['active'] = requestParameters.active; - } - - if (requestParameters.currency !== undefined) { - queryParameters['currency'] = requestParameters.currency; - } - - if (requestParameters.provider_slug !== undefined) { - queryParameters['provider_slug'] = requestParameters.provider_slug; - } - - if (requestParameters.bank_id !== undefined) { - queryParameters['bank_id'] = requestParameters.bank_id; - } - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - - const response = await this.request({ - path: `/dedicated_account`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Remove Split from Dedicated Account - */ - async removeSplit(requestParameters: RemoveSplitRequest): Promise { - if (requestParameters.account_number === null || requestParameters.account_number === undefined) { - throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling removeSplit.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - - const response = await this.request({ - path: `/dedicated_account/split`, - method: 'DELETE', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Dispute.ts b/src/apis/Dispute.ts deleted file mode 100644 index bd5eb15..0000000 --- a/src/apis/Dispute.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface DownloadRequest { - perPage?: number; - page?: number; - status?: string; - from?: Date; - to?: Date; -} - -export interface EvidenceRequest { - id: string; - customer_email: string; - customer_name: string; - customer_phone: string; - service_details: string; - delivery_address?: string; - delivery_date?: Date; -} - -export interface FetchRequest { - id: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - status?: string; - transaction?: string; - from?: Date; - to?: Date; -} - -export interface ResolveRequest { - id: string; - resolution: string; - message: string; - refund_amount: string; - uploaded_filename: string; - evidence?: number; -} - -export interface TransactionRequest { - id: string; -} - -export interface UpdateRequest { - id: string; - refund_amount: string; - uploaded_filename?: string; -} - -export interface UploadUrlRequest { - id: string; -} - -/** - * - */ -export class Dispute extends BaseAPI { - - /** - * Export Disputes - */ - async download(requestParameters: DownloadRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/dispute/export`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Add Evidence - */ - async evidence(requestParameters: EvidenceRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling evidence.'); - } - if (requestParameters.customer_email === null || requestParameters.customer_email === undefined) { - throw new RequiredError('customer_email','Required parameter customer_email was null or undefined when calling evidence.'); - } - if (requestParameters.customer_name === null || requestParameters.customer_name === undefined) { - throw new RequiredError('customer_name','Required parameter customer_name was null or undefined when calling evidence.'); - } - if (requestParameters.customer_phone === null || requestParameters.customer_phone === undefined) { - throw new RequiredError('customer_phone','Required parameter customer_phone was null or undefined when calling evidence.'); - } - if (requestParameters.service_details === null || requestParameters.service_details === undefined) { - throw new RequiredError('service_details','Required parameter service_details was null or undefined when calling evidence.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer_email !== undefined) { - formParams['customer_email'] = requestParameters.customer_email; - } - - if (requestParameters.customer_name !== undefined) { - formParams['customer_name'] = requestParameters.customer_name; - } - - if (requestParameters.customer_phone !== undefined) { - formParams['customer_phone'] = requestParameters.customer_phone; - } - - if (requestParameters.service_details !== undefined) { - formParams['service_details'] = requestParameters.service_details; - } - - if (requestParameters.delivery_address !== undefined) { - formParams['delivery_address'] = requestParameters.delivery_address; - } - - if (requestParameters.delivery_date !== undefined) { - formParams['delivery_date'] = requestParameters.delivery_date; - } - - - const response = await this.request({ - path: `/dispute/{id}/evidence`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Dispute - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dispute/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Disputes - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.transaction !== undefined) { - queryParameters['transaction'] = requestParameters.transaction; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/dispute`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Resolve a Dispute - */ - async resolve(requestParameters: ResolveRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling resolve.'); - } - if (requestParameters.resolution === null || requestParameters.resolution === undefined) { - throw new RequiredError('resolution','Required parameter resolution was null or undefined when calling resolve.'); - } - if (requestParameters.message === null || requestParameters.message === undefined) { - throw new RequiredError('message','Required parameter message was null or undefined when calling resolve.'); - } - if (requestParameters.refund_amount === null || requestParameters.refund_amount === undefined) { - throw new RequiredError('refund_amount','Required parameter refund_amount was null or undefined when calling resolve.'); - } - if (requestParameters.uploaded_filename === null || requestParameters.uploaded_filename === undefined) { - throw new RequiredError('uploaded_filename','Required parameter uploaded_filename was null or undefined when calling resolve.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.resolution !== undefined) { - formParams['resolution'] = requestParameters.resolution; - } - - if (requestParameters.message !== undefined) { - formParams['message'] = requestParameters.message; - } - - if (requestParameters.refund_amount !== undefined) { - formParams['refund_amount'] = requestParameters.refund_amount; - } - - if (requestParameters.uploaded_filename !== undefined) { - formParams['uploaded_filename'] = requestParameters.uploaded_filename; - } - - if (requestParameters.evidence !== undefined) { - formParams['evidence'] = requestParameters.evidence; - } - - - const response = await this.request({ - path: `/dispute/{id}/resolve`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * List Transaction Disputes - */ - async transaction(requestParameters: TransactionRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling transaction.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dispute/transaction/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Dispute - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling update.'); - } - if (requestParameters.refund_amount === null || requestParameters.refund_amount === undefined) { - throw new RequiredError('refund_amount','Required parameter refund_amount was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.refund_amount !== undefined) { - formParams['refund_amount'] = requestParameters.refund_amount; - } - - if (requestParameters.uploaded_filename !== undefined) { - formParams['uploaded_filename'] = requestParameters.uploaded_filename; - } - - - const response = await this.request({ - path: `/dispute/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Get Upload URL - */ - async uploadUrl(requestParameters: UploadUrlRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling uploadUrl.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/dispute/{id}/upload_url`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Integration.ts b/src/apis/Integration.ts deleted file mode 100644 index 0ff7509..0000000 --- a/src/apis/Integration.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface UpdatePaymentSessionTimeoutRequest { - body?: object; -} - -/** - * - */ -export class Integration extends BaseAPI { - - /** - * Fetch Payment Session Timeout - */ - async fetchPaymentSessionTimeout(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/integration/payment_session_timeout`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Payment Session Timeout - */ - async updatePaymentSessionTimeout(requestParameters: UpdatePaymentSessionTimeoutRequest): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/integration/payment_session_timeout`, - method: 'PUT', - query: queryParameters, - body: requestParameters.body as any, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Page.ts b/src/apis/Page.ts deleted file mode 100644 index ee5810e..0000000 --- a/src/apis/Page.ts +++ /dev/null @@ -1,252 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface AddProductsRequest { - id: string; - product: Array; -} - -export interface CheckSlugAvailabilityRequest { - slug: string; -} - -export interface CreateRequest { - name: string; - description?: string; - amount?: number; - slug?: string; - metadata?: string; - redirect_url?: string; - custom_fields?: Array; -} - -export interface FetchRequest { - id: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface UpdateRequest { - id: string; - name?: string; - description?: string; - amount?: number; - active?: boolean; -} - -/** - * - */ -export class Page extends BaseAPI { - - /** - * Add Products - */ - async addProducts(requestParameters: AddProductsRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling addProducts.'); - } - if (requestParameters.product === null || requestParameters.product === undefined) { - throw new RequiredError('product','Required parameter product was null or undefined when calling addProducts.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.product) { - formParams['product'] = requestParameters.product; - } - - - const response = await this.request({ - path: `/page/{id}/product`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Check Slug Availability - */ - async checkSlugAvailability(requestParameters: CheckSlugAvailabilityRequest): Promise { - if (requestParameters.slug === null || requestParameters.slug === undefined) { - throw new RequiredError('slug','Required parameter slug was null or undefined when calling checkSlugAvailability.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/page/check_slug_availability/{slug}`.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters.slug))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Page - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new RequiredError('name','Required parameter name was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.slug !== undefined) { - formParams['slug'] = requestParameters.slug; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - if (requestParameters.redirect_url !== undefined) { - formParams['redirect_url'] = requestParameters.redirect_url; - } - - if (requestParameters.custom_fields) { - formParams['custom_fields'] = requestParameters.custom_fields; - } - - - const response = await this.request({ - path: `/page`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Page - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/page/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Pages - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/page`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Page - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.active !== undefined) { - formParams['active'] = requestParameters.active; - } - - - const response = await this.request({ - path: `/page/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/PaymentRequest.ts b/src/apis/PaymentRequest.ts deleted file mode 100644 index 7108bb9..0000000 --- a/src/apis/PaymentRequest.ts +++ /dev/null @@ -1,383 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface ArchiveRequest { - id: string; -} - -export interface CreateRequest { - customer: string; - amount?: number; - currency?: string; - due_date?: Date; - description?: string; - line_items?: Array; - tax?: Array; - send_notification?: Array; - draft?: Array; - has_invoice?: Array; - invoice_number?: number; - split_code?: string; -} - -export interface FetchRequest { - id: string; -} - -export interface FinalizeRequest { - id: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - customer?: string; - status?: string; - currency?: string; - from?: Date; - to?: Date; -} - -export interface NotifyRequest { - id: string; -} - -export interface UpdateRequest { - id: string; - customer?: string; - amount?: number; - currency?: string; - due_date?: Date; - description?: string; - line_items?: Array; - tax?: Array; - send_notification?: Array; - draft?: Array; - has_invoice?: Array; - invoice_number?: number; - split_code?: string; -} - -export interface VerifyRequest { - id: string; -} - -/** - * - */ -export class PaymentRequest extends BaseAPI { - - /** - * Archive Payment Request - */ - async archive(requestParameters: ArchiveRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling archive.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/archive/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Payment Request - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.customer === null || requestParameters.customer === undefined) { - throw new RequiredError('customer','Required parameter customer was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer !== undefined) { - formParams['customer'] = requestParameters.customer; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.due_date !== undefined) { - formParams['due_date'] = requestParameters.due_date; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.line_items) { - formParams['line_items'] = requestParameters.line_items; - } - - if (requestParameters.tax) { - formParams['tax'] = requestParameters.tax; - } - - if (requestParameters.send_notification) { - formParams['send_notification'] = requestParameters.send_notification; - } - - if (requestParameters.draft) { - formParams['draft'] = requestParameters.draft; - } - - if (requestParameters.has_invoice) { - formParams['has_invoice'] = requestParameters.has_invoice; - } - - if (requestParameters.invoice_number !== undefined) { - formParams['invoice_number'] = requestParameters.invoice_number; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - - const response = await this.request({ - path: `/paymentrequest`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Payment Request - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Finalize Payment Request - */ - async finalize(requestParameters: FinalizeRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling finalize.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/finalize/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Payment Request - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.customer !== undefined) { - queryParameters['customer'] = requestParameters.customer; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.currency !== undefined) { - queryParameters['currency'] = requestParameters.currency; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/paymentrequest`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Send Notification - */ - async notify(requestParameters: NotifyRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling notify.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/notify/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Payment Request Total - */ - async totals(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/totals`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Payment Request - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer !== undefined) { - formParams['customer'] = requestParameters.customer; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.due_date !== undefined) { - formParams['due_date'] = requestParameters.due_date; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.line_items) { - formParams['line_items'] = requestParameters.line_items; - } - - if (requestParameters.tax) { - formParams['tax'] = requestParameters.tax; - } - - if (requestParameters.send_notification) { - formParams['send_notification'] = requestParameters.send_notification; - } - - if (requestParameters.draft) { - formParams['draft'] = requestParameters.draft; - } - - if (requestParameters.has_invoice) { - formParams['has_invoice'] = requestParameters.has_invoice; - } - - if (requestParameters.invoice_number !== undefined) { - formParams['invoice_number'] = requestParameters.invoice_number; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - - const response = await this.request({ - path: `/paymentrequest/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Verify Payment Request - */ - async verify(requestParameters: VerifyRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling verify.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/paymentrequest/verify/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Plan.ts b/src/apis/Plan.ts deleted file mode 100644 index 0a729c9..0000000 --- a/src/apis/Plan.ts +++ /dev/null @@ -1,236 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface CreateRequest { - name: string; - amount: number; - interval: string; - description?: string; - send_invoices?: boolean; - send_sms?: boolean; - currency?: string; - invoice_limit?: number; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - interval?: string; - amount?: number; - from?: Date; - to?: Date; -} - -export interface UpdateRequest { - code: string; - name?: string; - amount?: number; - interval?: string; - description?: boolean; - send_invoices?: boolean; - send_sms?: boolean; - currency?: string; - invoice_limit?: number; -} - -/** - * - */ -export class Plan extends BaseAPI { - - /** - * Create Plan - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new RequiredError('name','Required parameter name was null or undefined when calling create.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling create.'); - } - if (requestParameters.interval === null || requestParameters.interval === undefined) { - throw new RequiredError('interval','Required parameter interval was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.interval !== undefined) { - formParams['interval'] = requestParameters.interval; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.send_invoices !== undefined) { - formParams['send_invoices'] = requestParameters.send_invoices; - } - - if (requestParameters.send_sms !== undefined) { - formParams['send_sms'] = requestParameters.send_sms; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.invoice_limit !== undefined) { - formParams['invoice_limit'] = requestParameters.invoice_limit; - } - - - const response = await this.request({ - path: `/plan`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Plan - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/plan/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Plans - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.interval !== undefined) { - queryParameters['interval'] = requestParameters.interval; - } - - if (requestParameters.amount !== undefined) { - queryParameters['amount'] = requestParameters.amount; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/plan`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Plan - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.interval !== undefined) { - formParams['interval'] = requestParameters.interval; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.send_invoices !== undefined) { - formParams['send_invoices'] = requestParameters.send_invoices; - } - - if (requestParameters.send_sms !== undefined) { - formParams['send_sms'] = requestParameters.send_sms; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.invoice_limit !== undefined) { - formParams['invoice_limit'] = requestParameters.invoice_limit; - } - - - const response = await this.request({ - path: `/plan/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Product.ts b/src/apis/Product.ts deleted file mode 100644 index ce1d99b..0000000 --- a/src/apis/Product.ts +++ /dev/null @@ -1,237 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface DeleteRequest { - id: string; -} - -export interface CreateRequest { - name: string; - description: string; - price: number; - currency: string; - limited?: boolean; - quantity?: number; -} - -export interface FetchRequest { - id: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - active?: boolean; - from?: Date; - to?: Date; -} - -export interface UpdateRequest { - id: string; - name?: string; - description?: string; - price?: number; - currency?: string; - limited?: boolean; - quantity?: number; -} - -/** - * - */ -export class Product extends BaseAPI { - - /** - * Delete Product - */ - async _delete(requestParameters: DeleteRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling _delete.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/product/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'DELETE', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Product - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new RequiredError('name','Required parameter name was null or undefined when calling create.'); - } - if (requestParameters.description === null || requestParameters.description === undefined) { - throw new RequiredError('description','Required parameter description was null or undefined when calling create.'); - } - if (requestParameters.price === null || requestParameters.price === undefined) { - throw new RequiredError('price','Required parameter price was null or undefined when calling create.'); - } - if (requestParameters.currency === null || requestParameters.currency === undefined) { - throw new RequiredError('currency','Required parameter currency was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.price !== undefined) { - formParams['price'] = requestParameters.price; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.limited !== undefined) { - formParams['limited'] = requestParameters.limited; - } - - if (requestParameters.quantity !== undefined) { - formParams['quantity'] = requestParameters.quantity; - } - - - const response = await this.request({ - path: `/product`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Product - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/product/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Products - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.active !== undefined) { - queryParameters['active'] = requestParameters.active; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/product`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update product - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.price !== undefined) { - formParams['price'] = requestParameters.price; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.limited !== undefined) { - formParams['limited'] = requestParameters.limited; - } - - if (requestParameters.quantity !== undefined) { - formParams['quantity'] = requestParameters.quantity; - } - - - const response = await this.request({ - path: `/product/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Refund.ts b/src/apis/Refund.ts deleted file mode 100644 index 3ddd4aa..0000000 --- a/src/apis/Refund.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface CreateRequest { - transaction: string; - amount?: number; - currency?: string; - customer_note?: string; - merchant_note?: string; -} - -export interface FetchRequest { - id: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -/** - * - */ -export class Refund extends BaseAPI { - - /** - * Create Refund - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.transaction === null || requestParameters.transaction === undefined) { - throw new RequiredError('transaction','Required parameter transaction was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.transaction !== undefined) { - formParams['transaction'] = requestParameters.transaction; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.customer_note !== undefined) { - formParams['customer_note'] = requestParameters.customer_note; - } - - if (requestParameters.merchant_note !== undefined) { - formParams['merchant_note'] = requestParameters.merchant_note; - } - - - const response = await this.request({ - path: `/refund`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Refund - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/refund/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Refunds - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/refund`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Settlement.ts b/src/apis/Settlement.ts deleted file mode 100644 index 96bcdf3..0000000 --- a/src/apis/Settlement.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface FetchRequest { - perPage?: number; - page?: number; -} - -export interface TransactionRequest { - id: string; -} - -/** - * - */ -export class Settlement extends BaseAPI { - - /** - * Fetch Settlements - */ - async fetch(requestParameters: FetchRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - - const response = await this.request({ - path: `/settlement`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Settlement Transactions - */ - async transaction(requestParameters: TransactionRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling transaction.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/settlement/{id}/transaction`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Split.ts b/src/apis/Split.ts deleted file mode 100644 index fb535f9..0000000 --- a/src/apis/Split.ts +++ /dev/null @@ -1,287 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - SplitSubaccounts, - ResponseFromJSON -} from '../models'; - -export interface AddSubaccountRequest { - id: string; - subaccount?: string; - share?: string; -} - -export interface CreateRequest { - name: string; - type: string; - subaccounts: Array; - currency: string; - bearer_type?: string; - bearer_subaccount?: string; -} - -export interface FetchRequest { - id: string; -} - -export interface ListRequest { - name?: string; - active?: string; - sort_by?: string; - from?: string; - to?: string; - perPage?: string; - page?: string; -} - -export interface RemoveSubaccountRequest { - id: string; - subaccount?: string; - share?: string; -} - -export interface UpdateRequest { - id: string; - name?: string; - active?: boolean; - bearer_type?: string; - bearer_subaccount?: string; -} - -/** - * - */ -export class Split extends BaseAPI { - - /** - * Add Subaccount to Split - */ - async addSubaccount(requestParameters: AddSubaccountRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling addSubaccount.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.share !== undefined) { - formParams['share'] = requestParameters.share; - } - - - const response = await this.request({ - path: `/split/{id}/subaccount/add`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Split - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new RequiredError('name','Required parameter name was null or undefined when calling create.'); - } - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new RequiredError('type','Required parameter type was null or undefined when calling create.'); - } - if (requestParameters.subaccounts === null || requestParameters.subaccounts === undefined) { - throw new RequiredError('subaccounts','Required parameter subaccounts was null or undefined when calling create.'); - } - if (requestParameters.currency === null || requestParameters.currency === undefined) { - throw new RequiredError('currency','Required parameter currency was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.type !== undefined) { - formParams['type'] = requestParameters.type; - } - - if (requestParameters.subaccounts) { - formParams['subaccounts'] = requestParameters.subaccounts; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.bearer_type !== undefined) { - formParams['bearer_type'] = requestParameters.bearer_type; - } - - if (requestParameters.bearer_subaccount !== undefined) { - formParams['bearer_subaccount'] = requestParameters.bearer_subaccount; - } - - - const response = await this.request({ - path: `/split`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Split - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/split/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List/Search Splits - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.name !== undefined) { - queryParameters['name'] = requestParameters.name; - } - - if (requestParameters.active !== undefined) { - queryParameters['active'] = requestParameters.active; - } - - if (requestParameters.sort_by !== undefined) { - queryParameters['sort_by'] = requestParameters.sort_by; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = requestParameters.from; - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = requestParameters.to; - } - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - - const response = await this.request({ - path: `/split`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Remove Subaccount from split - */ - async removeSubaccount(requestParameters: RemoveSubaccountRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling removeSubaccount.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.share !== undefined) { - formParams['share'] = requestParameters.share; - } - - - const response = await this.request({ - path: `/split/{id}/subaccount/remove`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Split - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.active !== undefined) { - formParams['active'] = requestParameters.active; - } - - if (requestParameters.bearer_type !== undefined) { - formParams['bearer_type'] = requestParameters.bearer_type; - } - - if (requestParameters.bearer_subaccount !== undefined) { - formParams['bearer_subaccount'] = requestParameters.bearer_subaccount; - } - - - const response = await this.request({ - path: `/split/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Subaccount.ts b/src/apis/Subaccount.ts deleted file mode 100644 index 308bfa5..0000000 --- a/src/apis/Subaccount.ts +++ /dev/null @@ -1,244 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface CreateRequest { - business_name: string; - settlement_bank: string; - account_number: string; - percentage_charge: number; - description?: string; - primary_contact_email?: string; - primary_contact_name?: string; - primary_contact_phone?: string; - metadata?: string; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface UpdateRequest { - code: string; - business_name?: string; - settlement_bank?: string; - account_number?: string; - active?: boolean; - percentage_charge?: number; - description?: string; - primary_contact_email?: string; - primary_contact_name?: string; - primary_contact_phone?: string; - metadata?: string; -} - -/** - * - */ -export class Subaccount extends BaseAPI { - - /** - * Create Subaccount - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.business_name === null || requestParameters.business_name === undefined) { - throw new RequiredError('business_name','Required parameter business_name was null or undefined when calling create.'); - } - if (requestParameters.settlement_bank === null || requestParameters.settlement_bank === undefined) { - throw new RequiredError('settlement_bank','Required parameter settlement_bank was null or undefined when calling create.'); - } - if (requestParameters.account_number === null || requestParameters.account_number === undefined) { - throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling create.'); - } - if (requestParameters.percentage_charge === null || requestParameters.percentage_charge === undefined) { - throw new RequiredError('percentage_charge','Required parameter percentage_charge was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.business_name !== undefined) { - formParams['business_name'] = requestParameters.business_name; - } - - if (requestParameters.settlement_bank !== undefined) { - formParams['settlement_bank'] = requestParameters.settlement_bank; - } - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.percentage_charge !== undefined) { - formParams['percentage_charge'] = requestParameters.percentage_charge; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.primary_contact_email !== undefined) { - formParams['primary_contact_email'] = requestParameters.primary_contact_email; - } - - if (requestParameters.primary_contact_name !== undefined) { - formParams['primary_contact_name'] = requestParameters.primary_contact_name; - } - - if (requestParameters.primary_contact_phone !== undefined) { - formParams['primary_contact_phone'] = requestParameters.primary_contact_phone; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - - const response = await this.request({ - path: `/subaccount`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Subaccount - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/subaccount/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Subaccounts - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/subaccount`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Subaccount - */ - async update(requestParameters: UpdateRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling update.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.business_name !== undefined) { - formParams['business_name'] = requestParameters.business_name; - } - - if (requestParameters.settlement_bank !== undefined) { - formParams['settlement_bank'] = requestParameters.settlement_bank; - } - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.active !== undefined) { - formParams['active'] = requestParameters.active; - } - - if (requestParameters.percentage_charge !== undefined) { - formParams['percentage_charge'] = requestParameters.percentage_charge; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.primary_contact_email !== undefined) { - formParams['primary_contact_email'] = requestParameters.primary_contact_email; - } - - if (requestParameters.primary_contact_name !== undefined) { - formParams['primary_contact_name'] = requestParameters.primary_contact_name; - } - - if (requestParameters.primary_contact_phone !== undefined) { - formParams['primary_contact_phone'] = requestParameters.primary_contact_phone; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - - const response = await this.request({ - path: `/subaccount/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Subscription.ts b/src/apis/Subscription.ts deleted file mode 100644 index 352f72f..0000000 --- a/src/apis/Subscription.ts +++ /dev/null @@ -1,269 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface CreateRequest { - customer: string; - plan: string; - authorization?: string; - start_date?: Date; -} - -export interface DisableRequest { - code: string; - token: string; -} - -export interface EnableRequest { - code: string; - token: string; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - plan?: string; - customer?: string; - from?: Date; - to?: Date; -} - -export interface ManageEmailRequest { - code: string; -} - -export interface ManageLinkRequest { - code: string; -} - -/** - * - */ -export class Subscription extends BaseAPI { - - /** - * Create Subscription - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.customer === null || requestParameters.customer === undefined) { - throw new RequiredError('customer','Required parameter customer was null or undefined when calling create.'); - } - if (requestParameters.plan === null || requestParameters.plan === undefined) { - throw new RequiredError('plan','Required parameter plan was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.customer !== undefined) { - formParams['customer'] = requestParameters.customer; - } - - if (requestParameters.plan !== undefined) { - formParams['plan'] = requestParameters.plan; - } - - if (requestParameters.authorization !== undefined) { - formParams['authorization'] = requestParameters.authorization; - } - - if (requestParameters.start_date !== undefined) { - formParams['start_date'] = requestParameters.start_date; - } - - - const response = await this.request({ - path: `/subscription`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Disable Subscription - */ - async disable(requestParameters: DisableRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling disable.'); - } - if (requestParameters.token === null || requestParameters.token === undefined) { - throw new RequiredError('token','Required parameter token was null or undefined when calling disable.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.code !== undefined) { - formParams['code'] = requestParameters.code; - } - - if (requestParameters.token !== undefined) { - formParams['token'] = requestParameters.token; - } - - - const response = await this.request({ - path: `/subscription/disable`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Enable Subscription - */ - async enable(requestParameters: EnableRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling enable.'); - } - if (requestParameters.token === null || requestParameters.token === undefined) { - throw new RequiredError('token','Required parameter token was null or undefined when calling enable.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.code !== undefined) { - formParams['code'] = requestParameters.code; - } - - if (requestParameters.token !== undefined) { - formParams['token'] = requestParameters.token; - } - - - const response = await this.request({ - path: `/subscription/enable`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Subscription - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/subscription/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Subscriptions - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.plan !== undefined) { - queryParameters['plan'] = requestParameters.plan; - } - - if (requestParameters.customer !== undefined) { - queryParameters['customer'] = requestParameters.customer; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/subscription`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Send Update Subscription Link - */ - async manageEmail(requestParameters: ManageEmailRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling manageEmail.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/subscription/{code}/manage/email`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Generate Update Subscription Link - */ - async manageLink(requestParameters: ManageLinkRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling manageLink.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/subscription/{code}/manage/link`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Transaction.ts b/src/apis/Transaction.ts deleted file mode 100644 index dd31b51..0000000 --- a/src/apis/Transaction.ts +++ /dev/null @@ -1,556 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface ChargeAuthorizationRequest { - email: string; - amount: number; - authorization_code: string; - reference?: string; - currency?: string; - metadata?: string; - split_code?: string; - subaccount?: string; - transaction_charge?: string; - bearer?: string; - queue?: boolean; -} - -export interface CheckAuthorizationRequest { - email: string; - amount: number; - authorization_code?: string; - currency?: string; -} - -export interface DownloadRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface EventRequest { - id: string; -} - -export interface FetchRequest { - id: string; -} - -export interface InitializeRequest { - email: string; - amount: number; - currency?: string; - reference?: string; - callback_url?: string; - plan?: string; - invoice_limit?: number; - metadata?: string; - channels?: Array; - split_code?: string; - subaccount?: string; - transaction_charge?: string; - bearer?: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface PartialDebitRequest { - email: string; - amount: number; - authorization_code: string; - currency: string; - reference?: string; - at_least?: string; -} - -export interface SessionRequest { - id: string; -} - -export interface TimelineRequest { - id_or_reference: string; -} - -export interface TotalsRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface VerifyRequest { - reference: string; -} - -/** - * - */ -export class Transaction extends BaseAPI { - - /** - * Charge Authorization - */ - async chargeAuthorization(requestParameters: ChargeAuthorizationRequest): Promise { - if (requestParameters.email === null || requestParameters.email === undefined) { - throw new RequiredError('email','Required parameter email was null or undefined when calling chargeAuthorization.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling chargeAuthorization.'); - } - if (requestParameters.authorization_code === null || requestParameters.authorization_code === undefined) { - throw new RequiredError('authorization_code','Required parameter authorization_code was null or undefined when calling chargeAuthorization.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.transaction_charge !== undefined) { - formParams['transaction_charge'] = requestParameters.transaction_charge; - } - - if (requestParameters.bearer !== undefined) { - formParams['bearer'] = requestParameters.bearer; - } - - if (requestParameters.queue !== undefined) { - formParams['queue'] = requestParameters.queue; - } - - - const response = await this.request({ - path: `/transaction/charge_authorization`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Check Authorization - */ - async checkAuthorization(requestParameters: CheckAuthorizationRequest): Promise { - if (requestParameters.email === null || requestParameters.email === undefined) { - throw new RequiredError('email','Required parameter email was null or undefined when calling checkAuthorization.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling checkAuthorization.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - - const response = await this.request({ - path: `/transaction/check_authorization`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Export Transactions - */ - async download(requestParameters: DownloadRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transaction/export`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Get Transaction Event - */ - async event(requestParameters: EventRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling event.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transaction/{id}/event`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch a transaction to get its details - * Fetch Transaction - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transaction/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Create a new transaction - * Initialize Transaction - */ - async initialize(requestParameters: InitializeRequest): Promise { - if (requestParameters.email === null || requestParameters.email === undefined) { - throw new RequiredError('email','Required parameter email was null or undefined when calling initialize.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling initialize.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - if (requestParameters.callback_url !== undefined) { - formParams['callback_url'] = requestParameters.callback_url; - } - - if (requestParameters.plan !== undefined) { - formParams['plan'] = requestParameters.plan; - } - - if (requestParameters.invoice_limit !== undefined) { - formParams['invoice_limit'] = requestParameters.invoice_limit; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - if (requestParameters.channels) { - formParams['channels'] = requestParameters.channels; - } - - if (requestParameters.split_code !== undefined) { - formParams['split_code'] = requestParameters.split_code; - } - - if (requestParameters.subaccount !== undefined) { - formParams['subaccount'] = requestParameters.subaccount; - } - - if (requestParameters.transaction_charge !== undefined) { - formParams['transaction_charge'] = requestParameters.transaction_charge; - } - - if (requestParameters.bearer !== undefined) { - formParams['bearer'] = requestParameters.bearer; - } - - - const response = await this.request({ - path: `/transaction/initialize`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * List transactions that has occurred on your integration - * List Transactions - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transaction`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Partial Debit - */ - async partialDebit(requestParameters: PartialDebitRequest): Promise { - if (requestParameters.email === null || requestParameters.email === undefined) { - throw new RequiredError('email','Required parameter email was null or undefined when calling partialDebit.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling partialDebit.'); - } - if (requestParameters.authorization_code === null || requestParameters.authorization_code === undefined) { - throw new RequiredError('authorization_code','Required parameter authorization_code was null or undefined when calling partialDebit.'); - } - if (requestParameters.currency === null || requestParameters.currency === undefined) { - throw new RequiredError('currency','Required parameter currency was null or undefined when calling partialDebit.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - if (requestParameters.at_least !== undefined) { - formParams['at_least'] = requestParameters.at_least; - } - - - const response = await this.request({ - path: `/transaction/partial_debit`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Get Transaction Session - */ - async session(requestParameters: SessionRequest): Promise { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new RequiredError('id','Required parameter id was null or undefined when calling session.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transaction/{id}/session`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Get the details about the lifecycle of a transaction from initiation to completion - * Fetch Transaction Timeline - */ - async timeline(requestParameters: TimelineRequest): Promise { - if (requestParameters.id_or_reference === null || requestParameters.id_or_reference === undefined) { - throw new RequiredError('id_or_reference','Required parameter id_or_reference was null or undefined when calling timeline.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transaction/timeline/{id_or_reference}`.replace(`{${"id_or_reference"}}`, encodeURIComponent(String(requestParameters.id_or_reference))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Get the total amount of all transactions - * Transaction Totals - */ - async totals(requestParameters: TotalsRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transaction/totals`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Verify a previously initiated transaction using it\'s reference - * Verify Transaction - */ - async verify(requestParameters: VerifyRequest): Promise { - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling verify.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transaction/verify/{reference}`.replace(`{${"reference"}}`, encodeURIComponent(String(requestParameters.reference))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Transfer.ts b/src/apis/Transfer.ts deleted file mode 100644 index 2e1f49f..0000000 --- a/src/apis/Transfer.ts +++ /dev/null @@ -1,393 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - TransferInitiate, - ResponseFromJSON -} from '../models'; - -export interface BulkRequest { - source?: string; - transfers?: Array; -} - -export interface DisableOtpFinalizeRequest { - otp: string; -} - -export interface DownloadRequest { - perPage?: number; - page?: number; - status?: string; - from?: Date; - to?: Date; -} - -export interface FetchRequest { - code: string; -} - -export interface FinalizeRequest { - transfer_code: string; - otp: string; -} - -export interface InitiateRequest { - source: string; - amount: string; - recipient: string; - reason?: string; - currency?: string; - reference?: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - status?: string; - from?: Date; - to?: Date; -} - -export interface ResendOtpRequest { - transfer_code: string; - reason: string; -} - -export interface VerifyRequest { - reference: string; -} - -/** - * - */ -export class Transfer extends BaseAPI { - - /** - * Initiate Bulk Transfer - */ - async bulk(requestParameters: BulkRequest): Promise { - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.source !== undefined) { - formParams['source'] = requestParameters.source; - } - - if (requestParameters.transfers) { - formParams['transfers'] = requestParameters.transfers; - } - - - const response = await this.request({ - path: `/transfer/bulk`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Disable OTP requirement for Transfers - */ - async disableOtp(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transfer/disable_otp`, - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Finalize Disabling of OTP requirement for Transfers - */ - async disableOtpFinalize(requestParameters: DisableOtpFinalizeRequest): Promise { - if (requestParameters.otp === null || requestParameters.otp === undefined) { - throw new RequiredError('otp','Required parameter otp was null or undefined when calling disableOtpFinalize.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.otp !== undefined) { - formParams['otp'] = requestParameters.otp; - } - - - const response = await this.request({ - path: `/transfer/disable_otp_finalize`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Export Transfers - */ - async download(requestParameters: DownloadRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transfer/export`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Enable OTP requirement for Transfers - */ - async enableOtp(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transfer/enable_otp`, - method: 'POST', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Transfer - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transfer/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Finalize Transfer - */ - async finalize(requestParameters: FinalizeRequest): Promise { - if (requestParameters.transfer_code === null || requestParameters.transfer_code === undefined) { - throw new RequiredError('transfer_code','Required parameter transfer_code was null or undefined when calling finalize.'); - } - if (requestParameters.otp === null || requestParameters.otp === undefined) { - throw new RequiredError('otp','Required parameter otp was null or undefined when calling finalize.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.transfer_code !== undefined) { - formParams['transfer_code'] = requestParameters.transfer_code; - } - - if (requestParameters.otp !== undefined) { - formParams['otp'] = requestParameters.otp; - } - - - const response = await this.request({ - path: `/transfer/finalize_transfer`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Initiate Transfer - */ - async initiate(requestParameters: InitiateRequest): Promise { - if (requestParameters.source === null || requestParameters.source === undefined) { - throw new RequiredError('source','Required parameter source was null or undefined when calling initiate.'); - } - if (requestParameters.amount === null || requestParameters.amount === undefined) { - throw new RequiredError('amount','Required parameter amount was null or undefined when calling initiate.'); - } - if (requestParameters.recipient === null || requestParameters.recipient === undefined) { - throw new RequiredError('recipient','Required parameter recipient was null or undefined when calling initiate.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.source !== undefined) { - formParams['source'] = requestParameters.source; - } - - if (requestParameters.amount !== undefined) { - formParams['amount'] = requestParameters.amount; - } - - if (requestParameters.recipient !== undefined) { - formParams['recipient'] = requestParameters.recipient; - } - - if (requestParameters.reason !== undefined) { - formParams['reason'] = requestParameters.reason; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.reference !== undefined) { - formParams['reference'] = requestParameters.reference; - } - - - const response = await this.request({ - path: `/transfer`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * List Transfers - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transfer`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Resend OTP for Transfer - */ - async resendOtp(requestParameters: ResendOtpRequest): Promise { - if (requestParameters.transfer_code === null || requestParameters.transfer_code === undefined) { - throw new RequiredError('transfer_code','Required parameter transfer_code was null or undefined when calling resendOtp.'); - } - if (requestParameters.reason === null || requestParameters.reason === undefined) { - throw new RequiredError('reason','Required parameter reason was null or undefined when calling resendOtp.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.transfer_code !== undefined) { - formParams['transfer_code'] = requestParameters.transfer_code; - } - - if (requestParameters.reason !== undefined) { - formParams['reason'] = requestParameters.reason; - } - - - const response = await this.request({ - path: `/transfer/resend_otp`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Verify Transfer - */ - async verify(requestParameters: VerifyRequest): Promise { - if (requestParameters.reference === null || requestParameters.reference === undefined) { - throw new RequiredError('reference','Required parameter reference was null or undefined when calling verify.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transfer/verify/{reference}`.replace(`{${"reference"}}`, encodeURIComponent(String(requestParameters.reference))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/TransferRecipient.ts b/src/apis/TransferRecipient.ts deleted file mode 100644 index 67f2f2b..0000000 --- a/src/apis/TransferRecipient.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - TransferRecipientCreate, - ResponseFromJSON -} from '../models'; - -export interface BulkRequest { - batch: Array; -} - -export interface CreateRequest { - type: string; - name: string; - account_number: string; - bank_code: string; - description?: string; - currency?: string; - authorization_code?: string; - metadata?: string; -} - -export interface FetchRequest { - code: string; -} - -export interface ListRequest { - perPage?: number; - page?: number; - from?: Date; - to?: Date; -} - -export interface TransferrecipientCodeDeleteRequest { - code: string; -} - -export interface TransferrecipientCodePutRequest { - code: string; - name?: string; - email?: string; -} - -/** - * - */ -export class TransferRecipient extends BaseAPI { - - /** - * Bulk Create Transfer Recipient - */ - async bulk(requestParameters: BulkRequest): Promise { - if (requestParameters.batch === null || requestParameters.batch === undefined) { - throw new RequiredError('batch','Required parameter batch was null or undefined when calling bulk.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.batch) { - formParams['batch'] = requestParameters.batch; - } - - - const response = await this.request({ - path: `/transferrecipient/bulk`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Create Transfer Recipient - */ - async create(requestParameters: CreateRequest): Promise { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new RequiredError('type','Required parameter type was null or undefined when calling create.'); - } - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new RequiredError('name','Required parameter name was null or undefined when calling create.'); - } - if (requestParameters.account_number === null || requestParameters.account_number === undefined) { - throw new RequiredError('account_number','Required parameter account_number was null or undefined when calling create.'); - } - if (requestParameters.bank_code === null || requestParameters.bank_code === undefined) { - throw new RequiredError('bank_code','Required parameter bank_code was null or undefined when calling create.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.type !== undefined) { - formParams['type'] = requestParameters.type; - } - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.account_number !== undefined) { - formParams['account_number'] = requestParameters.account_number; - } - - if (requestParameters.bank_code !== undefined) { - formParams['bank_code'] = requestParameters.bank_code; - } - - if (requestParameters.description !== undefined) { - formParams['description'] = requestParameters.description; - } - - if (requestParameters.currency !== undefined) { - formParams['currency'] = requestParameters.currency; - } - - if (requestParameters.authorization_code !== undefined) { - formParams['authorization_code'] = requestParameters.authorization_code; - } - - if (requestParameters.metadata !== undefined) { - formParams['metadata'] = requestParameters.metadata; - } - - - const response = await this.request({ - path: `/transferrecipient`, - method: 'POST', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Transfer recipient - */ - async fetch(requestParameters: FetchRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling fetch.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transferrecipient/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Transfer Recipients - */ - async list(requestParameters: ListRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.from !== undefined) { - queryParameters['from'] = (requestParameters.from as any).toISOString(); - } - - if (requestParameters.to !== undefined) { - queryParameters['to'] = (requestParameters.to as any).toISOString(); - } - - - const response = await this.request({ - path: `/transferrecipient`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Delete Transfer Recipient - */ - async transferrecipientCodeDelete(requestParameters: TransferrecipientCodeDeleteRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling transferrecipientCodeDelete.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/transferrecipient/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'DELETE', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Update Transfer recipient - */ - async transferrecipientCodePut(requestParameters: TransferrecipientCodePutRequest): Promise { - if (requestParameters.code === null || requestParameters.code === undefined) { - throw new RequiredError('code','Required parameter code was null or undefined when calling transferrecipientCodePut.'); - } - const queryParameters: any = {}; - - let formParams: any = {}; - - if (requestParameters.name !== undefined) { - formParams['name'] = requestParameters.name; - } - - if (requestParameters.email !== undefined) { - formParams['email'] = requestParameters.email; - } - - - const response = await this.request({ - path: `/transferrecipient/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))), - method: 'PUT', - query: queryParameters, - body: formParams, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/Verification.ts b/src/apis/Verification.ts deleted file mode 100644 index 56ed5bc..0000000 --- a/src/apis/Verification.ts +++ /dev/null @@ -1,183 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { BaseAPI, RequiredError } from '../runtime'; -import { - Response, - ResponseFromJSON -} from '../models'; - -export interface AvsRequest { - type?: string; - country?: string; - currency?: string; -} - -export interface FetchBanksRequest { - country?: string; - pay_with_bank_transfer?: boolean; - use_cursor?: boolean; - perPage?: number; - next?: string; - previous?: string; - gateway?: string; -} - -export interface ResolveAccountNumberRequest { - account_number?: number; - bank_code?: number; -} - -export interface ResolveCardBinRequest { - bin: string; -} - -/** - * - */ -export class Verification extends BaseAPI { - - /** - * List States (AVS) - */ - async avs(requestParameters: AvsRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; - } - - if (requestParameters.country !== undefined) { - queryParameters['country'] = requestParameters.country; - } - - if (requestParameters.currency !== undefined) { - queryParameters['currency'] = requestParameters.currency; - } - - - const response = await this.request({ - path: `/address_verification/states`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Fetch Banks - */ - async fetchBanks(requestParameters: FetchBanksRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.country !== undefined) { - queryParameters['country'] = requestParameters.country; - } - - if (requestParameters.pay_with_bank_transfer !== undefined) { - queryParameters['pay_with_bank_transfer'] = requestParameters.pay_with_bank_transfer; - } - - if (requestParameters.use_cursor !== undefined) { - queryParameters['use_cursor'] = requestParameters.use_cursor; - } - - if (requestParameters.perPage !== undefined) { - queryParameters['perPage'] = requestParameters.perPage; - } - - if (requestParameters.next !== undefined) { - queryParameters['next'] = requestParameters.next; - } - - if (requestParameters.previous !== undefined) { - queryParameters['previous'] = requestParameters.previous; - } - - if (requestParameters.gateway !== undefined) { - queryParameters['gateway'] = requestParameters.gateway; - } - - - const response = await this.request({ - path: `/bank`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * List Countries - */ - async listCountries(): Promise { - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/country`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Resolve Account Number - */ - async resolveAccountNumber(requestParameters: ResolveAccountNumberRequest): Promise { - const queryParameters: any = {}; - - if (requestParameters.account_number !== undefined) { - queryParameters['account_number'] = requestParameters.account_number; - } - - if (requestParameters.bank_code !== undefined) { - queryParameters['bank_code'] = requestParameters.bank_code; - } - - - const response = await this.request({ - path: `/bank/resolve`, - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - - /** - * Resolve Card BIN - */ - async resolveCardBin(requestParameters: ResolveCardBinRequest): Promise { - if (requestParameters.bin === null || requestParameters.bin === undefined) { - throw new RequiredError('bin','Required parameter bin was null or undefined when calling resolveCardBin.'); - } - const queryParameters: any = {}; - - - const response = await this.request({ - path: `/decision/bin/{bin}`.replace(`{${"bin"}}`, encodeURIComponent(String(requestParameters.bin))), - method: 'GET', - query: queryParameters, - }); - - return ResponseFromJSON(response); - } - -} diff --git a/src/apis/apple-pay.ts b/src/apis/apple-pay.ts new file mode 100644 index 0000000..dec0c85 --- /dev/null +++ b/src/apis/apple-pay.ts @@ -0,0 +1,31 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { ApplePayRegisterDomainBody } from "../models/index.js"; +import type { ApplePayUnregisterDomainBody } from "../models/index.js"; +import type { ApplePayListDomainQuery } from "../models/index.js"; +import type { ApplePayListDomainData } from "../models/index.js"; +import type { ApplePayUnregisterDomainData } from "../models/index.js"; + +export class ApplePayApi { + constructor(private readonly client: ApiClient) {} + + /** Lists all registered domains on your integration. Returns an empty array if no domains have been added. */ + async listDomain(query?: ApplePayListDomainQuery): Promise> { + return this.client.request("GET", "/apple-pay/domain", { query: query }); + } + + /** Register a top-level domain or subdomain for your Apple Pay integration. + +> This endpoint can only be called with one domain or subdomain at a time. + */ + async registerDomain(payload: ApplePayRegisterDomainBody): Promise> { + return this.client.request("POST", "/apple-pay/domain", { body: payload }); + } + + /** Unregister a top-level domain or subdomain previously used for your Apple +Pay integration. + */ + async unregisterDomain(payload: ApplePayUnregisterDomainBody): Promise> { + return this.client.request("DELETE", "/apple-pay/domain", { body: payload }); + } +} diff --git a/src/apis/balance.ts b/src/apis/balance.ts new file mode 100644 index 0000000..7510691 --- /dev/null +++ b/src/apis/balance.ts @@ -0,0 +1,19 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { BalanceLedgerQuery } from "../models/index.js"; +import type { BalanceFetchData } from "../models/index.js"; +import type { BalanceLedgerData } from "../models/index.js"; + +export class BalanceApi { + constructor(private readonly client: ApiClient) {} + + /** Fetch the available balance on your integration */ + async fetch(): Promise> { + return this.client.request("GET", "/balance"); + } + + /** Fetch all pay-ins and pay-outs that occured on your integration */ + async ledger(query?: BalanceLedgerQuery): Promise> { + return this.client.request("GET", "/balance/ledger", { query: query }); + } +} diff --git a/src/apis/bank.ts b/src/apis/bank.ts new file mode 100644 index 0000000..5708520 --- /dev/null +++ b/src/apis/bank.ts @@ -0,0 +1,27 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { BankValidateAccountNumberBody } from "../models/index.js"; +import type { BankListQuery } from "../models/index.js"; +import type { BankResolveAccountNumberQuery } from "../models/index.js"; +import type { BankListData } from "../models/index.js"; +import type { BankResolveAccountNumberData } from "../models/index.js"; +import type { BankValidateAccountNumberData } from "../models/index.js"; + +export class BankApi { + constructor(private readonly client: ApiClient) {} + + /** List banks supported on Paystack */ + async list(query?: BankListQuery): Promise> { + return this.client.request("GET", "/bank", { query: query }); + } + + /** Resolve an account number to confirm the name associated with it */ + async resolveAccountNumber(query?: BankResolveAccountNumberQuery): Promise> { + return this.client.request("GET", "/bank/resolve", { query: query }); + } + + /** Confirm the authenticity of a customer's account number before sending money */ + async validateAccountNumber(payload: BankValidateAccountNumberBody): Promise> { + return this.client.request("POST", "/bank/validate", { body: payload }); + } +} diff --git a/src/apis/bulk-charge.ts b/src/apis/bulk-charge.ts new file mode 100644 index 0000000..39c4a44 --- /dev/null +++ b/src/apis/bulk-charge.ts @@ -0,0 +1,53 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { BulkChargeInitiateBody } from "../models/index.js"; +import type { BulkChargeListQuery } from "../models/index.js"; +import type { BulkChargeChargesQuery } from "../models/index.js"; +import type { BulkChargeListData } from "../models/index.js"; +import type { BulkChargeInitiateData } from "../models/index.js"; +import type { BulkChargeFetchData } from "../models/index.js"; +import type { BulkChargeChargesData } from "../models/index.js"; + +export class BulkChargeApi { + constructor(private readonly client: ApiClient) {} + + /** List all bulk charge batches. */ + async list(query?: BulkChargeListQuery): Promise> { + return this.client.request("GET", "/bulkcharge", { query: query }); + } + + /** Charge multiple customers in batches */ + async initiate(payload: BulkChargeInitiateBody): Promise> { + return this.client.request("POST", "/bulkcharge", { body: payload }); + } + + /** This endpoint retrieves a specific batch code. It also returns useful information on its progress by +way of the `total_charges` and `pending_charges` attributes. + */ + async fetch(code: string): Promise> { + let path = "/bulkcharge/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** This endpoint retrieves the charges associated with a specified batch code */ + async charges(code: string, query?: BulkChargeChargesQuery): Promise> { + let path = "/bulkcharge/{code}/charges"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path, { query: query }); + } + + /** Pause the processing of a charge batch */ + async pause(code: string): Promise> { + let path = "/bulkcharge/pause/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Resume the processing of a previously paused charge batch */ + async resume(code: string): Promise> { + let path = "/bulkcharge/resume/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/charge.ts b/src/apis/charge.ts new file mode 100644 index 0000000..41c94f9 --- /dev/null +++ b/src/apis/charge.ts @@ -0,0 +1,57 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { ChargeCreateBody } from "../models/index.js"; +import type { ChargeSubmitPinBody } from "../models/index.js"; +import type { ChargeSubmitOtpBody } from "../models/index.js"; +import type { ChargeSubmitPhoneBody } from "../models/index.js"; +import type { ChargeSubmitBirthdayBody } from "../models/index.js"; +import type { ChargeSubmitAddressBody } from "../models/index.js"; +import type { ChargeCreateData } from "../models/index.js"; +import type { ChargeSubmitPinData } from "../models/index.js"; +import type { ChargeSubmitOtpData } from "../models/index.js"; +import type { ChargeSubmitPhoneData } from "../models/index.js"; +import type { ChargeSubmitBirthdayData } from "../models/index.js"; +import type { ChargeSubmitAddressData } from "../models/index.js"; +import type { ChargeCheckData } from "../models/index.js"; + +export class ChargeApi { + constructor(private readonly client: ApiClient) {} + + /** Initiate a payment by integrating the payment channel of your choice. */ + async create(payload: ChargeCreateBody): Promise> { + return this.client.request("POST", "/charge", { body: payload }); + } + + /** Submit PIN to continue a charge */ + async submitPin(payload: ChargeSubmitPinBody): Promise> { + return this.client.request("POST", "/charge/submit_pin", { body: payload }); + } + + /** Submit OTP to complete a charge */ + async submitOtp(payload: ChargeSubmitOtpBody): Promise> { + return this.client.request("POST", "/charge/submit_otp", { body: payload }); + } + + /** Submit phone number when requested */ + async submitPhone(payload: ChargeSubmitPhoneBody): Promise> { + return this.client.request("POST", "/charge/submit_phone", { body: payload }); + } + + /** Submit the customer's birthday when requested */ + async submitBirthday(payload: ChargeSubmitBirthdayBody): Promise> { + return this.client.request("POST", "/charge/submit_birthday", { body: payload }); + } + + /** Send the details of the customer's address for address verification */ + async submitAddress(payload: ChargeSubmitAddressBody): Promise> { + return this.client.request("POST", "/charge/submit_address", { body: payload }); + } + + /** When you get `pending` as a charge status or if there was an exception when calling any of the `/charge` endpoints, wait 10 seconds or more, then make a check to see if its status has changed. Don't call too early as you may get a lot more pending than you should. + */ + async check(reference: string): Promise> { + let path = "/charge/{reference}"; + path = path.replace("{reference}", encodeURIComponent(String(reference))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/customer.ts b/src/apis/customer.ts new file mode 100644 index 0000000..ca42788 --- /dev/null +++ b/src/apis/customer.ts @@ -0,0 +1,98 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { CustomerCreateBody } from "../models/index.js"; +import type { CustomerUpdateBody } from "../models/index.js"; +import type { CustomerRiskActionBody } from "../models/index.js"; +import type { CustomerValidateBody } from "../models/index.js"; +import type { CustomerInitializeAuthorizationBody } from "../models/index.js"; +import type { CustomerDeactivateAuthorizationBody } from "../models/index.js"; +import type { CustomerInitializeDirectDebitBody } from "../models/index.js"; +import type { CustomerDirectDebitActivationChargeBody } from "../models/index.js"; +import type { CustomerListQuery } from "../models/index.js"; +import type { CustomerListData } from "../models/index.js"; +import type { CustomerCreateData } from "../models/index.js"; +import type { CustomerFetchData } from "../models/index.js"; +import type { CustomerUpdateData } from "../models/index.js"; +import type { CustomerRiskActionData } from "../models/index.js"; +import type { CustomerInitializeAuthorizationData } from "../models/index.js"; +import type { CustomerVerifyAuthorizationData } from "../models/index.js"; +import type { CustomerInitializeDirectDebitData } from "../models/index.js"; +import type { CustomerFetchMandateAuthorizationsData } from "../models/index.js"; + +export class CustomerApi { + constructor(private readonly client: ApiClient) {} + + /** List customers on your integration */ + async list(query?: CustomerListQuery): Promise> { + return this.client.request("GET", "/customer", { query: query }); + } + + /** Create a customer on your integration */ + async create(payload: CustomerCreateBody): Promise> { + return this.client.request("POST", "/customer", { body: payload }); + } + + /** Get details of a customer on your integration. */ + async fetch(code: string): Promise> { + let path = "/customer/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Update a customer's details on your integration */ + async update(code: string, payload: CustomerUpdateBody): Promise> { + let path = "/customer/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Set customer's risk action by whitelisting or blacklisting the customer */ + async riskAction(payload: CustomerRiskActionBody): Promise> { + return this.client.request("POST", "/customer/set_risk_action", { body: payload }); + } + + /** Validate a customer's identity */ + async validate(code: string, payload: CustomerValidateBody): Promise> { + let path = "/customer/{code}/identification"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("POST", path, { body: payload }); + } + + /** Initiate a request to create a reusable authorization code for recurring transactions */ + async initializeAuthorization(payload: CustomerInitializeAuthorizationBody): Promise> { + return this.client.request("POST", "/customer/authorization/initialize", { body: payload }); + } + + /** Check the status of an authorization request */ + async verifyAuthorization(reference: string): Promise> { + let path = "/customer/authorization/verify/{reference}"; + path = path.replace("{reference}", encodeURIComponent(String(reference))); + return this.client.request("GET", path); + } + + /** Deactivate an authorization for any payment channel. */ + async deactivateAuthorization(payload: CustomerDeactivateAuthorizationBody): Promise> { + return this.client.request("POST", "/customer/authorization/deactivate", { body: payload }); + } + + /** Initialize the process of linking an account to a customer for Direct Debit transactions */ + async initializeDirectDebit(id: string, payload: CustomerInitializeDirectDebitBody): Promise> { + let path = "/customer/{id}/initialize-direct-debit"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } + + /** Trigger an activation charge on an inactive mandate on behalf of your customer */ + async directDebitActivationCharge(id: string, payload: CustomerDirectDebitActivationChargeBody): Promise> { + let path = "/customer/{id}/directdebit-activation-charge"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Get the list of direct debit mandates associated with a customer */ + async fetchMandateAuthorizations(id: string): Promise> { + let path = "/customer/{id}/directdebit-mandate-authorizations"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/dedicated-virtual-account.ts b/src/apis/dedicated-virtual-account.ts new file mode 100644 index 0000000..f0152a9 --- /dev/null +++ b/src/apis/dedicated-virtual-account.ts @@ -0,0 +1,70 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { DedicatedVirtualAccountDedicatedAccountCreateBody } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountAssignBody } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountAddSplitBody } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountRemoveSplitBody } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountListQuery } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountRequeryQuery } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountListData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountCreateData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountAssignData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountFetchData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountDeactivateData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountRequeryData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountAddSplitData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountRemoveSplitData } from "../models/index.js"; +import type { DedicatedVirtualAccountDedicatedAccountAvailableProvidersData } from "../models/index.js"; + +export class DedicatedVirtualAccountApi { + constructor(private readonly client: ApiClient) {} + + /** List dedicated virtual accounts available on your integration. */ + async dedicatedAccountList(query?: DedicatedVirtualAccountDedicatedAccountListQuery): Promise> { + return this.client.request("GET", "/dedicated_account", { query: query }); + } + + /** Create a dedicated virtual account for an existing customer */ + async dedicatedAccountCreate(payload: DedicatedVirtualAccountDedicatedAccountCreateBody): Promise> { + return this.client.request("POST", "/dedicated_account", { body: payload }); + } + + /** With this endpoint, you can create a customer, validate the customer, and assign a DVA to the customer. */ + async dedicatedAccountAssign(payload: DedicatedVirtualAccountDedicatedAccountAssignBody): Promise> { + return this.client.request("POST", "/dedicated_account/assign", { body: payload }); + } + + /** Get details of a dedicated virtual account on your integration. */ + async dedicatedAccountFetch(id: string): Promise> { + let path = "/dedicated_account/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Deactivate a dedicated virtual account on your integration. */ + async dedicatedAccountDeactivate(id: string): Promise> { + let path = "/dedicated_account/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("DELETE", path); + } + + /** Requery Dedicated Virtual Account for new transactions */ + async dedicatedAccountRequery(query?: DedicatedVirtualAccountDedicatedAccountRequeryQuery): Promise> { + return this.client.request("GET", "/dedicated_account/requery", { query: query }); + } + + /** Split a dedicated virtual account transaction with one or more accounts */ + async dedicatedAccountAddSplit(payload: DedicatedVirtualAccountDedicatedAccountAddSplitBody): Promise> { + return this.client.request("POST", "/dedicated_account/split", { body: payload }); + } + + /** If you've previously set up split payment for transactions on a dedicated virtual account, you can remove it with this endpoint */ + async dedicatedAccountRemoveSplit(payload: DedicatedVirtualAccountDedicatedAccountRemoveSplitBody): Promise> { + return this.client.request("DELETE", "/dedicated_account/split", { body: payload }); + } + + /** Get available bank providers for a dedicated virtual account */ + async dedicatedAccountAvailableProviders(): Promise> { + return this.client.request("GET", "/dedicated_account/available_providers"); + } +} diff --git a/src/apis/direct-debit.ts b/src/apis/direct-debit.ts new file mode 100644 index 0000000..4eae6b8 --- /dev/null +++ b/src/apis/direct-debit.ts @@ -0,0 +1,19 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { DirectDebitDirectdebitTriggerActivationChargeBody } from "../models/index.js"; +import type { DirectDebitDirectdebitListMandateAuthorizationsQuery } from "../models/index.js"; +import type { DirectDebitDirectdebitListMandateAuthorizationsData } from "../models/index.js"; + +export class DirectDebitApi { + constructor(private readonly client: ApiClient) {} + + /** Trigger activation charge for specified customers */ + async directdebitTriggerActivationCharge(payload: DirectDebitDirectdebitTriggerActivationChargeBody): Promise> { + return this.client.request("PUT", "/directdebit/activation-charge", { body: payload }); + } + + /** Get a list of all the direct debit mandates on your integration */ + async directdebitListMandateAuthorizations(query?: DirectDebitDirectdebitListMandateAuthorizationsQuery): Promise> { + return this.client.request("GET", "/directdebit/mandate-authorizations", { query: query }); + } +} diff --git a/src/apis/dispute.ts b/src/apis/dispute.ts new file mode 100644 index 0000000..783edae --- /dev/null +++ b/src/apis/dispute.ts @@ -0,0 +1,71 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { DisputeUpdateBody } from "../models/index.js"; +import type { DisputeResolveBody } from "../models/index.js"; +import type { DisputeEvidenceBody } from "../models/index.js"; +import type { DisputeListQuery } from "../models/index.js"; +import type { DisputeDownloadQuery } from "../models/index.js"; +import type { DisputeListData } from "../models/index.js"; +import type { DisputeFetchData } from "../models/index.js"; +import type { DisputeUpdateData } from "../models/index.js"; +import type { DisputeUploadUrlData } from "../models/index.js"; +import type { DisputeDownloadData } from "../models/index.js"; +import type { DisputeTransactionData } from "../models/index.js"; +import type { DisputeResolveData } from "../models/index.js"; +import type { DisputeEvidenceData } from "../models/index.js"; + +export class DisputeApi { + constructor(private readonly client: ApiClient) {} + + /** List transaction disputes filed by customers */ + async list(query?: DisputeListQuery): Promise> { + return this.client.request("GET", "/dispute", { query: query }); + } + + /** Fetch a transaction dispute */ + async fetch(id: string): Promise> { + let path = "/dispute/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update a transaction dispute */ + async update(id: string, payload: DisputeUpdateBody): Promise> { + let path = "/dispute/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Get the URL to upload a dispute evidence */ + async uploadUrl(id: string): Promise> { + let path = "/dispute/{id}/upload_url"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Export the disputes available on your integration */ + async download(query?: DisputeDownloadQuery): Promise> { + return this.client.request("GET", "/dispute/export", { query: query }); + } + + /** List all disputes filed for a transaction */ + async transaction(id: string): Promise> { + let path = "/dispute/transaction/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Resolve a transaction dispute */ + async resolve(id: string, payload: DisputeResolveBody): Promise> { + let path = "/dispute/{id}/resolve"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Provide evidence for a dispute */ + async evidence(id: string, payload: DisputeEvidenceBody): Promise> { + let path = "/dispute/{id}/evidence"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } +} diff --git a/src/apis/index.ts b/src/apis/index.ts deleted file mode 100644 index 51d0f44..0000000 --- a/src/apis/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export * as Balance from './Balance'; -export * as BulkCharge from './BulkCharge'; -export * as Charge from './Charge'; -export * as Customer from './Customer'; -export * as DedicatedVirtualAccount from './DedicatedVirtualAccount'; -export * as Dispute from './Dispute'; -export * as Integration from './Integration'; -export * as Page from './Page'; -export * as PaymentRequest from './PaymentRequest'; -export * as Plan from './Plan'; -export * as Product from './Product'; -export * as Refund from './Refund'; -export * as Settlement from './Settlement'; -export * as Split from './Split'; -export * as Subaccount from './Subaccount'; -export * as Subscription from './Subscription'; -export * as Transaction from './Transaction'; -export * as Transfer from './Transfer'; -export * as TransferRecipient from './TransferRecipient'; -export * as Verification from './Verification'; diff --git a/src/apis/integration.ts b/src/apis/integration.ts new file mode 100644 index 0000000..06b75fd --- /dev/null +++ b/src/apis/integration.ts @@ -0,0 +1,19 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { IntegrationUpdatePaymentSessionTimeoutBody } from "../models/index.js"; +import type { IntegrationFetchPaymentSessionTimeoutData } from "../models/index.js"; +import type { IntegrationUpdatePaymentSessionTimeoutData } from "../models/index.js"; + +export class IntegrationApi { + constructor(private readonly client: ApiClient) {} + + /** Fetch the session timeout of a transaction */ + async fetchPaymentSessionTimeout(): Promise> { + return this.client.request("GET", "/integration/payment_session_timeout"); + } + + /** Update the session timeout of a transaction */ + async updatePaymentSessionTimeout(payload: IntegrationUpdatePaymentSessionTimeoutBody): Promise> { + return this.client.request("PUT", "/integration/payment_session_timeout", { body: payload }); + } +} diff --git a/src/apis/miscellaneous.ts b/src/apis/miscellaneous.ts new file mode 100644 index 0000000..785e057 --- /dev/null +++ b/src/apis/miscellaneous.ts @@ -0,0 +1,27 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { MiscellaneousAvsQuery } from "../models/index.js"; +import type { MiscellaneousResolveCardBinData } from "../models/index.js"; +import type { MiscellaneousListCountriesData } from "../models/index.js"; +import type { MiscellaneousAvsData } from "../models/index.js"; + +export class MiscellaneousApi { + constructor(private readonly client: ApiClient) {} + + /** Get the details of a card BIN */ + async resolveCardBin(bin: string): Promise> { + let path = "/decision/bin/{bin}"; + path = path.replace("{bin}", encodeURIComponent(String(bin))); + return this.client.request("GET", path); + } + + /** List all supported countries on Paystack */ + async listCountries(): Promise> { + return this.client.request("GET", "/country"); + } + + /** Get a list of states for a country for address verification */ + async avs(query?: MiscellaneousAvsQuery): Promise> { + return this.client.request("GET", "/address_verification/states", { query: query }); + } +} diff --git a/src/apis/order.ts b/src/apis/order.ts new file mode 100644 index 0000000..58c4bcb --- /dev/null +++ b/src/apis/order.ts @@ -0,0 +1,44 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { OrderCreateBody } from "../models/index.js"; +import type { OrderListQuery } from "../models/index.js"; +import type { OrderListData } from "../models/index.js"; +import type { OrderCreateData } from "../models/index.js"; +import type { OrderFetchData } from "../models/index.js"; +import type { OrderProductData } from "../models/index.js"; +import type { OrderValidateData } from "../models/index.js"; + +export class OrderApi { + constructor(private readonly client: ApiClient) {} + + /** List the previously created orders */ + async list(query?: OrderListQuery): Promise> { + return this.client.request("GET", "/order", { query: query }); + } + + /** Create an order for selected items */ + async create(payload: OrderCreateBody): Promise> { + return this.client.request("POST", "/order", { body: payload }); + } + + /** Fetch the details of a previously created order */ + async fetch(id: string): Promise> { + let path = "/order/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Fetch all orders for a particular product */ + async product(id: string): Promise> { + let path = "/order/product/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Validate a pay for me order */ + async validate(code: string): Promise> { + let path = "/order/{code}/validate"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/page.ts b/src/apis/page.ts new file mode 100644 index 0000000..f16503d --- /dev/null +++ b/src/apis/page.ts @@ -0,0 +1,55 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { PageCreateBody } from "../models/index.js"; +import type { PageUpdateBody } from "../models/index.js"; +import type { PageAddProductsBody } from "../models/index.js"; +import type { PageListQuery } from "../models/index.js"; +import type { PageListData } from "../models/index.js"; +import type { PageCreateData } from "../models/index.js"; +import type { PageFetchData } from "../models/index.js"; +import type { PageUpdateData } from "../models/index.js"; +import type { PageAddProductsData } from "../models/index.js"; + +export class PageApi { + constructor(private readonly client: ApiClient) {} + + /** List all previously created payment pages */ + async list(query?: PageListQuery): Promise> { + return this.client.request("GET", "/page", { query: query }); + } + + /** Create a webpage to receive payments */ + async create(payload: PageCreateBody): Promise> { + return this.client.request("POST", "/page", { body: payload }); + } + + /** Get a previously created payment page */ + async fetch(id: string): Promise> { + let path = "/page/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update a previously created payment page */ + async update(id: string, payload: PageUpdateBody): Promise> { + let path = "/page/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Check if a custom slug is available for use when creating a payment page */ + async checkSlugAvailability(slug: string): Promise> { + let path = "/page/check_slug_availability/{slug}"; + path = path.replace("{slug}", encodeURIComponent(String(slug))); + return this.client.request("GET", path); + } + + /** Add products to a previously created payment page. You can only add products to pages +that was created with a `product` type. + */ + async addProducts(id: string, payload: PageAddProductsBody): Promise> { + let path = "/page/{id}/product"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } +} diff --git a/src/apis/payment-request.ts b/src/apis/payment-request.ts new file mode 100644 index 0000000..3916eca --- /dev/null +++ b/src/apis/payment-request.ts @@ -0,0 +1,75 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { PaymentRequestCreateBody } from "../models/index.js"; +import type { PaymentRequestUpdateBody } from "../models/index.js"; +import type { PaymentRequestListQuery } from "../models/index.js"; +import type { PaymentRequestListData } from "../models/index.js"; +import type { PaymentRequestCreateData } from "../models/index.js"; +import type { PaymentRequestFetchData } from "../models/index.js"; +import type { PaymentRequestUpdateData } from "../models/index.js"; +import type { PaymentRequestVerifyData } from "../models/index.js"; +import type { PaymentRequestTotalsData } from "../models/index.js"; +import type { PaymentRequestFinalizeData } from "../models/index.js"; + +export class PaymentRequestApi { + constructor(private readonly client: ApiClient) {} + + /** List all previously created payment requests to your customers */ + async list(query?: PaymentRequestListQuery): Promise> { + return this.client.request("GET", "/paymentrequest", { query: query }); + } + + /** Create a new payment request by issuing an invoice to a customer */ + async create(payload: PaymentRequestCreateBody): Promise> { + return this.client.request("POST", "/paymentrequest", { body: payload }); + } + + /** Fetch a previously created payment request */ + async fetch(id: string): Promise> { + let path = "/paymentrequest/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update a previously created payment request */ + async update(id: string, payload: PaymentRequestUpdateBody): Promise> { + let path = "/paymentrequest/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Verify the status of a previously created payment request */ + async verify(id: string): Promise> { + let path = "/paymentrequest/verify/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Trigger an email reminder to a customer for a previously created payment request */ + async notify(id: string): Promise> { + let path = "/paymentrequest/notify/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path); + } + + /** Get the metric of all pending and successful payment requests */ + async totals(): Promise> { + return this.client.request("GET", "/paymentrequest/totals"); + } + + /** Finalise the creation of a draft payment request for a customer */ + async finalize(id: string): Promise> { + let path = "/paymentrequest/finalize/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path); + } + + /** Archive a payment request to clean up your records. An archived payment request cannot be verified and will not +be returned when listing all previously created payment requests. + */ + async archive(id: string): Promise> { + let path = "/paymentrequest/archive/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path); + } +} diff --git a/src/apis/plan.ts b/src/apis/plan.ts new file mode 100644 index 0000000..fb3e88e --- /dev/null +++ b/src/apis/plan.ts @@ -0,0 +1,36 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { PlanCreateBody } from "../models/index.js"; +import type { PlanUpdateBody } from "../models/index.js"; +import type { PlanListQuery } from "../models/index.js"; +import type { PlanListData } from "../models/index.js"; +import type { PlanCreateData } from "../models/index.js"; +import type { PlanFetchData } from "../models/index.js"; + +export class PlanApi { + constructor(private readonly client: ApiClient) {} + + /** List all recurring payment plans */ + async list(query?: PlanListQuery): Promise> { + return this.client.request("GET", "/plan", { query: query }); + } + + /** Create a plan for recurring payments */ + async create(payload: PlanCreateBody): Promise> { + return this.client.request("POST", "/plan", { body: payload }); + } + + /** Get the details of a payment plan */ + async fetch(code: string): Promise> { + let path = "/plan/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Update a plan details on your integration */ + async update(code: string, payload: PlanUpdateBody): Promise> { + let path = "/plan/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } +} diff --git a/src/apis/product.ts b/src/apis/product.ts new file mode 100644 index 0000000..1257ad2 --- /dev/null +++ b/src/apis/product.ts @@ -0,0 +1,44 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { ProductCreateBody } from "../models/index.js"; +import type { ProductUpdateBody } from "../models/index.js"; +import type { ProductListQuery } from "../models/index.js"; +import type { ProductListData } from "../models/index.js"; +import type { ProductCreateData } from "../models/index.js"; +import type { ProductFetchData } from "../models/index.js"; +import type { ProductUpdateData } from "../models/index.js"; + +export class ProductApi { + constructor(private readonly client: ApiClient) {} + + /** List all previously created products */ + async list(query?: ProductListQuery): Promise> { + return this.client.request("GET", "/product", { query: query }); + } + + /** Create a new product on your integration */ + async create(payload: ProductCreateBody): Promise> { + return this.client.request("POST", "/product", { body: payload }); + } + + /** Fetch a previously created product */ + async fetch(id: string): Promise> { + let path = "/product/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update a previously created product */ + async update(id: string, payload: ProductUpdateBody): Promise> { + let path = "/product/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Delete a previously created product */ + async delete_(id: string): Promise> { + let path = "/product/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("DELETE", path); + } +} diff --git a/src/apis/refund.ts b/src/apis/refund.ts new file mode 100644 index 0000000..b376ee3 --- /dev/null +++ b/src/apis/refund.ts @@ -0,0 +1,37 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { RefundCreateBody } from "../models/index.js"; +import type { RefundRetryBody } from "../models/index.js"; +import type { RefundListQuery } from "../models/index.js"; +import type { RefundListData } from "../models/index.js"; +import type { RefundCreateData } from "../models/index.js"; +import type { RefundRetryData } from "../models/index.js"; +import type { RefundFetchData } from "../models/index.js"; + +export class RefundApi { + constructor(private readonly client: ApiClient) {} + + /** List previously created refunds */ + async list(query?: RefundListQuery): Promise> { + return this.client.request("GET", "/refund", { query: query }); + } + + /** Initiate a refund for a previously completed transaction */ + async create(payload: RefundCreateBody): Promise> { + return this.client.request("POST", "/refund", { body: payload }); + } + + /** Retry a refund with a `needs-attention` status by providing the bank account details of a customer. */ + async retry(id: string, payload: RefundRetryBody): Promise> { + let path = "/refund/retry_with_customer_details/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } + + /** Get a previously created refund */ + async fetch(id: string): Promise> { + let path = "/refund/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/settlement.ts b/src/apis/settlement.ts new file mode 100644 index 0000000..0be3c65 --- /dev/null +++ b/src/apis/settlement.ts @@ -0,0 +1,21 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { SettlementSettlementsFetchQuery } from "../models/index.js"; +import type { SettlementSettlementsFetchData } from "../models/index.js"; +import type { SettlementSettlementsTransactionData } from "../models/index.js"; + +export class SettlementApi { + constructor(private readonly client: ApiClient) {} + + /** List settlements made to your settlement accounts */ + async settlementsFetch(query?: SettlementSettlementsFetchQuery): Promise> { + return this.client.request("GET", "/settlement", { query: query }); + } + + /** Get the transactions that make up a particular settlement */ + async settlementsTransaction(id: string): Promise> { + let path = "/settlement/{id}/transactions"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } +} diff --git a/src/apis/split.ts b/src/apis/split.ts new file mode 100644 index 0000000..6ce2d54 --- /dev/null +++ b/src/apis/split.ts @@ -0,0 +1,54 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { SplitCreateBody } from "../models/index.js"; +import type { SplitUpdateBody } from "../models/index.js"; +import type { SplitAddSubaccountBody } from "../models/index.js"; +import type { SplitRemoveSubaccountBody } from "../models/index.js"; +import type { SplitListQuery } from "../models/index.js"; +import type { SplitListData } from "../models/index.js"; +import type { SplitCreateData } from "../models/index.js"; +import type { SplitFetchData } from "../models/index.js"; +import type { SplitUpdateData } from "../models/index.js"; +import type { SplitAddSubaccountData } from "../models/index.js"; + +export class SplitApi { + constructor(private readonly client: ApiClient) {} + + /** List the transaction splits available on your integration */ + async list(query?: SplitListQuery): Promise> { + return this.client.request("GET", "/split", { query: query }); + } + + /** Create a split configuration for transactions */ + async create(payload: SplitCreateBody): Promise> { + return this.client.request("POST", "/split", { body: payload }); + } + + /** Get details of a split configuration for a transaction */ + async fetch(id: string): Promise> { + let path = "/split/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update a split configuration for transactions */ + async update(id: string, payload: SplitUpdateBody): Promise> { + let path = "/split/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Add a subaccount to a split configuration, or update the share of an existing subaccount */ + async addSubaccount(id: string, payload: SplitAddSubaccountBody): Promise> { + let path = "/split/{id}/subaccount/add"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } + + /** Remove a subaccount from a split configuration */ + async removeSubaccount(id: string, payload: SplitRemoveSubaccountBody): Promise> { + let path = "/split/{id}/subaccount/remove"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } +} diff --git a/src/apis/storefront.ts b/src/apis/storefront.ts new file mode 100644 index 0000000..1b92b56 --- /dev/null +++ b/src/apis/storefront.ts @@ -0,0 +1,92 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { StorefrontCreateBody } from "../models/index.js"; +import type { StorefrontUpdateBody } from "../models/index.js"; +import type { StorefrontAddProductsBody } from "../models/index.js"; +import type { StorefrontListQuery } from "../models/index.js"; +import type { StorefrontListData } from "../models/index.js"; +import type { StorefrontCreateData } from "../models/index.js"; +import type { StorefrontFetchData } from "../models/index.js"; +import type { StorefrontVerifySlugData } from "../models/index.js"; +import type { StorefrontFetchOrdersData } from "../models/index.js"; +import type { StorefrontListProductsData } from "../models/index.js"; +import type { StorefrontAddProductsData } from "../models/index.js"; +import type { StorefrontPublishData } from "../models/index.js"; +import type { StorefrontDuplicateData } from "../models/index.js"; + +export class StorefrontApi { + constructor(private readonly client: ApiClient) {} + + /** List the storefronts you previously created */ + async list(query?: StorefrontListQuery): Promise> { + return this.client.request("GET", "/storefront", { query: query }); + } + + /** Create a digital shop to manage and display your products */ + async create(payload: StorefrontCreateBody): Promise> { + return this.client.request("POST", "/storefront", { body: payload }); + } + + /** Get the details of a previously created Storefront */ + async fetch(id: string): Promise> { + let path = "/storefront/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Update the details of a previously created Storefront */ + async update(id: string, payload: StorefrontUpdateBody): Promise> { + let path = "/storefront/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Delete a previously created Storefront */ + async delete_(id: string): Promise> { + let path = "/storefront/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("DELETE", path); + } + + /** Verify the availability of a slug before using it for your Storefront */ + async verifySlug(slug: string): Promise> { + let path = "/storefront/verify/{slug}"; + path = path.replace("{slug}", encodeURIComponent(String(slug))); + return this.client.request("GET", path); + } + + /** Fetch all orders in your Storefront */ + async fetchOrders(id: string): Promise> { + let path = "/storefront/{id}/order"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** List the products in a Storefront */ + async listProducts(id: string): Promise> { + let path = "/storefront/{id}/product"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Add previously created products to a Storefront */ + async addProducts(id: string, payload: StorefrontAddProductsBody): Promise> { + let path = "/storefront/{id}/product"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } + + /** Make your Storefront publicly available */ + async publish(id: string): Promise> { + let path = "/storefront/{id}/publish"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path); + } + + /** Duplicate a previously created Storefront */ + async duplicate(id: string): Promise> { + let path = "/storefront/{id}/duplicate"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path); + } +} diff --git a/src/apis/subaccount.ts b/src/apis/subaccount.ts new file mode 100644 index 0000000..961524e --- /dev/null +++ b/src/apis/subaccount.ts @@ -0,0 +1,37 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { SubaccountCreateBody } from "../models/index.js"; +import type { SubaccountUpdateBody } from "../models/index.js"; +import type { SubaccountListQuery } from "../models/index.js"; +import type { SubaccountListData } from "../models/index.js"; +import type { SubaccountCreateData } from "../models/index.js"; +import type { SubaccountFetchData } from "../models/index.js"; +import type { SubaccountUpdateData } from "../models/index.js"; + +export class SubaccountApi { + constructor(private readonly client: ApiClient) {} + + /** List subaccounts available on your integration */ + async list(query?: SubaccountListQuery): Promise> { + return this.client.request("GET", "/subaccount", { query: query }); + } + + /** Create a subacount for a partner */ + async create(payload: SubaccountCreateBody): Promise> { + return this.client.request("POST", "/subaccount", { body: payload }); + } + + /** Get details of a subaccount on your integration */ + async fetch(code: string): Promise> { + let path = "/subaccount/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Update a subaccount details on your integration */ + async update(code: string, payload: SubaccountUpdateBody): Promise> { + let path = "/subaccount/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } +} diff --git a/src/apis/subscription.ts b/src/apis/subscription.ts new file mode 100644 index 0000000..4330c75 --- /dev/null +++ b/src/apis/subscription.ts @@ -0,0 +1,57 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { SubscriptionCreateBody } from "../models/index.js"; +import type { SubscriptionDisableBody } from "../models/index.js"; +import type { SubscriptionEnableBody } from "../models/index.js"; +import type { SubscriptionListQuery } from "../models/index.js"; +import type { SubscriptionListData } from "../models/index.js"; +import type { SubscriptionCreateData } from "../models/index.js"; +import type { SubscriptionFetchData } from "../models/index.js"; +import type { SubscriptionEnableData } from "../models/index.js"; +import type { SubscriptionManageLinkData } from "../models/index.js"; +import type { SubscriptionManageEmailData } from "../models/index.js"; + +export class SubscriptionApi { + constructor(private readonly client: ApiClient) {} + + /** List all subscriptions available on your integration */ + async list(query?: SubscriptionListQuery): Promise> { + return this.client.request("GET", "/subscription", { query: query }); + } + + /** Create a subscription a customer */ + async create(payload: SubscriptionCreateBody): Promise> { + return this.client.request("POST", "/subscription", { body: payload }); + } + + /** Get details of a customer's subscription */ + async fetch(code: string): Promise> { + let path = "/subscription/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Disable a subscription on your integration */ + async disable(payload: SubscriptionDisableBody): Promise> { + return this.client.request("POST", "/subscription/disable", { body: payload }); + } + + /** Enable a subscription on your integration */ + async enable(payload: SubscriptionEnableBody): Promise> { + return this.client.request("POST", "/subscription/enable", { body: payload }); + } + + /** Generate a link for updating the card on a subscription */ + async manageLink(code: string): Promise> { + let path = "/subscription/{code}/manage/link"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Email a customer a link for updating the card on their subscription */ + async manageEmail(code: string): Promise> { + let path = "/subscription/{code}/manage/email"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("POST", path); + } +} diff --git a/src/apis/terminal.ts b/src/apis/terminal.ts new file mode 100644 index 0000000..5b39277 --- /dev/null +++ b/src/apis/terminal.ts @@ -0,0 +1,67 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { TerminalSendEventBody } from "../models/index.js"; +import type { TerminalUpdateBody } from "../models/index.js"; +import type { TerminalCommissionBody } from "../models/index.js"; +import type { TerminalDecommissionBody } from "../models/index.js"; +import type { TerminalListQuery } from "../models/index.js"; +import type { TerminalSendEventData } from "../models/index.js"; +import type { TerminalFetchEventStatusData } from "../models/index.js"; +import type { TerminalFetchTerminalStatusData } from "../models/index.js"; +import type { TerminalListData } from "../models/index.js"; +import type { TerminalFetchData } from "../models/index.js"; + +export class TerminalApi { + constructor(private readonly client: ApiClient) {} + + /** Send an event from your application to the Paystack Terminal */ + async sendEvent(id: string, payload: TerminalSendEventBody): Promise> { + let path = "/terminal/{id}/event"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("POST", path, { body: payload }); + } + + /** Check the status of an event sent to the Terminal */ + async fetchEventStatus(terminal_id: string, event_id: string): Promise> { + let path = "/terminal/{terminal_id}/event/{event_id}"; + path = path.replace("{terminal_id}", encodeURIComponent(String(terminal_id))); + path = path.replace("{event_id}", encodeURIComponent(String(event_id))); + return this.client.request("GET", path); + } + + /** Check the availiability of a Terminal before sending an event to it */ + async fetchTerminalStatus(terminal_id: string): Promise> { + let path = "/terminal/{terminal_id}/presence"; + path = path.replace("{terminal_id}", encodeURIComponent(String(terminal_id))); + return this.client.request("GET", path); + } + + /** List the Terminals available on your integration */ + async list(query?: TerminalListQuery): Promise> { + return this.client.request("GET", "/terminal", { query: query }); + } + + /** Get the details of a Terminal */ + async fetch(terminal_id: string): Promise> { + let path = "/terminal/{terminal_id}"; + path = path.replace("{terminal_id}", encodeURIComponent(String(terminal_id))); + return this.client.request("GET", path); + } + + /** Update the details of a Terminal */ + async update(terminal_id: string, payload: TerminalUpdateBody): Promise> { + let path = "/terminal/{terminal_id}"; + path = path.replace("{terminal_id}", encodeURIComponent(String(terminal_id))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Activate your debug device by linking it to your integration */ + async commission(payload: TerminalCommissionBody): Promise> { + return this.client.request("POST", "/terminal/commission_device", { body: payload }); + } + + /** Unlink your debug device from your integration */ + async decommission(payload: TerminalDecommissionBody): Promise> { + return this.client.request("POST", "/terminal/decommission_device", { body: payload }); + } +} diff --git a/src/apis/transaction.ts b/src/apis/transaction.ts new file mode 100644 index 0000000..06ed4de --- /dev/null +++ b/src/apis/transaction.ts @@ -0,0 +1,72 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { TransactionInitializeBody } from "../models/index.js"; +import type { TransactionChargeAuthorizationBody } from "../models/index.js"; +import type { TransactionPartialDebitBody } from "../models/index.js"; +import type { TransactionListQuery } from "../models/index.js"; +import type { TransactionTotalsQuery } from "../models/index.js"; +import type { TransactionExportQuery } from "../models/index.js"; +import type { TransactionInitializeData } from "../models/index.js"; +import type { TransactionChargeAuthorizationData } from "../models/index.js"; +import type { TransactionPartialDebitData } from "../models/index.js"; +import type { TransactionVerifyData } from "../models/index.js"; +import type { TransactionListData } from "../models/index.js"; +import type { TransactionFetchData } from "../models/index.js"; +import type { TransactionTimelineData } from "../models/index.js"; +import type { TransactionTotalsData } from "../models/index.js"; +import type { TransactionExportData } from "../models/index.js"; + +export class TransactionApi { + constructor(private readonly client: ApiClient) {} + + /** Create a new transaction */ + async initialize(payload: TransactionInitializeBody): Promise> { + return this.client.request("POST", "/transaction/initialize", { body: payload }); + } + + /** Charge all authorizations marked as reusable with this endpoint whenever you need to receive payments */ + async chargeAuthorization(payload: TransactionChargeAuthorizationBody): Promise> { + return this.client.request("POST", "/transaction/charge_authorization", { body: payload }); + } + + /** Retrieve part of a payment from a customer */ + async partialDebit(payload: TransactionPartialDebitBody): Promise> { + return this.client.request("POST", "/transaction/partial_debit", { body: payload }); + } + + /** Verify a previously initiated transaction using it's reference */ + async verify(reference: string): Promise> { + let path = "/transaction/verify/{reference}"; + path = path.replace("{reference}", encodeURIComponent(String(reference))); + return this.client.request("GET", path); + } + + /** List transactions that has occurred on your integration */ + async list(query?: TransactionListQuery): Promise> { + return this.client.request("GET", "/transaction", { query: query }); + } + + /** Fetch a transaction to get its details */ + async fetch(id: string): Promise> { + let path = "/transaction/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Fetch the steps taken from the initiation to the completion of a transaction */ + async timeline(id: string): Promise> { + let path = "/transaction/timeline/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + return this.client.request("GET", path); + } + + /** Get the total amount of all transactions */ + async totals(query?: TransactionTotalsQuery): Promise> { + return this.client.request("GET", "/transaction/totals", { query: query }); + } + + /** Download transactions that occurred on your integration for a specific timeframe */ + async export_(query?: TransactionExportQuery): Promise> { + return this.client.request("GET", "/transaction/export", { query: query }); + } +} diff --git a/src/apis/transfer-recipient.ts b/src/apis/transfer-recipient.ts new file mode 100644 index 0000000..39774b3 --- /dev/null +++ b/src/apis/transfer-recipient.ts @@ -0,0 +1,51 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { TransferRecipientTransferrecipientCreateBody } from "../models/index.js"; +import type { TransferRecipientTransferrecipientBulkBody } from "../models/index.js"; +import type { TransferRecipientTransferrecipientUpdateBody } from "../models/index.js"; +import type { TransferRecipientTransferrecipientListQuery } from "../models/index.js"; +import type { TransferRecipientTransferrecipientListData } from "../models/index.js"; +import type { TransferRecipientTransferrecipientCreateData } from "../models/index.js"; +import type { TransferRecipientTransferrecipientBulkData } from "../models/index.js"; +import type { TransferRecipientTransferrecipientFetchData } from "../models/index.js"; + +export class TransferRecipientApi { + constructor(private readonly client: ApiClient) {} + + /** List transfer recipients available on your integration */ + async transferrecipientList(query?: TransferRecipientTransferrecipientListQuery): Promise> { + return this.client.request("GET", "/transferrecipient", { query: query }); + } + + /** Creates a new recipient. A duplicate account number will lead to the retrieval of the existing record. */ + async transferrecipientCreate(payload: TransferRecipientTransferrecipientCreateBody): Promise> { + return this.client.request("POST", "/transferrecipient", { body: payload }); + } + + /** Create multiple transfer recipients in batches. A duplicate account number will lead to the retrieval of the existing record. + */ + async transferrecipientBulk(payload: TransferRecipientTransferrecipientBulkBody): Promise> { + return this.client.request("POST", "/transferrecipient/bulk", { body: payload }); + } + + /** Fetch the details of a transfer recipient */ + async transferrecipientFetch(code: string): Promise> { + let path = "/transferrecipient/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Update the details of a transfer recipient */ + async transferrecipientUpdate(code: string, payload: TransferRecipientTransferrecipientUpdateBody): Promise> { + let path = "/transferrecipient/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Delete a transfer recipient (sets the transfer recipient to inactive) */ + async transferrecipientDelete(code: string): Promise> { + let path = "/transferrecipient/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("DELETE", path); + } +} diff --git a/src/apis/transfer.ts b/src/apis/transfer.ts new file mode 100644 index 0000000..f583a9d --- /dev/null +++ b/src/apis/transfer.ts @@ -0,0 +1,86 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { TransferInitiateBody } from "../models/index.js"; +import type { TransferFinalizeBody } from "../models/index.js"; +import type { TransferBulkBody } from "../models/index.js"; +import type { TransferResendOtpBody } from "../models/index.js"; +import type { TransferDisableOtpFinalizeBody } from "../models/index.js"; +import type { TransferListQuery } from "../models/index.js"; +import type { TransferExportTransferQuery } from "../models/index.js"; +import type { TransferListData } from "../models/index.js"; +import type { TransferInitiateData } from "../models/index.js"; +import type { TransferFinalizeData } from "../models/index.js"; +import type { TransferBulkData } from "../models/index.js"; +import type { TransferFetchData } from "../models/index.js"; +import type { TransferVerifyData } from "../models/index.js"; +import type { TransferExportTransferData } from "../models/index.js"; + +export class TransferApi { + constructor(private readonly client: ApiClient) {} + + /** List the transfers made on your integration */ + async list(query?: TransferListQuery): Promise> { + return this.client.request("GET", "/transfer", { query: query }); + } + + /** Send money to your customers */ + async initiate(payload: TransferInitiateBody): Promise> { + return this.client.request("POST", "/transfer", { body: payload }); + } + + /** Finalize an initiated transfer */ + async finalize(payload: TransferFinalizeBody): Promise> { + return this.client.request("POST", "/transfer/finalize_transfer", { body: payload }); + } + + /** Batch multiple transfers in a single request. + +You need to disable the Transfers OTP requirement to use this endpoint. + */ + async bulk(payload: TransferBulkBody): Promise> { + return this.client.request("POST", "/transfer/bulk", { body: payload }); + } + + /** Get details of a transfer on your integration */ + async fetch(code: string): Promise> { + let path = "/transfer/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Verify the status of a transfer on your integration */ + async verify(reference: string): Promise> { + let path = "/transfer/verify/{reference}"; + path = path.replace("{reference}", encodeURIComponent(String(reference))); + return this.client.request("GET", path); + } + + /** Export a list of transfers carried out on your integration */ + async exportTransfer(query?: TransferExportTransferQuery): Promise> { + return this.client.request("GET", "/transfer/export", { query: query }); + } + + /** Generates and send a new OTP to customer in the event they are having trouble receiving one. */ + async resendOtp(payload: TransferResendOtpBody): Promise> { + return this.client.request("POST", "/transfer/resend_otp", { body: payload }); + } + + /** This is used in the event that you want to be able to complete transfers programmatically without use of OTPs. +No arguments required. You will get an OTP to complete the request. + */ + async disableOtp(): Promise> { + return this.client.request("POST", "/transfer/disable_otp"); + } + + /** Finalize the request to disable OTP on your transfers */ + async disableOtpFinalize(payload: TransferDisableOtpFinalizeBody): Promise> { + return this.client.request("POST", "/transfer/disable_otp_finalize", { body: payload }); + } + + /** In the event that a customer wants to stop being able to complete transfers programmatically, this endpoint helps turn OTP requirement back on. +No arguments required. + */ + async enableOtp(): Promise> { + return this.client.request("POST", "/transfer/enable_otp"); + } +} diff --git a/src/apis/virtual-terminal.ts b/src/apis/virtual-terminal.ts new file mode 100644 index 0000000..e4978ce --- /dev/null +++ b/src/apis/virtual-terminal.ts @@ -0,0 +1,78 @@ +import { ApiClient } from "../core/api-client.js"; +import { ApiResponse } from "../core/types.js"; +import type { VirtualTerminalCreateBody } from "../models/index.js"; +import type { VirtualTerminalUpdateBody } from "../models/index.js"; +import type { VirtualTerminalDestinationAssignBody } from "../models/index.js"; +import type { VirtualTerminalDestinationUnassignBody } from "../models/index.js"; +import type { VirtualTerminalAddSplitCodeBody } from "../models/index.js"; +import type { VirtualTerminalDeleteSplitCodeBody } from "../models/index.js"; +import type { VirtualTerminalListQuery } from "../models/index.js"; +import type { VirtualTerminalListData } from "../models/index.js"; +import type { VirtualTerminalCreateData } from "../models/index.js"; +import type { VirtualTerminalFetchData } from "../models/index.js"; +import type { VirtualTerminalUpdateData } from "../models/index.js"; +import type { VirtualTerminalDestinationAssignData } from "../models/index.js"; +import type { VirtualTerminalAddSplitCodeData } from "../models/index.js"; + +export class VirtualTerminalApi { + constructor(private readonly client: ApiClient) {} + + /** List Virtual Terminals on your integration */ + async list(query?: VirtualTerminalListQuery): Promise> { + return this.client.request("GET", "/virtual_terminal", { query: query }); + } + + /** Create a Virtual Terminal on your integration */ + async create(payload: VirtualTerminalCreateBody): Promise> { + return this.client.request("POST", "/virtual_terminal", { body: payload }); + } + + /** Fetch a Virtual Terminal on your integration */ + async fetch(code: string): Promise> { + let path = "/virtual_terminal/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("GET", path); + } + + /** Update a Virtual Terminal on your integration */ + async update(code: string, payload: VirtualTerminalUpdateBody): Promise> { + let path = "/virtual_terminal/{code}"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Deactivate a Virtual Terminal on your integration */ + async deactivate(code: string): Promise> { + let path = "/virtual_terminal/{code}/deactivate"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path); + } + + /** Add a destination (WhatsApp number) to a Virtual Terminal on your integration */ + async destinationAssign(code: string, payload: VirtualTerminalDestinationAssignBody): Promise> { + let path = "/virtual_terminal/{code}/destination/assign"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("POST", path, { body: payload }); + } + + /** Unassign a destination (WhatsApp Number) from a Virtual Terminal on your integration */ + async destinationUnassign(code: string, payload: VirtualTerminalDestinationUnassignBody): Promise> { + let path = "/virtual_terminal/{code}/destination/unassign"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("POST", path, { body: payload }); + } + + /** Add Split Code to Virtual Terminal */ + async addSplitCode(code: string, payload: VirtualTerminalAddSplitCodeBody): Promise> { + let path = "/virtual_terminal/{code}/split_code"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("PUT", path, { body: payload }); + } + + /** Remove Split Code from Virtual Terminal */ + async deleteSplitCode(code: string, payload: VirtualTerminalDeleteSplitCodeBody): Promise> { + let path = "/virtual_terminal/{code}/split_code"; + path = path.replace("{code}", encodeURIComponent(String(code))); + return this.client.request("DELETE", path, { body: payload }); + } +} diff --git a/src/core/api-client.ts b/src/core/api-client.ts new file mode 100644 index 0000000..6d6ed80 --- /dev/null +++ b/src/core/api-client.ts @@ -0,0 +1,73 @@ +import { ApiClientConfig, ApiRequestOptions, QueryValue } from "./types.js"; +import { ApiError } from "./errors.js"; + +function toQueryString(query: Record | undefined): string { + if (!query) { + return ""; + } + + const search = new URLSearchParams(); + for (const [key, value] of Object.entries(query)) { + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + for (const item of value) { + search.append(key, String(item)); + } + continue; + } + + search.append(key, String(value)); + } + + const out = search.toString(); + return out ? `?${out}` : ""; +} + +export class ApiClient { + private static readonly BASE_URL = "https://api.paystack.co"; + private static readonly TIMEOUT_MS = 30_000; + + private readonly secretKey: string; + + constructor(config: ApiClientConfig) { + this.secretKey = config.secretKey; + } + + async request>( + method: string, + path: string, + options: ApiRequestOptions = {} + ): Promise { + const url = `${ApiClient.BASE_URL}${path}${toQueryString(options.query as Record | undefined)}`; + + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), ApiClient.TIMEOUT_MS); + + try { + const response = await fetch(url, { + method, + headers: { + Authorization: `Bearer ${this.secretKey}`, + "Content-Type": "application/json", + ...(options.headers ?? {}), + }, + body: options.body === undefined ? undefined : JSON.stringify(options.body), + signal: controller.signal, + }); + + const text = await response.text(); + const payload = text ? JSON.parse(text) : undefined; + + if (!response.ok) { + throw new ApiError(response.status, response.statusText, payload); + } + + return payload as TResponse; + } finally { + clearTimeout(timeout); + } + } +} diff --git a/src/core/errors.ts b/src/core/errors.ts new file mode 100644 index 0000000..e224241 --- /dev/null +++ b/src/core/errors.ts @@ -0,0 +1,13 @@ +export class ApiError extends Error { + readonly status: number; + readonly statusText: string; + readonly payload?: unknown; + + constructor(status: number, statusText: string, payload?: unknown) { + super(`Paystack API request failed with status ${status} (${statusText})`); + this.name = "ApiError"; + this.status = status; + this.statusText = statusText; + this.payload = payload; + } +} diff --git a/src/core/types.ts b/src/core/types.ts new file mode 100644 index 0000000..afd6eb7 --- /dev/null +++ b/src/core/types.ts @@ -0,0 +1,17 @@ +export type QueryValue = string | number | boolean | Array; + +export interface ApiClientConfig { + secretKey: string; +} + +export interface ApiRequestOptions> { + query?: TQuery; + headers?: Record; + body?: unknown; +} + +export interface ApiResponse { + status: boolean; + message: string; + data: T; +} diff --git a/src/index.ts b/src/index.ts index b6be4d6..88e810e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,66 +1,93 @@ -import { Balance } from './apis/Balance'; -import { BulkCharge } from './apis/BulkCharge'; -import { Charge } from './apis/Charge'; -import { Customer } from './apis/Customer'; -import { DedicatedVirtualAccount } from './apis/DedicatedVirtualAccount'; -import { Dispute } from './apis/Dispute'; -import { Integration } from './apis/Integration'; -import { Page } from './apis/Page'; -import { PaymentRequest } from './apis/PaymentRequest'; -import { Plan } from './apis/Plan'; -import { Product } from './apis/Product'; -import { Refund } from './apis/Refund'; -import { Settlement } from './apis/Settlement'; -import { Split } from './apis/Split'; -import { Subaccount } from './apis/Subaccount'; -import { Subscription } from './apis/Subscription'; -import { Transaction } from './apis/Transaction'; -import { Transfer } from './apis/Transfer'; -import { TransferRecipient } from './apis/TransferRecipient'; -import { Verification } from './apis/Verification'; +import { ApiClient } from "./core/api-client.js"; +import type { ApiClientConfig } from "./core/types.js"; +import { TransactionApi } from "./apis/transaction.js"; +import { ChargeApi } from "./apis/charge.js"; +import { BulkChargeApi } from "./apis/bulk-charge.js"; +import { SubaccountApi } from "./apis/subaccount.js"; +import { SplitApi } from "./apis/split.js"; +import { TerminalApi } from "./apis/terminal.js"; +import { VirtualTerminalApi } from "./apis/virtual-terminal.js"; +import { CustomerApi } from "./apis/customer.js"; +import { DirectDebitApi } from "./apis/direct-debit.js"; +import { DedicatedVirtualAccountApi } from "./apis/dedicated-virtual-account.js"; +import { ApplePayApi } from "./apis/apple-pay.js"; +import { PlanApi } from "./apis/plan.js"; +import { SubscriptionApi } from "./apis/subscription.js"; +import { TransferRecipientApi } from "./apis/transfer-recipient.js"; +import { TransferApi } from "./apis/transfer.js"; +import { BalanceApi } from "./apis/balance.js"; +import { PaymentRequestApi } from "./apis/payment-request.js"; +import { ProductApi } from "./apis/product.js"; +import { StorefrontApi } from "./apis/storefront.js"; +import { OrderApi } from "./apis/order.js"; +import { PageApi } from "./apis/page.js"; +import { SettlementApi } from "./apis/settlement.js"; +import { IntegrationApi } from "./apis/integration.js"; +import { RefundApi } from "./apis/refund.js"; +import { DisputeApi } from "./apis/dispute.js"; +import { BankApi } from "./apis/bank.js"; +import { MiscellaneousApi } from "./apis/miscellaneous.js"; export class Paystack { - public readonly balance: Balance; - public readonly bulkCharge: BulkCharge; - public readonly charge: Charge; - public readonly customer: Customer; - public readonly dedicatedVirtualAccount: DedicatedVirtualAccount; - public readonly dispute: Dispute; - public readonly integration: Integration; - public readonly page: Page; - public readonly paymentRequest: PaymentRequest; - public readonly plan: Plan; - public readonly product: Product; - public readonly refund: Refund; - public readonly settlement: Settlement; - public readonly split: Split; - public readonly subaccount: Subaccount; - public readonly subscription: Subscription; - public readonly transaction: Transaction; - public readonly transfer: Transfer; - public readonly transferRecipient: TransferRecipient; - public readonly verification: Verification; + public readonly transaction: TransactionApi; + public readonly charge: ChargeApi; + public readonly bulkCharge: BulkChargeApi; + public readonly subaccount: SubaccountApi; + public readonly split: SplitApi; + public readonly terminal: TerminalApi; + public readonly virtualTerminal: VirtualTerminalApi; + public readonly customer: CustomerApi; + public readonly directDebit: DirectDebitApi; + public readonly dedicatedVirtualAccount: DedicatedVirtualAccountApi; + public readonly applePay: ApplePayApi; + public readonly plan: PlanApi; + public readonly subscription: SubscriptionApi; + public readonly transferRecipient: TransferRecipientApi; + public readonly transfer: TransferApi; + public readonly balance: BalanceApi; + public readonly paymentRequest: PaymentRequestApi; + public readonly product: ProductApi; + public readonly storefront: StorefrontApi; + public readonly order: OrderApi; + public readonly page: PageApi; + public readonly settlement: SettlementApi; + public readonly integration: IntegrationApi; + public readonly refund: RefundApi; + public readonly dispute: DisputeApi; + public readonly bank: BankApi; + public readonly miscellaneous: MiscellaneousApi; - constructor(apiKey: string) { - this.balance = new Balance(apiKey); - this.bulkCharge = new BulkCharge(apiKey); - this.charge = new Charge(apiKey); - this.customer = new Customer(apiKey); - this.dedicatedVirtualAccount = new DedicatedVirtualAccount(apiKey); - this.dispute = new Dispute(apiKey); - this.integration = new Integration(apiKey); - this.page = new Page(apiKey); - this.paymentRequest = new PaymentRequest(apiKey); - this.plan = new Plan(apiKey); - this.product = new Product(apiKey); - this.refund = new Refund(apiKey); - this.settlement = new Settlement(apiKey); - this.split = new Split(apiKey); - this.subaccount = new Subaccount(apiKey); - this.subscription = new Subscription(apiKey); - this.transaction = new Transaction(apiKey); - this.transfer = new Transfer(apiKey); - this.transferRecipient = new TransferRecipient(apiKey); - this.verification = new Verification(apiKey); + constructor(config: ApiClientConfig) { + const client = new ApiClient(config); + this.transaction = new TransactionApi(client); + this.charge = new ChargeApi(client); + this.bulkCharge = new BulkChargeApi(client); + this.subaccount = new SubaccountApi(client); + this.split = new SplitApi(client); + this.terminal = new TerminalApi(client); + this.virtualTerminal = new VirtualTerminalApi(client); + this.customer = new CustomerApi(client); + this.directDebit = new DirectDebitApi(client); + this.dedicatedVirtualAccount = new DedicatedVirtualAccountApi(client); + this.applePay = new ApplePayApi(client); + this.plan = new PlanApi(client); + this.subscription = new SubscriptionApi(client); + this.transferRecipient = new TransferRecipientApi(client); + this.transfer = new TransferApi(client); + this.balance = new BalanceApi(client); + this.paymentRequest = new PaymentRequestApi(client); + this.product = new ProductApi(client); + this.storefront = new StorefrontApi(client); + this.order = new OrderApi(client); + this.page = new PageApi(client); + this.settlement = new SettlementApi(client); + this.integration = new IntegrationApi(client); + this.refund = new RefundApi(client); + this.dispute = new DisputeApi(client); + this.bank = new BankApi(client); + this.miscellaneous = new MiscellaneousApi(client); } -} \ No newline at end of file +} + +export type { ApiClientConfig, ApiResponse } from "./core/types.js"; +export * from "./models/index.js"; diff --git a/src/models/Accepted.ts b/src/models/Accepted.ts deleted file mode 100644 index fba8582..0000000 --- a/src/models/Accepted.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface Accepted - */ -export interface Accepted { - /** - * - * @type {boolean} - * @memberof Accepted - */ - status?: boolean; - /** - * - * @type {string} - * @memberof Accepted - */ - message?: string; -} - -export function AcceptedFromJSON(json: any): Accepted { - return AcceptedFromJSONTyped(json, false); -} - -export function AcceptedFromJSONTyped(json: any, ignoreDiscriminator: boolean): Accepted { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'status': !exists(json, 'status') ? undefined : json['status'], - 'message': !exists(json, 'message') ? undefined : json['message'], - }; -} - -export function AcceptedToJSON(value?: Accepted | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'status': value.status, - 'message': value.message, - }; -} - - diff --git a/src/models/Bank.ts b/src/models/Bank.ts deleted file mode 100644 index 9e7868b..0000000 --- a/src/models/Bank.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface Bank - */ -export interface Bank { - /** - * Customer's bank code - * @type {string} - * @memberof Bank - */ - code?: string; - /** - * Customer's account number - * @type {string} - * @memberof Bank - */ - accountNumber?: string; -} - -export function BankFromJSON(json: any): Bank { - return BankFromJSONTyped(json, false); -} - -export function BankFromJSONTyped(json: any, ignoreDiscriminator: boolean): Bank { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'code': !exists(json, 'code') ? undefined : json['code'], - 'accountNumber': !exists(json, 'account_number') ? undefined : json['account_number'], - }; -} - -export function BankToJSON(value?: Bank | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'code': value.code, - 'account_number': value.accountNumber, - }; -} - - diff --git a/src/models/BulkChargeInitiate.ts b/src/models/BulkChargeInitiate.ts deleted file mode 100644 index 2d72f5a..0000000 --- a/src/models/BulkChargeInitiate.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface BulkChargeInitiate - */ -export interface BulkChargeInitiate { - /** - * Customer's card authorization code - * @type {string} - * @memberof BulkChargeInitiate - */ - authorization: string; - /** - * Amount to charge on the authorization - * @type {string} - * @memberof BulkChargeInitiate - */ - amount: string; -} - -export function BulkChargeInitiateFromJSON(json: any): BulkChargeInitiate { - return BulkChargeInitiateFromJSONTyped(json, false); -} - -export function BulkChargeInitiateFromJSONTyped(json: any, ignoreDiscriminator: boolean): BulkChargeInitiate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'authorization': json['authorization'], - 'amount': json['amount'], - }; -} - -export function BulkChargeInitiateToJSON(value?: BulkChargeInitiate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'authorization': value.authorization, - 'amount': value.amount, - }; -} - - diff --git a/src/models/ChargeCreate.ts b/src/models/ChargeCreate.ts deleted file mode 100644 index 9058902..0000000 --- a/src/models/ChargeCreate.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeCreate - */ -export interface ChargeCreate { - /** - * Customer's email address - * @type {string} - * @memberof ChargeCreate - */ - email: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {string} - * @memberof ChargeCreate - */ - amount: string; - /** - * An authorization code to charge. - * @type {string} - * @memberof ChargeCreate - */ - authorizationCode?: string; - /** - * 4-digit PIN (send with a non-reusable authorization code) - * @type {string} - * @memberof ChargeCreate - */ - pin?: string; - /** - * Unique transaction reference. Only -, .`, = and alphanumeric characters allowed. - * @type {string} - * @memberof ChargeCreate - */ - reference?: string; - /** - * The customer's birthday in the format YYYY-MM-DD e.g 2017-05-16 - * @type {Date} - * @memberof ChargeCreate - */ - birthday?: Date; - /** - * This is the unique identifier of the device a user uses in making payment. - * Only -, .`, = and alphanumeric characters are allowed. - * @type {string} - * @memberof ChargeCreate - */ - deviceId?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof ChargeCreate - */ - metadata?: string; -} - -export function ChargeCreateFromJSON(json: any): ChargeCreate { - return ChargeCreateFromJSONTyped(json, false); -} - -export function ChargeCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'amount': json['amount'], - 'authorizationCode': !exists(json, 'authorization_code') ? undefined : json['authorization_code'], - 'pin': !exists(json, 'pin') ? undefined : json['pin'], - 'reference': !exists(json, 'reference') ? undefined : json['reference'], - 'birthday': !exists(json, 'birthday') ? undefined : (new Date(json['birthday'])), - 'deviceId': !exists(json, 'device_id') ? undefined : json['device_id'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function ChargeCreateToJSON(value?: ChargeCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'amount': value.amount, - 'authorization_code': value.authorizationCode, - 'pin': value.pin, - 'reference': value.reference, - 'birthday': value.birthday === undefined ? undefined : (value.birthday.toISOString()), - 'device_id': value.deviceId, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/ChargeSubmitAddress.ts b/src/models/ChargeSubmitAddress.ts deleted file mode 100644 index fa5d355..0000000 --- a/src/models/ChargeSubmitAddress.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeSubmitAddress - */ -export interface ChargeSubmitAddress { - /** - * Customer's address - * @type {string} - * @memberof ChargeSubmitAddress - */ - address: string; - /** - * Customer's city - * @type {string} - * @memberof ChargeSubmitAddress - */ - city: string; - /** - * Customer's state - * @type {string} - * @memberof ChargeSubmitAddress - */ - state: string; - /** - * Customer's zipcode - * @type {string} - * @memberof ChargeSubmitAddress - */ - zipcode: string; - /** - * The reference of the ongoing transaction - * @type {string} - * @memberof ChargeSubmitAddress - */ - reference: string; -} - -export function ChargeSubmitAddressFromJSON(json: any): ChargeSubmitAddress { - return ChargeSubmitAddressFromJSONTyped(json, false); -} - -export function ChargeSubmitAddressFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeSubmitAddress { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'address': json['address'], - 'city': json['city'], - 'state': json['state'], - 'zipcode': json['zipcode'], - 'reference': json['reference'], - }; -} - -export function ChargeSubmitAddressToJSON(value?: ChargeSubmitAddress | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'address': value.address, - 'city': value.city, - 'state': value.state, - 'zipcode': value.zipcode, - 'reference': value.reference, - }; -} - - diff --git a/src/models/ChargeSubmitBirthday.ts b/src/models/ChargeSubmitBirthday.ts deleted file mode 100644 index 2d69964..0000000 --- a/src/models/ChargeSubmitBirthday.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeSubmitBirthday - */ -export interface ChargeSubmitBirthday { - /** - * Customer's birthday in the format YYYY-MM-DD e.g 2016-09-21 - * @type {string} - * @memberof ChargeSubmitBirthday - */ - birthday: string; - /** - * The reference of the ongoing transaction - * @type {string} - * @memberof ChargeSubmitBirthday - */ - reference: string; -} - -export function ChargeSubmitBirthdayFromJSON(json: any): ChargeSubmitBirthday { - return ChargeSubmitBirthdayFromJSONTyped(json, false); -} - -export function ChargeSubmitBirthdayFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeSubmitBirthday { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'birthday': json['birthday'], - 'reference': json['reference'], - }; -} - -export function ChargeSubmitBirthdayToJSON(value?: ChargeSubmitBirthday | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'birthday': value.birthday, - 'reference': value.reference, - }; -} - - diff --git a/src/models/ChargeSubmitOTP.ts b/src/models/ChargeSubmitOTP.ts deleted file mode 100644 index d0f8aed..0000000 --- a/src/models/ChargeSubmitOTP.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeSubmitOTP - */ -export interface ChargeSubmitOTP { - /** - * Customer's OTP - * @type {string} - * @memberof ChargeSubmitOTP - */ - otp: string; - /** - * The reference of the ongoing transaction - * @type {string} - * @memberof ChargeSubmitOTP - */ - reference: string; -} - -export function ChargeSubmitOTPFromJSON(json: any): ChargeSubmitOTP { - return ChargeSubmitOTPFromJSONTyped(json, false); -} - -export function ChargeSubmitOTPFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeSubmitOTP { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'otp': json['otp'], - 'reference': json['reference'], - }; -} - -export function ChargeSubmitOTPToJSON(value?: ChargeSubmitOTP | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'otp': value.otp, - 'reference': value.reference, - }; -} - - diff --git a/src/models/ChargeSubmitPhone.ts b/src/models/ChargeSubmitPhone.ts deleted file mode 100644 index 011f420..0000000 --- a/src/models/ChargeSubmitPhone.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeSubmitPhone - */ -export interface ChargeSubmitPhone { - /** - * Customer's mobile number - * @type {string} - * @memberof ChargeSubmitPhone - */ - phone: string; - /** - * The reference of the ongoing transaction - * @type {string} - * @memberof ChargeSubmitPhone - */ - reference: string; -} - -export function ChargeSubmitPhoneFromJSON(json: any): ChargeSubmitPhone { - return ChargeSubmitPhoneFromJSONTyped(json, false); -} - -export function ChargeSubmitPhoneFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeSubmitPhone { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'phone': json['phone'], - 'reference': json['reference'], - }; -} - -export function ChargeSubmitPhoneToJSON(value?: ChargeSubmitPhone | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'phone': value.phone, - 'reference': value.reference, - }; -} - - diff --git a/src/models/ChargeSubmitPin.ts b/src/models/ChargeSubmitPin.ts deleted file mode 100644 index 2f5d7cc..0000000 --- a/src/models/ChargeSubmitPin.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ChargeSubmitPin - */ -export interface ChargeSubmitPin { - /** - * Customer's PIN - * @type {string} - * @memberof ChargeSubmitPin - */ - pin: string; - /** - * Transaction reference that requires the PIN - * @type {string} - * @memberof ChargeSubmitPin - */ - reference: string; -} - -export function ChargeSubmitPinFromJSON(json: any): ChargeSubmitPin { - return ChargeSubmitPinFromJSONTyped(json, false); -} - -export function ChargeSubmitPinFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChargeSubmitPin { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'pin': json['pin'], - 'reference': json['reference'], - }; -} - -export function ChargeSubmitPinToJSON(value?: ChargeSubmitPin | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'pin': value.pin, - 'reference': value.reference, - }; -} - - diff --git a/src/models/CustomerCreate.ts b/src/models/CustomerCreate.ts deleted file mode 100644 index 3b8d78a..0000000 --- a/src/models/CustomerCreate.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerCreate - */ -export interface CustomerCreate { - /** - * Customer's email address - * @type {string} - * @memberof CustomerCreate - */ - email: string; - /** - * Customer's first name - * @type {string} - * @memberof CustomerCreate - */ - firstName?: string; - /** - * Customer's last name - * @type {string} - * @memberof CustomerCreate - */ - lastName?: string; - /** - * Customer's phone number - * @type {string} - * @memberof CustomerCreate - */ - phone?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof CustomerCreate - */ - metadata?: string; -} - -export function CustomerCreateFromJSON(json: any): CustomerCreate { - return CustomerCreateFromJSONTyped(json, false); -} - -export function CustomerCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'firstName': !exists(json, 'first_name') ? undefined : json['first_name'], - 'lastName': !exists(json, 'last_name') ? undefined : json['last_name'], - 'phone': !exists(json, 'phone') ? undefined : json['phone'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function CustomerCreateToJSON(value?: CustomerCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'first_name': value.firstName, - 'last_name': value.lastName, - 'phone': value.phone, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/CustomerDeactivateAuthorization.ts b/src/models/CustomerDeactivateAuthorization.ts deleted file mode 100644 index b8c1155..0000000 --- a/src/models/CustomerDeactivateAuthorization.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerDeactivateAuthorization - */ -export interface CustomerDeactivateAuthorization { - /** - * Authorization code to be deactivated - * @type {string} - * @memberof CustomerDeactivateAuthorization - */ - authorizationCode: string; -} - -export function CustomerDeactivateAuthorizationFromJSON(json: any): CustomerDeactivateAuthorization { - return CustomerDeactivateAuthorizationFromJSONTyped(json, false); -} - -export function CustomerDeactivateAuthorizationFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerDeactivateAuthorization { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'authorizationCode': json['authorization_code'], - }; -} - -export function CustomerDeactivateAuthorizationToJSON(value?: CustomerDeactivateAuthorization | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'authorization_code': value.authorizationCode, - }; -} - - diff --git a/src/models/CustomerRiskAction.ts b/src/models/CustomerRiskAction.ts deleted file mode 100644 index b6d0ce3..0000000 --- a/src/models/CustomerRiskAction.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerRiskAction - */ -export interface CustomerRiskAction { - /** - * Customer's code, or email address - * @type {string} - * @memberof CustomerRiskAction - */ - customer: string; - /** - * One of the possible risk actions [ default, allow, deny ]. allow to whitelist. - * deny to blacklist. Customers start with a default risk action. - * @type {string} - * @memberof CustomerRiskAction - */ - riskAction?: string; -} - -export function CustomerRiskActionFromJSON(json: any): CustomerRiskAction { - return CustomerRiskActionFromJSONTyped(json, false); -} - -export function CustomerRiskActionFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerRiskAction { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customer': json['customer'], - 'riskAction': !exists(json, 'risk_action') ? undefined : json['risk_action'], - }; -} - -export function CustomerRiskActionToJSON(value?: CustomerRiskAction | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer': value.customer, - 'risk_action': value.riskAction, - }; -} - - diff --git a/src/models/CustomerUpdate.ts b/src/models/CustomerUpdate.ts deleted file mode 100644 index e25fa00..0000000 --- a/src/models/CustomerUpdate.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerUpdate - */ -export interface CustomerUpdate { - /** - * Customer's first name - * @type {string} - * @memberof CustomerUpdate - */ - firstName?: string; - /** - * Customer's last name - * @type {string} - * @memberof CustomerUpdate - */ - lastName?: string; - /** - * Customer's phone number - * @type {string} - * @memberof CustomerUpdate - */ - phone?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof CustomerUpdate - */ - metadata?: string; -} - -export function CustomerUpdateFromJSON(json: any): CustomerUpdate { - return CustomerUpdateFromJSONTyped(json, false); -} - -export function CustomerUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'firstName': !exists(json, 'first_name') ? undefined : json['first_name'], - 'lastName': !exists(json, 'last_name') ? undefined : json['last_name'], - 'phone': !exists(json, 'phone') ? undefined : json['phone'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function CustomerUpdateToJSON(value?: CustomerUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'first_name': value.firstName, - 'last_name': value.lastName, - 'phone': value.phone, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/CustomerValidate.ts b/src/models/CustomerValidate.ts deleted file mode 100644 index 1a53968..0000000 --- a/src/models/CustomerValidate.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerValidate - */ -export interface CustomerValidate { - /** - * Customer's first name - * @type {string} - * @memberof CustomerValidate - */ - firstName: string; - /** - * Customer's last name - * @type {string} - * @memberof CustomerValidate - */ - lastName: string; - /** - * Predefined types of identification. e.g. (BVN) - * @type {string} - * @memberof CustomerValidate - */ - type: string; - /** - * Customer's identification number - * @type {string} - * @memberof CustomerValidate - */ - value: string; - /** - * 2 letter country code of identification issuer - * @type {string} - * @memberof CustomerValidate - */ - country: string; -} - -export function CustomerValidateFromJSON(json: any): CustomerValidate { - return CustomerValidateFromJSONTyped(json, false); -} - -export function CustomerValidateFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerValidate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'firstName': json['first_name'], - 'lastName': json['last_name'], - 'type': json['type'], - 'value': json['value'], - 'country': json['country'], - }; -} - -export function CustomerValidateToJSON(value?: CustomerValidate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'first_name': value.firstName, - 'last_name': value.lastName, - 'type': value.type, - 'value': value.value, - 'country': value.country, - }; -} - - diff --git a/src/models/CustomerValidation.ts b/src/models/CustomerValidation.ts deleted file mode 100644 index a10adff..0000000 --- a/src/models/CustomerValidation.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CustomerValidation - */ -export interface CustomerValidation { - /** - * Customer's first name - * @type {string} - * @memberof CustomerValidation - */ - firstName: string; - /** - * Customer's last name - * @type {string} - * @memberof CustomerValidation - */ - lastName: string; - /** - * Predefined types of identification. - * @type {string} - * @memberof CustomerValidation - */ - type: string; - /** - * Two-letter country code of identification issuer - * @type {string} - * @memberof CustomerValidation - */ - country: string; - /** - * Customer's Bank Verification Number - * @type {string} - * @memberof CustomerValidation - */ - bvn: string; - /** - * You can get the list of bank codes by calling the List Banks endpoint (https://api.paystack.co/bank). - * @type {string} - * @memberof CustomerValidation - */ - bankCode: string; - /** - * Customer's bank account number. - * @type {string} - * @memberof CustomerValidation - */ - accountNumber: string; - /** - * Customer's identification number. Required if type is bvn - * @type {string} - * @memberof CustomerValidation - */ - value?: string; -} - -export function CustomerValidationFromJSON(json: any): CustomerValidation { - return CustomerValidationFromJSONTyped(json, false); -} - -export function CustomerValidationFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomerValidation { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'firstName': json['first_name'], - 'lastName': json['last_name'], - 'type': json['type'], - 'country': json['country'], - 'bvn': json['bvn'], - 'bankCode': json['bank_code'], - 'accountNumber': json['account_number'], - 'value': !exists(json, 'value') ? undefined : json['value'], - }; -} - -export function CustomerValidationToJSON(value?: CustomerValidation | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'first_name': value.firstName, - 'last_name': value.lastName, - 'type': value.type, - 'country': value.country, - 'bvn': value.bvn, - 'bank_code': value.bankCode, - 'account_number': value.accountNumber, - 'value': value.value, - }; -} - - diff --git a/src/models/DedicatedVirtualAccountCreate.ts b/src/models/DedicatedVirtualAccountCreate.ts deleted file mode 100644 index 87f16a4..0000000 --- a/src/models/DedicatedVirtualAccountCreate.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface DedicatedVirtualAccountCreate - */ -export interface DedicatedVirtualAccountCreate { - /** - * Customer ID or code - * @type {string} - * @memberof DedicatedVirtualAccountCreate - */ - customer: string; - /** - * The bank slug for preferred bank. To get a list of available banks, use the List Providers endpoint - * @type {string} - * @memberof DedicatedVirtualAccountCreate - */ - preferredBank?: string; - /** - * Subaccount code of the account you want to split the transaction with - * @type {string} - * @memberof DedicatedVirtualAccountCreate - */ - subaccount?: string; - /** - * Split code consisting of the lists of accounts you want to split the transaction with - * @type {string} - * @memberof DedicatedVirtualAccountCreate - */ - splitCode?: string; -} - -export function DedicatedVirtualAccountCreateFromJSON(json: any): DedicatedVirtualAccountCreate { - return DedicatedVirtualAccountCreateFromJSONTyped(json, false); -} - -export function DedicatedVirtualAccountCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): DedicatedVirtualAccountCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customer': json['customer'], - 'preferredBank': !exists(json, 'preferred_bank') ? undefined : json['preferred_bank'], - 'subaccount': !exists(json, 'subaccount') ? undefined : json['subaccount'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - }; -} - -export function DedicatedVirtualAccountCreateToJSON(value?: DedicatedVirtualAccountCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer': value.customer, - 'preferred_bank': value.preferredBank, - 'subaccount': value.subaccount, - 'split_code': value.splitCode, - }; -} - - diff --git a/src/models/DedicatedVirtualAccountSplit.ts b/src/models/DedicatedVirtualAccountSplit.ts deleted file mode 100644 index c7bc0a4..0000000 --- a/src/models/DedicatedVirtualAccountSplit.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface DedicatedVirtualAccountSplit - */ -export interface DedicatedVirtualAccountSplit { - /** - * Valid Dedicated virtual account - * @type {string} - * @memberof DedicatedVirtualAccountSplit - */ - accountNumber: string; - /** - * Subaccount code of the account you want to split the transaction with - * @type {string} - * @memberof DedicatedVirtualAccountSplit - */ - subaccount?: string; - /** - * Split code consisting of the lists of accounts you want to split the transaction with - * @type {string} - * @memberof DedicatedVirtualAccountSplit - */ - splitCode?: string; -} - -export function DedicatedVirtualAccountSplitFromJSON(json: any): DedicatedVirtualAccountSplit { - return DedicatedVirtualAccountSplitFromJSONTyped(json, false); -} - -export function DedicatedVirtualAccountSplitFromJSONTyped(json: any, ignoreDiscriminator: boolean): DedicatedVirtualAccountSplit { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'accountNumber': json['account_number'], - 'subaccount': !exists(json, 'subaccount') ? undefined : json['subaccount'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - }; -} - -export function DedicatedVirtualAccountSplitToJSON(value?: DedicatedVirtualAccountSplit | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'account_number': value.accountNumber, - 'subaccount': value.subaccount, - 'split_code': value.splitCode, - }; -} - - diff --git a/src/models/DisputeEvidence.ts b/src/models/DisputeEvidence.ts deleted file mode 100644 index 3097bdb..0000000 --- a/src/models/DisputeEvidence.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface DisputeEvidence - */ -export interface DisputeEvidence { - /** - * Customer email - * @type {string} - * @memberof DisputeEvidence - */ - customerEmail: string; - /** - * Customer name - * @type {string} - * @memberof DisputeEvidence - */ - customerName: string; - /** - * Customer mobile number - * @type {string} - * @memberof DisputeEvidence - */ - customerPhone: string; - /** - * Details of service offered - * @type {string} - * @memberof DisputeEvidence - */ - serviceDetails: string; - /** - * Delivery address - * @type {string} - * @memberof DisputeEvidence - */ - deliveryAddress?: string; - /** - * ISO 8601 representation of delivery date (YYYY-MM-DD) - * @type {Date} - * @memberof DisputeEvidence - */ - deliveryDate?: Date; -} - -export function DisputeEvidenceFromJSON(json: any): DisputeEvidence { - return DisputeEvidenceFromJSONTyped(json, false); -} - -export function DisputeEvidenceFromJSONTyped(json: any, ignoreDiscriminator: boolean): DisputeEvidence { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customerEmail': json['customer_email'], - 'customerName': json['customer_name'], - 'customerPhone': json['customer_phone'], - 'serviceDetails': json['service_details'], - 'deliveryAddress': !exists(json, 'delivery_address') ? undefined : json['delivery_address'], - 'deliveryDate': !exists(json, 'delivery_date') ? undefined : (new Date(json['delivery_date'])), - }; -} - -export function DisputeEvidenceToJSON(value?: DisputeEvidence | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer_email': value.customerEmail, - 'customer_name': value.customerName, - 'customer_phone': value.customerPhone, - 'service_details': value.serviceDetails, - 'delivery_address': value.deliveryAddress, - 'delivery_date': value.deliveryDate === undefined ? undefined : (value.deliveryDate.toISOString()), - }; -} - - diff --git a/src/models/DisputeResolve.ts b/src/models/DisputeResolve.ts deleted file mode 100644 index 32b8216..0000000 --- a/src/models/DisputeResolve.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface DisputeResolve - */ -export interface DisputeResolve { - /** - * Dispute resolution. Accepted values, merchant-accepted, declined - * @type {string} - * @memberof DisputeResolve - */ - resolution: string; - /** - * Reason for resolving - * @type {string} - * @memberof DisputeResolve - */ - message: string; - /** - * The amount to refund, in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {string} - * @memberof DisputeResolve - */ - refundAmount: string; - /** - * Filename of attachment returned via response from the Dispute upload URL - * @type {string} - * @memberof DisputeResolve - */ - uploadedFilename: string; - /** - * Evidence Id for fraud claims - * @type {number} - * @memberof DisputeResolve - */ - evidence?: number; -} - -export function DisputeResolveFromJSON(json: any): DisputeResolve { - return DisputeResolveFromJSONTyped(json, false); -} - -export function DisputeResolveFromJSONTyped(json: any, ignoreDiscriminator: boolean): DisputeResolve { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'resolution': json['resolution'], - 'message': json['message'], - 'refundAmount': json['refund_amount'], - 'uploadedFilename': json['uploaded_filename'], - 'evidence': !exists(json, 'evidence') ? undefined : json['evidence'], - }; -} - -export function DisputeResolveToJSON(value?: DisputeResolve | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'resolution': value.resolution, - 'message': value.message, - 'refund_amount': value.refundAmount, - 'uploaded_filename': value.uploadedFilename, - 'evidence': value.evidence, - }; -} - - diff --git a/src/models/DisputeUpdate.ts b/src/models/DisputeUpdate.ts deleted file mode 100644 index 17d6265..0000000 --- a/src/models/DisputeUpdate.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface DisputeUpdate - */ -export interface DisputeUpdate { - /** - * The amount to refund, in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {string} - * @memberof DisputeUpdate - */ - refundAmount: string; - /** - * Filename of attachment returned via response from the Dispute upload URL - * @type {string} - * @memberof DisputeUpdate - */ - uploadedFilename?: string; -} - -export function DisputeUpdateFromJSON(json: any): DisputeUpdate { - return DisputeUpdateFromJSONTyped(json, false); -} - -export function DisputeUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): DisputeUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'refundAmount': json['refund_amount'], - 'uploadedFilename': !exists(json, 'uploaded_filename') ? undefined : json['uploaded_filename'], - }; -} - -export function DisputeUpdateToJSON(value?: DisputeUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'refund_amount': value.refundAmount, - 'uploaded_filename': value.uploadedFilename, - }; -} - - diff --git a/src/models/EFT.ts b/src/models/EFT.ts deleted file mode 100644 index d73bdb7..0000000 --- a/src/models/EFT.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface EFT - */ -export interface EFT { - /** - * The EFT provider - * @type {string} - * @memberof EFT - */ - provider?: string; -} - -export function EFTFromJSON(json: any): EFT { - return EFTFromJSONTyped(json, false); -} - -export function EFTFromJSONTyped(json: any, ignoreDiscriminator: boolean): EFT { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'provider': !exists(json, 'provider') ? undefined : json['provider'], - }; -} - -export function EFTToJSON(value?: EFT | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'provider': value.provider, - }; -} - - diff --git a/src/models/MobileMoney.ts b/src/models/MobileMoney.ts deleted file mode 100644 index a8b80a4..0000000 --- a/src/models/MobileMoney.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface MobileMoney - */ -export interface MobileMoney { - /** - * Customer's phone number - * @type {string} - * @memberof MobileMoney - */ - phone?: string; - /** - * The telco provider of customer's phone number. This can be fetched from the List Bank endpoint - * @type {string} - * @memberof MobileMoney - */ - provider?: string; -} - -export function MobileMoneyFromJSON(json: any): MobileMoney { - return MobileMoneyFromJSONTyped(json, false); -} - -export function MobileMoneyFromJSONTyped(json: any, ignoreDiscriminator: boolean): MobileMoney { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'phone': !exists(json, 'phone') ? undefined : json['phone'], - 'provider': !exists(json, 'provider') ? undefined : json['provider'], - }; -} - -export function MobileMoneyToJSON(value?: MobileMoney | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'phone': value.phone, - 'provider': value.provider, - }; -} - - diff --git a/src/models/ModelError.ts b/src/models/ModelError.ts deleted file mode 100644 index 7f2819e..0000000 --- a/src/models/ModelError.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ModelError - */ -export interface ModelError { - /** - * - * @type {boolean} - * @memberof ModelError - */ - status?: boolean; - /** - * - * @type {string} - * @memberof ModelError - */ - message?: string; -} - -export function ModelErrorFromJSON(json: any): ModelError { - return ModelErrorFromJSONTyped(json, false); -} - -export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelError { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'status': !exists(json, 'status') ? undefined : json['status'], - 'message': !exists(json, 'message') ? undefined : json['message'], - }; -} - -export function ModelErrorToJSON(value?: ModelError | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'status': value.status, - 'message': value.message, - }; -} - - diff --git a/src/models/PageCreate.ts b/src/models/PageCreate.ts deleted file mode 100644 index 7ac7850..0000000 --- a/src/models/PageCreate.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PageCreate - */ -export interface PageCreate { - /** - * Name of page - * @type {string} - * @memberof PageCreate - */ - name: string; - /** - * The description of the page - * @type {string} - * @memberof PageCreate - */ - description?: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof PageCreate - */ - amount?: number; - /** - * URL slug you would like to be associated with this page. Page will be accessible at https://paystack.com/pay/[slug] - * @type {string} - * @memberof PageCreate - */ - slug?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof PageCreate - */ - metadata?: string; - /** - * If you would like Paystack to redirect to a URL upon successful payment, specify the URL here. - * @type {string} - * @memberof PageCreate - */ - redirectUrl?: string; - /** - * If you would like to accept custom fields, specify them here. - * @type {Array} - * @memberof PageCreate - */ - customFields?: Array; -} - -export function PageCreateFromJSON(json: any): PageCreate { - return PageCreateFromJSONTyped(json, false); -} - -export function PageCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PageCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'slug': !exists(json, 'slug') ? undefined : json['slug'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - 'redirectUrl': !exists(json, 'redirect_url') ? undefined : json['redirect_url'], - 'customFields': !exists(json, 'custom_fields') ? undefined : json['custom_fields'], - }; -} - -export function PageCreateToJSON(value?: PageCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'amount': value.amount, - 'slug': value.slug, - 'metadata': value.metadata, - 'redirect_url': value.redirectUrl, - 'custom_fields': value.customFields, - }; -} - - diff --git a/src/models/PageProduct.ts b/src/models/PageProduct.ts deleted file mode 100644 index 5d26028..0000000 --- a/src/models/PageProduct.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PageProduct - */ -export interface PageProduct { - /** - * IDs of all products to add to a page - * @type {Array} - * @memberof PageProduct - */ - product: Array; -} - -export function PageProductFromJSON(json: any): PageProduct { - return PageProductFromJSONTyped(json, false); -} - -export function PageProductFromJSONTyped(json: any, ignoreDiscriminator: boolean): PageProduct { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'product': json['product'], - }; -} - -export function PageProductToJSON(value?: PageProduct | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'product': value.product, - }; -} - - diff --git a/src/models/PageUpdate.ts b/src/models/PageUpdate.ts deleted file mode 100644 index 0d5d77d..0000000 --- a/src/models/PageUpdate.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PageUpdate - */ -export interface PageUpdate { - /** - * Name of page - * @type {string} - * @memberof PageUpdate - */ - name?: string; - /** - * The description of the page - * @type {string} - * @memberof PageUpdate - */ - description?: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof PageUpdate - */ - amount?: number; - /** - * Set to false to deactivate page url - * @type {boolean} - * @memberof PageUpdate - */ - active?: boolean; -} - -export function PageUpdateFromJSON(json: any): PageUpdate { - return PageUpdateFromJSONTyped(json, false); -} - -export function PageUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PageUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'active': !exists(json, 'active') ? undefined : json['active'], - }; -} - -export function PageUpdateToJSON(value?: PageUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'amount': value.amount, - 'active': value.active, - }; -} - - diff --git a/src/models/PaymentRequestCreate.ts b/src/models/PaymentRequestCreate.ts deleted file mode 100644 index 38abc68..0000000 --- a/src/models/PaymentRequestCreate.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PaymentRequestCreate - */ -export interface PaymentRequestCreate { - /** - * Customer id or code - * @type {string} - * @memberof PaymentRequestCreate - */ - customer: string; - /** - * Payment request amount. Only useful if line items and tax values are ignored. - * The endpoint will throw a friendly warning if neither is available. - * @type {number} - * @memberof PaymentRequestCreate - */ - amount?: number; - /** - * Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN - * @type {string} - * @memberof PaymentRequestCreate - */ - currency?: string; - /** - * ISO 8601 representation of request due date - * @type {Date} - * @memberof PaymentRequestCreate - */ - dueDate?: Date; - /** - * A short description of the payment request - * @type {string} - * @memberof PaymentRequestCreate - */ - description?: string; - /** - * Array of line items - * @type {Array} - * @memberof PaymentRequestCreate - */ - lineItems?: Array; - /** - * Array of taxes - * @type {Array} - * @memberof PaymentRequestCreate - */ - tax?: Array; - /** - * Indicates whether Paystack sends an email notification to customer. Defaults to true - * @type {Array} - * @memberof PaymentRequestCreate - */ - sendNotification?: Array; - /** - * Indicate if request should be saved as draft. Defaults to false and overrides send_notification - * @type {Array} - * @memberof PaymentRequestCreate - */ - draft?: Array; - /** - * Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) - * even if there are no line_items or tax passed - * @type {Array} - * @memberof PaymentRequestCreate - */ - hasInvoice?: Array; - /** - * Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help - * override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. - * @type {number} - * @memberof PaymentRequestCreate - */ - invoiceNumber?: number; - /** - * The split code of the transaction split. - * @type {string} - * @memberof PaymentRequestCreate - */ - splitCode?: string; -} - -export function PaymentRequestCreateFromJSON(json: any): PaymentRequestCreate { - return PaymentRequestCreateFromJSONTyped(json, false); -} - -export function PaymentRequestCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customer': json['customer'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'dueDate': !exists(json, 'due_date') ? undefined : (new Date(json['due_date'])), - 'description': !exists(json, 'description') ? undefined : json['description'], - 'lineItems': !exists(json, 'line_items') ? undefined : json['line_items'], - 'tax': !exists(json, 'tax') ? undefined : json['tax'], - 'sendNotification': !exists(json, 'send_notification') ? undefined : json['send_notification'], - 'draft': !exists(json, 'draft') ? undefined : json['draft'], - 'hasInvoice': !exists(json, 'has_invoice') ? undefined : json['has_invoice'], - 'invoiceNumber': !exists(json, 'invoice_number') ? undefined : json['invoice_number'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - }; -} - -export function PaymentRequestCreateToJSON(value?: PaymentRequestCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer': value.customer, - 'amount': value.amount, - 'currency': value.currency, - 'due_date': value.dueDate === undefined ? undefined : (value.dueDate.toISOString()), - 'description': value.description, - 'line_items': value.lineItems, - 'tax': value.tax, - 'send_notification': value.sendNotification, - 'draft': value.draft, - 'has_invoice': value.hasInvoice, - 'invoice_number': value.invoiceNumber, - 'split_code': value.splitCode, - }; -} - - diff --git a/src/models/PaymentRequestUpdate.ts b/src/models/PaymentRequestUpdate.ts deleted file mode 100644 index 0d18e62..0000000 --- a/src/models/PaymentRequestUpdate.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PaymentRequestUpdate - */ -export interface PaymentRequestUpdate { - /** - * Customer id or code - * @type {string} - * @memberof PaymentRequestUpdate - */ - customer?: string; - /** - * Payment request amount. Only useful if line items and tax values are ignored. - * The endpoint will throw a friendly warning if neither is available. - * @type {number} - * @memberof PaymentRequestUpdate - */ - amount?: number; - /** - * Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN - * @type {string} - * @memberof PaymentRequestUpdate - */ - currency?: string; - /** - * ISO 8601 representation of request due date - * @type {Date} - * @memberof PaymentRequestUpdate - */ - dueDate?: Date; - /** - * A short description of the payment request - * @type {string} - * @memberof PaymentRequestUpdate - */ - description?: string; - /** - * Array of line items - * @type {Array} - * @memberof PaymentRequestUpdate - */ - lineItems?: Array; - /** - * Array of taxes - * @type {Array} - * @memberof PaymentRequestUpdate - */ - tax?: Array; - /** - * Indicates whether Paystack sends an email notification to customer. Defaults to true - * @type {Array} - * @memberof PaymentRequestUpdate - */ - sendNotification?: Array; - /** - * Indicate if request should be saved as draft. Defaults to false and overrides send_notification - * @type {Array} - * @memberof PaymentRequestUpdate - */ - draft?: Array; - /** - * Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) - * even if there are no line_items or tax passed - * @type {Array} - * @memberof PaymentRequestUpdate - */ - hasInvoice?: Array; - /** - * Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help - * override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. - * @type {number} - * @memberof PaymentRequestUpdate - */ - invoiceNumber?: number; - /** - * The split code of the transaction split. - * @type {string} - * @memberof PaymentRequestUpdate - */ - splitCode?: string; -} - -export function PaymentRequestUpdateFromJSON(json: any): PaymentRequestUpdate { - return PaymentRequestUpdateFromJSONTyped(json, false); -} - -export function PaymentRequestUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customer': !exists(json, 'customer') ? undefined : json['customer'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'dueDate': !exists(json, 'due_date') ? undefined : (new Date(json['due_date'])), - 'description': !exists(json, 'description') ? undefined : json['description'], - 'lineItems': !exists(json, 'line_items') ? undefined : json['line_items'], - 'tax': !exists(json, 'tax') ? undefined : json['tax'], - 'sendNotification': !exists(json, 'send_notification') ? undefined : json['send_notification'], - 'draft': !exists(json, 'draft') ? undefined : json['draft'], - 'hasInvoice': !exists(json, 'has_invoice') ? undefined : json['has_invoice'], - 'invoiceNumber': !exists(json, 'invoice_number') ? undefined : json['invoice_number'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - }; -} - -export function PaymentRequestUpdateToJSON(value?: PaymentRequestUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer': value.customer, - 'amount': value.amount, - 'currency': value.currency, - 'due_date': value.dueDate === undefined ? undefined : (value.dueDate.toISOString()), - 'description': value.description, - 'line_items': value.lineItems, - 'tax': value.tax, - 'send_notification': value.sendNotification, - 'draft': value.draft, - 'has_invoice': value.hasInvoice, - 'invoice_number': value.invoiceNumber, - 'split_code': value.splitCode, - }; -} - - diff --git a/src/models/PlanCreate.ts b/src/models/PlanCreate.ts deleted file mode 100644 index 3fd49d6..0000000 --- a/src/models/PlanCreate.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PlanCreate - */ -export interface PlanCreate { - /** - * Name of plan - * @type {string} - * @memberof PlanCreate - */ - name: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof PlanCreate - */ - amount: number; - /** - * Interval in words. Valid intervals are daily, weekly, monthly,biannually, annually - * @type {string} - * @memberof PlanCreate - */ - interval: string; - /** - * A description for this plan - * @type {string} - * @memberof PlanCreate - */ - description?: string; - /** - * Set to false if you don't want invoices to be sent to your customers - * @type {boolean} - * @memberof PlanCreate - */ - sendInvoices?: boolean; - /** - * Set to false if you don't want text messages to be sent to your customers - * @type {boolean} - * @memberof PlanCreate - */ - sendSms?: boolean; - /** - * Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD - * @type {string} - * @memberof PlanCreate - */ - currency?: string; - /** - * Number of invoices to raise during subscription to this plan. - * Can be overridden by specifying an invoice_limit while subscribing. - * @type {number} - * @memberof PlanCreate - */ - invoiceLimit?: number; -} - -export function PlanCreateFromJSON(json: any): PlanCreate { - return PlanCreateFromJSONTyped(json, false); -} - -export function PlanCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlanCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'amount': json['amount'], - 'interval': json['interval'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'sendInvoices': !exists(json, 'send_invoices') ? undefined : json['send_invoices'], - 'sendSms': !exists(json, 'send_sms') ? undefined : json['send_sms'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'invoiceLimit': !exists(json, 'invoice_limit') ? undefined : json['invoice_limit'], - }; -} - -export function PlanCreateToJSON(value?: PlanCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'amount': value.amount, - 'interval': value.interval, - 'description': value.description, - 'send_invoices': value.sendInvoices, - 'send_sms': value.sendSms, - 'currency': value.currency, - 'invoice_limit': value.invoiceLimit, - }; -} - - diff --git a/src/models/PlanUpdate.ts b/src/models/PlanUpdate.ts deleted file mode 100644 index f600340..0000000 --- a/src/models/PlanUpdate.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PlanUpdate - */ -export interface PlanUpdate { - /** - * Name of plan - * @type {string} - * @memberof PlanUpdate - */ - name?: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof PlanUpdate - */ - amount?: number; - /** - * Interval in words. Valid intervals are daily, weekly, monthly,biannually, annually - * @type {string} - * @memberof PlanUpdate - */ - interval?: string; - /** - * A description for this plan - * @type {boolean} - * @memberof PlanUpdate - */ - description?: boolean; - /** - * Set to false if you don't want invoices to be sent to your customers - * @type {boolean} - * @memberof PlanUpdate - */ - sendInvoices?: boolean; - /** - * Set to false if you don't want text messages to be sent to your customers - * @type {boolean} - * @memberof PlanUpdate - */ - sendSms?: boolean; - /** - * Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD - * @type {string} - * @memberof PlanUpdate - */ - currency?: string; - /** - * Number of invoices to raise during subscription to this plan. - * Can be overridden by specifying an invoice_limit while subscribing. - * @type {number} - * @memberof PlanUpdate - */ - invoiceLimit?: number; -} - -export function PlanUpdateFromJSON(json: any): PlanUpdate { - return PlanUpdateFromJSONTyped(json, false); -} - -export function PlanUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlanUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'interval': !exists(json, 'interval') ? undefined : json['interval'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'sendInvoices': !exists(json, 'send_invoices') ? undefined : json['send_invoices'], - 'sendSms': !exists(json, 'send_sms') ? undefined : json['send_sms'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'invoiceLimit': !exists(json, 'invoice_limit') ? undefined : json['invoice_limit'], - }; -} - -export function PlanUpdateToJSON(value?: PlanUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'amount': value.amount, - 'interval': value.interval, - 'description': value.description, - 'send_invoices': value.sendInvoices, - 'send_sms': value.sendSms, - 'currency': value.currency, - 'invoice_limit': value.invoiceLimit, - }; -} - - diff --git a/src/models/ProductCreate.ts b/src/models/ProductCreate.ts deleted file mode 100644 index 3753afe..0000000 --- a/src/models/ProductCreate.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ProductCreate - */ -export interface ProductCreate { - /** - * Name of product - * @type {string} - * @memberof ProductCreate - */ - name: string; - /** - * The description of the product - * @type {string} - * @memberof ProductCreate - */ - description: string; - /** - * Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof ProductCreate - */ - price: number; - /** - * Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD - * @type {string} - * @memberof ProductCreate - */ - currency: string; - /** - * Set to true if the product has limited stock. Leave as false if the product has unlimited stock - * @type {boolean} - * @memberof ProductCreate - */ - limited?: boolean; - /** - * Number of products in stock. Use if limited is true - * @type {number} - * @memberof ProductCreate - */ - quantity?: number; -} - -export function ProductCreateFromJSON(json: any): ProductCreate { - return ProductCreateFromJSONTyped(json, false); -} - -export function ProductCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProductCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'description': json['description'], - 'price': json['price'], - 'currency': json['currency'], - 'limited': !exists(json, 'limited') ? undefined : json['limited'], - 'quantity': !exists(json, 'quantity') ? undefined : json['quantity'], - }; -} - -export function ProductCreateToJSON(value?: ProductCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'price': value.price, - 'currency': value.currency, - 'limited': value.limited, - 'quantity': value.quantity, - }; -} - - diff --git a/src/models/ProductUpdate.ts b/src/models/ProductUpdate.ts deleted file mode 100644 index b69d8c6..0000000 --- a/src/models/ProductUpdate.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ProductUpdate - */ -export interface ProductUpdate { - /** - * Name of product - * @type {string} - * @memberof ProductUpdate - */ - name?: string; - /** - * The description of the product - * @type {string} - * @memberof ProductUpdate - */ - description?: string; - /** - * Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof ProductUpdate - */ - price?: number; - /** - * Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD - * @type {string} - * @memberof ProductUpdate - */ - currency?: string; - /** - * Set to true if the product has limited stock. Leave as false if the product has unlimited stock - * @type {boolean} - * @memberof ProductUpdate - */ - limited?: boolean; - /** - * Number of products in stock. Use if limited is true - * @type {number} - * @memberof ProductUpdate - */ - quantity?: number; -} - -export function ProductUpdateFromJSON(json: any): ProductUpdate { - return ProductUpdateFromJSONTyped(json, false); -} - -export function ProductUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProductUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'price': !exists(json, 'price') ? undefined : json['price'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'limited': !exists(json, 'limited') ? undefined : json['limited'], - 'quantity': !exists(json, 'quantity') ? undefined : json['quantity'], - }; -} - -export function ProductUpdateToJSON(value?: ProductUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'price': value.price, - 'currency': value.currency, - 'limited': value.limited, - 'quantity': value.quantity, - }; -} - - diff --git a/src/models/RefundCreate.ts b/src/models/RefundCreate.ts deleted file mode 100644 index 9d60190..0000000 --- a/src/models/RefundCreate.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface RefundCreate - */ -export interface RefundCreate { - /** - * Transaction reference or id - * @type {string} - * @memberof RefundCreate - */ - transaction: string; - /** - * Amount ( in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR ) to be refunded to the customer. - * Amount cannot be more than the original transaction amount - * @type {number} - * @memberof RefundCreate - */ - amount?: number; - /** - * Three-letter ISO currency. Allowed values are NGN, GHS, ZAR or USD - * @type {string} - * @memberof RefundCreate - */ - currency?: string; - /** - * Customer reason - * @type {string} - * @memberof RefundCreate - */ - customerNote?: string; - /** - * Merchant reason - * @type {string} - * @memberof RefundCreate - */ - merchantNote?: string; -} - -export function RefundCreateFromJSON(json: any): RefundCreate { - return RefundCreateFromJSONTyped(json, false); -} - -export function RefundCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): RefundCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'transaction': json['transaction'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'customerNote': !exists(json, 'customer_note') ? undefined : json['customer_note'], - 'merchantNote': !exists(json, 'merchant_note') ? undefined : json['merchant_note'], - }; -} - -export function RefundCreateToJSON(value?: RefundCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'transaction': value.transaction, - 'amount': value.amount, - 'currency': value.currency, - 'customer_note': value.customerNote, - 'merchant_note': value.merchantNote, - }; -} - - diff --git a/src/models/Response.ts b/src/models/Response.ts deleted file mode 100644 index 2fe59ad..0000000 --- a/src/models/Response.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface Response - */ -export interface Response { - /** - * - * @type {boolean} - * @memberof Response - */ - status?: boolean; - /** - * - * @type {string} - * @memberof Response - */ - message?: string; - /** - * - * @type {object} - * @memberof Response - */ - data?: object; -} - -export function ResponseFromJSON(json: any): Response { - return ResponseFromJSONTyped(json, false); -} - -export function ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Response { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'status': !exists(json, 'status') ? undefined : json['status'], - 'message': !exists(json, 'message') ? undefined : json['message'], - 'data': !exists(json, 'data') ? undefined : json['data'], - }; -} - -export function ResponseToJSON(value?: Response | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'status': value.status, - 'message': value.message, - 'data': value.data, - }; -} - - diff --git a/src/models/SplitCreate.ts b/src/models/SplitCreate.ts deleted file mode 100644 index fb1824f..0000000 --- a/src/models/SplitCreate.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -import { - SplitSubaccounts, - SplitSubaccountsFromJSON, - SplitSubaccountsFromJSONTyped, - SplitSubaccountsToJSON, -} from './'; - -/** - * - * @export - * @interface SplitCreate - */ -export interface SplitCreate { - /** - * Name of the transaction split - * @type {string} - * @memberof SplitCreate - */ - name: string; - /** - * The type of transaction split you want to create. - * @type {string} - * @memberof SplitCreate - */ - type: string; - /** - * A list of object containing subaccount code and number of shares - * @type {Array} - * @memberof SplitCreate - */ - subaccounts: Array; - /** - * The transaction currency - * @type {string} - * @memberof SplitCreate - */ - currency: string; - /** - * This allows you specify how the transaction charge should be processed - * @type {string} - * @memberof SplitCreate - */ - bearerType?: string; - /** - * This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type - * @type {string} - * @memberof SplitCreate - */ - bearerSubaccount?: string; -} - -export function SplitCreateFromJSON(json: any): SplitCreate { - return SplitCreateFromJSONTyped(json, false); -} - -export function SplitCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SplitCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'type': json['type'], - 'subaccounts': ((json['subaccounts'] as Array).map(SplitSubaccountsFromJSON)), - 'currency': json['currency'], - 'bearerType': !exists(json, 'bearer_type') ? undefined : json['bearer_type'], - 'bearerSubaccount': !exists(json, 'bearer_subaccount') ? undefined : json['bearer_subaccount'], - }; -} - -export function SplitCreateToJSON(value?: SplitCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'type': value.type, - 'subaccounts': ((value.subaccounts as Array).map(SplitSubaccountsToJSON)), - 'currency': value.currency, - 'bearer_type': value.bearerType, - 'bearer_subaccount': value.bearerSubaccount, - }; -} - - diff --git a/src/models/SplitSubaccounts.ts b/src/models/SplitSubaccounts.ts deleted file mode 100644 index e97740f..0000000 --- a/src/models/SplitSubaccounts.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SplitSubaccounts - */ -export interface SplitSubaccounts { - /** - * Subaccount code of the customer or partner - * @type {string} - * @memberof SplitSubaccounts - */ - subaccount?: string; - /** - * The percentage or flat quota of the customer or partner - * @type {string} - * @memberof SplitSubaccounts - */ - share?: string; -} - -export function SplitSubaccountsFromJSON(json: any): SplitSubaccounts { - return SplitSubaccountsFromJSONTyped(json, false); -} - -export function SplitSubaccountsFromJSONTyped(json: any, ignoreDiscriminator: boolean): SplitSubaccounts { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'subaccount': !exists(json, 'subaccount') ? undefined : json['subaccount'], - 'share': !exists(json, 'share') ? undefined : json['share'], - }; -} - -export function SplitSubaccountsToJSON(value?: SplitSubaccounts | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'subaccount': value.subaccount, - 'share': value.share, - }; -} - - diff --git a/src/models/SplitUpdate.ts b/src/models/SplitUpdate.ts deleted file mode 100644 index 5334791..0000000 --- a/src/models/SplitUpdate.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SplitUpdate - */ -export interface SplitUpdate { - /** - * Name of the transaction split - * @type {string} - * @memberof SplitUpdate - */ - name?: string; - /** - * Toggle status of split. When true, the split is active, else it's inactive - * @type {boolean} - * @memberof SplitUpdate - */ - active?: boolean; - /** - * This allows you specify how the transaction charge should be processed - * @type {string} - * @memberof SplitUpdate - */ - bearerType?: string; - /** - * This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type - * @type {string} - * @memberof SplitUpdate - */ - bearerSubaccount?: string; -} - -export function SplitUpdateFromJSON(json: any): SplitUpdate { - return SplitUpdateFromJSONTyped(json, false); -} - -export function SplitUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SplitUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'active': !exists(json, 'active') ? undefined : json['active'], - 'bearerType': !exists(json, 'bearer_type') ? undefined : json['bearer_type'], - 'bearerSubaccount': !exists(json, 'bearer_subaccount') ? undefined : json['bearer_subaccount'], - }; -} - -export function SplitUpdateToJSON(value?: SplitUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'active': value.active, - 'bearer_type': value.bearerType, - 'bearer_subaccount': value.bearerSubaccount, - }; -} - - diff --git a/src/models/SubaccountCreate.ts b/src/models/SubaccountCreate.ts deleted file mode 100644 index b89dd84..0000000 --- a/src/models/SubaccountCreate.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SubaccountCreate - */ -export interface SubaccountCreate { - /** - * Name of business for subaccount - * @type {string} - * @memberof SubaccountCreate - */ - businessName: string; - /** - * Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. - * @type {string} - * @memberof SubaccountCreate - */ - settlementBank: string; - /** - * Bank account number - * @type {string} - * @memberof SubaccountCreate - */ - accountNumber: string; - /** - * Customer's phone number - * @type {number} - * @memberof SubaccountCreate - */ - percentageCharge: number; - /** - * A description for this subaccount - * @type {string} - * @memberof SubaccountCreate - */ - description?: string; - /** - * A contact email for the subaccount - * @type {string} - * @memberof SubaccountCreate - */ - primaryContactEmail?: string; - /** - * The name of the contact person for this subaccount - * @type {string} - * @memberof SubaccountCreate - */ - primaryContactName?: string; - /** - * A phone number to call for this subaccount - * @type {string} - * @memberof SubaccountCreate - */ - primaryContactPhone?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof SubaccountCreate - */ - metadata?: string; -} - -export function SubaccountCreateFromJSON(json: any): SubaccountCreate { - return SubaccountCreateFromJSONTyped(json, false); -} - -export function SubaccountCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubaccountCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'businessName': json['business_name'], - 'settlementBank': json['settlement_bank'], - 'accountNumber': json['account_number'], - 'percentageCharge': json['percentage_charge'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'primaryContactEmail': !exists(json, 'primary_contact_email') ? undefined : json['primary_contact_email'], - 'primaryContactName': !exists(json, 'primary_contact_name') ? undefined : json['primary_contact_name'], - 'primaryContactPhone': !exists(json, 'primary_contact_phone') ? undefined : json['primary_contact_phone'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function SubaccountCreateToJSON(value?: SubaccountCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'business_name': value.businessName, - 'settlement_bank': value.settlementBank, - 'account_number': value.accountNumber, - 'percentage_charge': value.percentageCharge, - 'description': value.description, - 'primary_contact_email': value.primaryContactEmail, - 'primary_contact_name': value.primaryContactName, - 'primary_contact_phone': value.primaryContactPhone, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/SubaccountUpdate.ts b/src/models/SubaccountUpdate.ts deleted file mode 100644 index 0fa8813..0000000 --- a/src/models/SubaccountUpdate.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SubaccountUpdate - */ -export interface SubaccountUpdate { - /** - * Name of business for subaccount - * @type {string} - * @memberof SubaccountUpdate - */ - businessName?: string; - /** - * Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. - * @type {string} - * @memberof SubaccountUpdate - */ - settlementBank?: string; - /** - * Bank account number - * @type {string} - * @memberof SubaccountUpdate - */ - accountNumber?: string; - /** - * Activate or deactivate a subaccount - * @type {boolean} - * @memberof SubaccountUpdate - */ - active?: boolean; - /** - * Customer's phone number - * @type {number} - * @memberof SubaccountUpdate - */ - percentageCharge?: number; - /** - * A description for this subaccount - * @type {string} - * @memberof SubaccountUpdate - */ - description?: string; - /** - * A contact email for the subaccount - * @type {string} - * @memberof SubaccountUpdate - */ - primaryContactEmail?: string; - /** - * The name of the contact person for this subaccount - * @type {string} - * @memberof SubaccountUpdate - */ - primaryContactName?: string; - /** - * A phone number to call for this subaccount - * @type {string} - * @memberof SubaccountUpdate - */ - primaryContactPhone?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof SubaccountUpdate - */ - metadata?: string; -} - -export function SubaccountUpdateFromJSON(json: any): SubaccountUpdate { - return SubaccountUpdateFromJSONTyped(json, false); -} - -export function SubaccountUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubaccountUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'businessName': !exists(json, 'business_name') ? undefined : json['business_name'], - 'settlementBank': !exists(json, 'settlement_bank') ? undefined : json['settlement_bank'], - 'accountNumber': !exists(json, 'account_number') ? undefined : json['account_number'], - 'active': !exists(json, 'active') ? undefined : json['active'], - 'percentageCharge': !exists(json, 'percentage_charge') ? undefined : json['percentage_charge'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'primaryContactEmail': !exists(json, 'primary_contact_email') ? undefined : json['primary_contact_email'], - 'primaryContactName': !exists(json, 'primary_contact_name') ? undefined : json['primary_contact_name'], - 'primaryContactPhone': !exists(json, 'primary_contact_phone') ? undefined : json['primary_contact_phone'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function SubaccountUpdateToJSON(value?: SubaccountUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'business_name': value.businessName, - 'settlement_bank': value.settlementBank, - 'account_number': value.accountNumber, - 'active': value.active, - 'percentage_charge': value.percentageCharge, - 'description': value.description, - 'primary_contact_email': value.primaryContactEmail, - 'primary_contact_name': value.primaryContactName, - 'primary_contact_phone': value.primaryContactPhone, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/SubscriptionCreate.ts b/src/models/SubscriptionCreate.ts deleted file mode 100644 index 8325b8b..0000000 --- a/src/models/SubscriptionCreate.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SubscriptionCreate - */ -export interface SubscriptionCreate { - /** - * Customer's email address or customer code - * @type {string} - * @memberof SubscriptionCreate - */ - customer: string; - /** - * Plan code - * @type {string} - * @memberof SubscriptionCreate - */ - plan: string; - /** - * If customer has multiple authorizations, you can set the desired authorization you wish to use for this subscription here. - * If this is not supplied, the customer's most recent authorization would be used - * @type {string} - * @memberof SubscriptionCreate - */ - authorization?: string; - /** - * Set the date for the first debit. (ISO 8601 format) e.g. 2017-05-16T00:30:13+01:00 - * @type {Date} - * @memberof SubscriptionCreate - */ - startDate?: Date; -} - -export function SubscriptionCreateFromJSON(json: any): SubscriptionCreate { - return SubscriptionCreateFromJSONTyped(json, false); -} - -export function SubscriptionCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscriptionCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'customer': json['customer'], - 'plan': json['plan'], - 'authorization': !exists(json, 'authorization') ? undefined : json['authorization'], - 'startDate': !exists(json, 'start_date') ? undefined : (new Date(json['start_date'])), - }; -} - -export function SubscriptionCreateToJSON(value?: SubscriptionCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'customer': value.customer, - 'plan': value.plan, - 'authorization': value.authorization, - 'start_date': value.startDate === undefined ? undefined : (value.startDate.toISOString()), - }; -} - - diff --git a/src/models/SubscriptionToggle.ts b/src/models/SubscriptionToggle.ts deleted file mode 100644 index 5b7db1d..0000000 --- a/src/models/SubscriptionToggle.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface SubscriptionToggle - */ -export interface SubscriptionToggle { - /** - * Subscription code - * @type {string} - * @memberof SubscriptionToggle - */ - code: string; - /** - * Email token - * @type {string} - * @memberof SubscriptionToggle - */ - token: string; -} - -export function SubscriptionToggleFromJSON(json: any): SubscriptionToggle { - return SubscriptionToggleFromJSONTyped(json, false); -} - -export function SubscriptionToggleFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscriptionToggle { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'code': json['code'], - 'token': json['token'], - }; -} - -export function SubscriptionToggleToJSON(value?: SubscriptionToggle | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'code': value.code, - 'token': value.token, - }; -} - - diff --git a/src/models/TransactionChargeAuthorization.ts b/src/models/TransactionChargeAuthorization.ts deleted file mode 100644 index 06291cb..0000000 --- a/src/models/TransactionChargeAuthorization.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransactionChargeAuthorization - */ -export interface TransactionChargeAuthorization { - /** - * Customer's email address - * @type {string} - * @memberof TransactionChargeAuthorization - */ - email: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof TransactionChargeAuthorization - */ - amount: number; - /** - * Valid authorization code to charge - * @type {string} - * @memberof TransactionChargeAuthorization - */ - authorizationCode: string; - /** - * Unique transaction reference. Only -, ., = and alphanumeric characters allowed. - * @type {string} - * @memberof TransactionChargeAuthorization - */ - reference?: string; - /** - * The transaction currency - * @type {string} - * @memberof TransactionChargeAuthorization - */ - currency?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof TransactionChargeAuthorization - */ - metadata?: string; - /** - * The split code of the transaction split - * @type {string} - * @memberof TransactionChargeAuthorization - */ - splitCode?: string; - /** - * The code for the subaccount that owns the payment - * @type {string} - * @memberof TransactionChargeAuthorization - */ - subaccount?: string; - /** - * A flat fee to charge the subaccount for a transaction. - * This overrides the split percentage set when the subaccount was created - * @type {string} - * @memberof TransactionChargeAuthorization - */ - transactionCharge?: string; - /** - * The beare of the transaction charge - * @type {string} - * @memberof TransactionChargeAuthorization - */ - bearer?: string; - /** - * If you are making a scheduled charge call, it is a good idea to queue them so the processing system does not get overloaded causing transaction processing errors. - * @type {boolean} - * @memberof TransactionChargeAuthorization - */ - queue?: boolean; -} - -export function TransactionChargeAuthorizationFromJSON(json: any): TransactionChargeAuthorization { - return TransactionChargeAuthorizationFromJSONTyped(json, false); -} - -export function TransactionChargeAuthorizationFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionChargeAuthorization { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'amount': json['amount'], - 'authorizationCode': json['authorization_code'], - 'reference': !exists(json, 'reference') ? undefined : json['reference'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - 'subaccount': !exists(json, 'subaccount') ? undefined : json['subaccount'], - 'transactionCharge': !exists(json, 'transaction_charge') ? undefined : json['transaction_charge'], - 'bearer': !exists(json, 'bearer') ? undefined : json['bearer'], - 'queue': !exists(json, 'queue') ? undefined : json['queue'], - }; -} - -export function TransactionChargeAuthorizationToJSON(value?: TransactionChargeAuthorization | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'amount': value.amount, - 'authorization_code': value.authorizationCode, - 'reference': value.reference, - 'currency': value.currency, - 'metadata': value.metadata, - 'split_code': value.splitCode, - 'subaccount': value.subaccount, - 'transaction_charge': value.transactionCharge, - 'bearer': value.bearer, - 'queue': value.queue, - }; -} - - diff --git a/src/models/TransactionCheckAuthorization.ts b/src/models/TransactionCheckAuthorization.ts deleted file mode 100644 index 5b17943..0000000 --- a/src/models/TransactionCheckAuthorization.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransactionCheckAuthorization - */ -export interface TransactionCheckAuthorization { - /** - * Customer's email address - * @type {string} - * @memberof TransactionCheckAuthorization - */ - email: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof TransactionCheckAuthorization - */ - amount: number; - /** - * Valid authorization code to charge - * @type {string} - * @memberof TransactionCheckAuthorization - */ - authorizationCode?: string; - /** - * The transaction currency - * @type {string} - * @memberof TransactionCheckAuthorization - */ - currency?: string; -} - -export function TransactionCheckAuthorizationFromJSON(json: any): TransactionCheckAuthorization { - return TransactionCheckAuthorizationFromJSONTyped(json, false); -} - -export function TransactionCheckAuthorizationFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionCheckAuthorization { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'amount': json['amount'], - 'authorizationCode': !exists(json, 'authorization_code') ? undefined : json['authorization_code'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - }; -} - -export function TransactionCheckAuthorizationToJSON(value?: TransactionCheckAuthorization | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'amount': value.amount, - 'authorization_code': value.authorizationCode, - 'currency': value.currency, - }; -} - - diff --git a/src/models/TransactionInitialize.ts b/src/models/TransactionInitialize.ts deleted file mode 100644 index 16888f0..0000000 --- a/src/models/TransactionInitialize.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransactionInitialize - */ -export interface TransactionInitialize { - /** - * Customer's email address - * @type {string} - * @memberof TransactionInitialize - */ - email: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof TransactionInitialize - */ - amount: number; - /** - * The transaction currency - * @type {string} - * @memberof TransactionInitialize - */ - currency?: string; - /** - * Unique transaction reference. Only -, ., = and alphanumeric characters allowed. - * @type {string} - * @memberof TransactionInitialize - */ - reference?: string; - /** - * Fully qualified url, e.g. https://example.com/ . Use this to override the callback url provided on the dashboard for this transaction - * @type {string} - * @memberof TransactionInitialize - */ - callbackUrl?: string; - /** - * If transaction is to create a subscription to a predefined plan, provide plan code here. - * This would invalidate the value provided in amount - * @type {string} - * @memberof TransactionInitialize - */ - plan?: string; - /** - * Number of times to charge customer during subscription to plan - * @type {number} - * @memberof TransactionInitialize - */ - invoiceLimit?: number; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof TransactionInitialize - */ - metadata?: string; - /** - * An array of payment channels to control what channels you want to make available to the user to make a payment with - * @type {Array} - * @memberof TransactionInitialize - */ - channels?: Array; - /** - * The split code of the transaction split - * @type {string} - * @memberof TransactionInitialize - */ - splitCode?: string; - /** - * The code for the subaccount that owns the payment - * @type {string} - * @memberof TransactionInitialize - */ - subaccount?: string; - /** - * A flat fee to charge the subaccount for a transaction. - * This overrides the split percentage set when the subaccount was created - * @type {string} - * @memberof TransactionInitialize - */ - transactionCharge?: string; - /** - * The beare of the transaction charge - * @type {string} - * @memberof TransactionInitialize - */ - bearer?: string; -} - -export function TransactionInitializeFromJSON(json: any): TransactionInitialize { - return TransactionInitializeFromJSONTyped(json, false); -} - -export function TransactionInitializeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionInitialize { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'amount': json['amount'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'reference': !exists(json, 'reference') ? undefined : json['reference'], - 'callbackUrl': !exists(json, 'callback_url') ? undefined : json['callback_url'], - 'plan': !exists(json, 'plan') ? undefined : json['plan'], - 'invoiceLimit': !exists(json, 'invoice_limit') ? undefined : json['invoice_limit'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - 'channels': !exists(json, 'channels') ? undefined : json['channels'], - 'splitCode': !exists(json, 'split_code') ? undefined : json['split_code'], - 'subaccount': !exists(json, 'subaccount') ? undefined : json['subaccount'], - 'transactionCharge': !exists(json, 'transaction_charge') ? undefined : json['transaction_charge'], - 'bearer': !exists(json, 'bearer') ? undefined : json['bearer'], - }; -} - -export function TransactionInitializeToJSON(value?: TransactionInitialize | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'amount': value.amount, - 'currency': value.currency, - 'reference': value.reference, - 'callback_url': value.callbackUrl, - 'plan': value.plan, - 'invoice_limit': value.invoiceLimit, - 'metadata': value.metadata, - 'channels': value.channels, - 'split_code': value.splitCode, - 'subaccount': value.subaccount, - 'transaction_charge': value.transactionCharge, - 'bearer': value.bearer, - }; -} - - diff --git a/src/models/TransactionPartialDebit.ts b/src/models/TransactionPartialDebit.ts deleted file mode 100644 index cfefd6e..0000000 --- a/src/models/TransactionPartialDebit.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransactionPartialDebit - */ -export interface TransactionPartialDebit { - /** - * Customer's email address - * @type {string} - * @memberof TransactionPartialDebit - */ - email: string; - /** - * Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR - * @type {number} - * @memberof TransactionPartialDebit - */ - amount: number; - /** - * Valid authorization code to charge - * @type {string} - * @memberof TransactionPartialDebit - */ - authorizationCode: string; - /** - * The transaction currency - * @type {string} - * @memberof TransactionPartialDebit - */ - currency: string; - /** - * Unique transaction reference. Only -, ., = and alphanumeric characters allowed. - * @type {string} - * @memberof TransactionPartialDebit - */ - reference?: string; - /** - * Minimum amount to charge - * @type {string} - * @memberof TransactionPartialDebit - */ - atLeast?: string; -} - -export function TransactionPartialDebitFromJSON(json: any): TransactionPartialDebit { - return TransactionPartialDebitFromJSONTyped(json, false); -} - -export function TransactionPartialDebitFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionPartialDebit { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'email': json['email'], - 'amount': json['amount'], - 'authorizationCode': json['authorization_code'], - 'currency': json['currency'], - 'reference': !exists(json, 'reference') ? undefined : json['reference'], - 'atLeast': !exists(json, 'at_least') ? undefined : json['at_least'], - }; -} - -export function TransactionPartialDebitToJSON(value?: TransactionPartialDebit | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'email': value.email, - 'amount': value.amount, - 'authorization_code': value.authorizationCode, - 'currency': value.currency, - 'reference': value.reference, - 'at_least': value.atLeast, - }; -} - - diff --git a/src/models/TransferBulk.ts b/src/models/TransferBulk.ts deleted file mode 100644 index b4813bc..0000000 --- a/src/models/TransferBulk.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -import { - TransferInitiate, - TransferInitiateFromJSON, - TransferInitiateFromJSONTyped, - TransferInitiateToJSON, -} from './'; - -/** - * - * @export - * @interface TransferBulk - */ -export interface TransferBulk { - /** - * Where should we transfer from? Only balance is allowed for now - * @type {string} - * @memberof TransferBulk - */ - source?: string; - /** - * A list of transfer object. Each object should contain amount, recipient, and reference - * @type {Array} - * @memberof TransferBulk - */ - transfers?: Array; -} - -export function TransferBulkFromJSON(json: any): TransferBulk { - return TransferBulkFromJSONTyped(json, false); -} - -export function TransferBulkFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferBulk { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'source': !exists(json, 'source') ? undefined : json['source'], - 'transfers': !exists(json, 'transfers') ? undefined : ((json['transfers'] as Array).map(TransferInitiateFromJSON)), - }; -} - -export function TransferBulkToJSON(value?: TransferBulk | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'source': value.source, - 'transfers': value.transfers === undefined ? undefined : ((value.transfers as Array).map(TransferInitiateToJSON)), - }; -} - - diff --git a/src/models/TransferFinalize.ts b/src/models/TransferFinalize.ts deleted file mode 100644 index b1bebac..0000000 --- a/src/models/TransferFinalize.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferFinalize - */ -export interface TransferFinalize { - /** - * The transfer code you want to finalize - * @type {string} - * @memberof TransferFinalize - */ - transferCode: string; - /** - * OTP sent to business phone to verify transfer - * @type {string} - * @memberof TransferFinalize - */ - otp: string; -} - -export function TransferFinalizeFromJSON(json: any): TransferFinalize { - return TransferFinalizeFromJSONTyped(json, false); -} - -export function TransferFinalizeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferFinalize { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'transferCode': json['transfer_code'], - 'otp': json['otp'], - }; -} - -export function TransferFinalizeToJSON(value?: TransferFinalize | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'transfer_code': value.transferCode, - 'otp': value.otp, - }; -} - - diff --git a/src/models/TransferFinalizeDisableOTP.ts b/src/models/TransferFinalizeDisableOTP.ts deleted file mode 100644 index 930bd87..0000000 --- a/src/models/TransferFinalizeDisableOTP.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferFinalizeDisableOTP - */ -export interface TransferFinalizeDisableOTP { - /** - * OTP sent to business phone to verify disabling OTP requirement - * @type {string} - * @memberof TransferFinalizeDisableOTP - */ - otp: string; -} - -export function TransferFinalizeDisableOTPFromJSON(json: any): TransferFinalizeDisableOTP { - return TransferFinalizeDisableOTPFromJSONTyped(json, false); -} - -export function TransferFinalizeDisableOTPFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferFinalizeDisableOTP { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'otp': json['otp'], - }; -} - -export function TransferFinalizeDisableOTPToJSON(value?: TransferFinalizeDisableOTP | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'otp': value.otp, - }; -} - - diff --git a/src/models/TransferInitiate.ts b/src/models/TransferInitiate.ts deleted file mode 100644 index 0a3f711..0000000 --- a/src/models/TransferInitiate.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferInitiate - */ -export interface TransferInitiate { - /** - * Where should we transfer from? Only balance is allowed for now - * @type {string} - * @memberof TransferInitiate - */ - source: string; - /** - * Amount to transfer in kobo if currency is NGN and pesewas if currency is GHS. - * @type {string} - * @memberof TransferInitiate - */ - amount: string; - /** - * The transfer recipient's code - * @type {string} - * @memberof TransferInitiate - */ - recipient: string; - /** - * The reason or narration for the transfer. - * @type {string} - * @memberof TransferInitiate - */ - reason?: string; - /** - * Specify the currency of the transfer. Defaults to NGN. - * @type {string} - * @memberof TransferInitiate - */ - currency?: string; - /** - * If specified, the field should be a unique identifier (in lowercase) for the object. - * Only -,_ and alphanumeric characters are allowed. - * @type {string} - * @memberof TransferInitiate - */ - reference?: string; -} - -export function TransferInitiateFromJSON(json: any): TransferInitiate { - return TransferInitiateFromJSONTyped(json, false); -} - -export function TransferInitiateFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferInitiate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'source': json['source'], - 'amount': json['amount'], - 'recipient': json['recipient'], - 'reason': !exists(json, 'reason') ? undefined : json['reason'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'reference': !exists(json, 'reference') ? undefined : json['reference'], - }; -} - -export function TransferInitiateToJSON(value?: TransferInitiate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'source': value.source, - 'amount': value.amount, - 'recipient': value.recipient, - 'reason': value.reason, - 'currency': value.currency, - 'reference': value.reference, - }; -} - - diff --git a/src/models/TransferRecipientBulk.ts b/src/models/TransferRecipientBulk.ts deleted file mode 100644 index 6ccceef..0000000 --- a/src/models/TransferRecipientBulk.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -import { - TransferRecipientCreate, - TransferRecipientCreateFromJSON, - TransferRecipientCreateFromJSONTyped, - TransferRecipientCreateToJSON, -} from './'; - -/** - * - * @export - * @interface TransferRecipientBulk - */ -export interface TransferRecipientBulk { - /** - * A list of transfer recipient object. Each object should contain type, name, and bank_code. - * Any Create Transfer Recipient param can also be passed. - * @type {Array} - * @memberof TransferRecipientBulk - */ - batch: Array; -} - -export function TransferRecipientBulkFromJSON(json: any): TransferRecipientBulk { - return TransferRecipientBulkFromJSONTyped(json, false); -} - -export function TransferRecipientBulkFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferRecipientBulk { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'batch': ((json['batch'] as Array).map(TransferRecipientCreateFromJSON)), - }; -} - -export function TransferRecipientBulkToJSON(value?: TransferRecipientBulk | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'batch': ((value.batch as Array).map(TransferRecipientCreateToJSON)), - }; -} - - diff --git a/src/models/TransferRecipientCreate.ts b/src/models/TransferRecipientCreate.ts deleted file mode 100644 index 0cdafea..0000000 --- a/src/models/TransferRecipientCreate.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferRecipientCreate - */ -export interface TransferRecipientCreate { - /** - * Recipient Type (Only nuban at this time) - * @type {string} - * @memberof TransferRecipientCreate - */ - type: string; - /** - * Recipient's name - * @type {string} - * @memberof TransferRecipientCreate - */ - name: string; - /** - * Recipient's bank account number - * @type {string} - * @memberof TransferRecipientCreate - */ - accountNumber: string; - /** - * Recipient's bank code. You can get the list of Bank Codes by calling the List Banks endpoint - * @type {string} - * @memberof TransferRecipientCreate - */ - bankCode: string; - /** - * A description for this recipient - * @type {string} - * @memberof TransferRecipientCreate - */ - description?: string; - /** - * Currency for the account receiving the transfer - * @type {string} - * @memberof TransferRecipientCreate - */ - currency?: string; - /** - * An authorization code from a previous transaction - * @type {string} - * @memberof TransferRecipientCreate - */ - authorizationCode?: string; - /** - * Stringified JSON object of custom data - * @type {string} - * @memberof TransferRecipientCreate - */ - metadata?: string; -} - -export function TransferRecipientCreateFromJSON(json: any): TransferRecipientCreate { - return TransferRecipientCreateFromJSONTyped(json, false); -} - -export function TransferRecipientCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferRecipientCreate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'type': json['type'], - 'name': json['name'], - 'accountNumber': json['account_number'], - 'bankCode': json['bank_code'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'currency': !exists(json, 'currency') ? undefined : json['currency'], - 'authorizationCode': !exists(json, 'authorization_code') ? undefined : json['authorization_code'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function TransferRecipientCreateToJSON(value?: TransferRecipientCreate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'type': value.type, - 'name': value.name, - 'account_number': value.accountNumber, - 'bank_code': value.bankCode, - 'description': value.description, - 'currency': value.currency, - 'authorization_code': value.authorizationCode, - 'metadata': value.metadata, - }; -} - - diff --git a/src/models/TransferRecipientUpdate.ts b/src/models/TransferRecipientUpdate.ts deleted file mode 100644 index 714e87a..0000000 --- a/src/models/TransferRecipientUpdate.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferRecipientUpdate - */ -export interface TransferRecipientUpdate { - /** - * Recipient's name - * @type {string} - * @memberof TransferRecipientUpdate - */ - name?: string; - /** - * Recipient's email address - * @type {string} - * @memberof TransferRecipientUpdate - */ - email?: string; -} - -export function TransferRecipientUpdateFromJSON(json: any): TransferRecipientUpdate { - return TransferRecipientUpdateFromJSONTyped(json, false); -} - -export function TransferRecipientUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferRecipientUpdate { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'email': !exists(json, 'email') ? undefined : json['email'], - }; -} - -export function TransferRecipientUpdateToJSON(value?: TransferRecipientUpdate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'email': value.email, - }; -} - - diff --git a/src/models/TransferResendOTP.ts b/src/models/TransferResendOTP.ts deleted file mode 100644 index 4709434..0000000 --- a/src/models/TransferResendOTP.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface TransferResendOTP - */ -export interface TransferResendOTP { - /** - * The transfer code that requires an OTP validation - * @type {string} - * @memberof TransferResendOTP - */ - transferCode: string; - /** - * Either resend_otp or transfer - * @type {string} - * @memberof TransferResendOTP - */ - reason: string; -} - -export function TransferResendOTPFromJSON(json: any): TransferResendOTP { - return TransferResendOTPFromJSONTyped(json, false); -} - -export function TransferResendOTPFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransferResendOTP { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'transferCode': json['transfer_code'], - 'reason': json['reason'], - }; -} - -export function TransferResendOTPToJSON(value?: TransferResendOTP | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'transfer_code': value.transferCode, - 'reason': value.reason, - }; -} - - diff --git a/src/models/USSD.ts b/src/models/USSD.ts deleted file mode 100644 index bd5b29e..0000000 --- a/src/models/USSD.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface USSD - */ -export interface USSD { - /** - * The three-digit USSD code. One of, 737, 919, 822, 966 - * @type {string} - * @memberof USSD - */ - type?: string; -} - -export function USSDFromJSON(json: any): USSD { - return USSDFromJSONTyped(json, false); -} - -export function USSDFromJSONTyped(json: any, ignoreDiscriminator: boolean): USSD { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'type': !exists(json, 'type') ? undefined : json['type'], - }; -} - -export function USSDToJSON(value?: USSD | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'type': value.type, - }; -} - - diff --git a/src/models/VerificationBVNMatch.ts b/src/models/VerificationBVNMatch.ts deleted file mode 100644 index 11c1d4c..0000000 --- a/src/models/VerificationBVNMatch.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface VerificationBVNMatch - */ -export interface VerificationBVNMatch { - /** - * Bank Account Number - * @type {string} - * @memberof VerificationBVNMatch - */ - accountNumber: string; - /** - * You can get the list of banks codes by calling the List Bank endpoint - * @type {number} - * @memberof VerificationBVNMatch - */ - bankCode: number; - /** - * 11 digits Bank Verification Number - * @type {string} - * @memberof VerificationBVNMatch - */ - bvn: string; - /** - * Customer's first name - * @type {string} - * @memberof VerificationBVNMatch - */ - firstName?: string; - /** - * Customer's middle name - * @type {string} - * @memberof VerificationBVNMatch - */ - middleName?: string; - /** - * Customer's last name - * @type {string} - * @memberof VerificationBVNMatch - */ - lastName?: string; -} - -export function VerificationBVNMatchFromJSON(json: any): VerificationBVNMatch { - return VerificationBVNMatchFromJSONTyped(json, false); -} - -export function VerificationBVNMatchFromJSONTyped(json: any, ignoreDiscriminator: boolean): VerificationBVNMatch { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'accountNumber': json['account_number'], - 'bankCode': json['bank_code'], - 'bvn': json['bvn'], - 'firstName': !exists(json, 'first_name') ? undefined : json['first_name'], - 'middleName': !exists(json, 'middle_name') ? undefined : json['middle_name'], - 'lastName': !exists(json, 'last_name') ? undefined : json['last_name'], - }; -} - -export function VerificationBVNMatchToJSON(value?: VerificationBVNMatch | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'account_number': value.accountNumber, - 'bank_code': value.bankCode, - 'bvn': value.bvn, - 'first_name': value.firstName, - 'middle_name': value.middleName, - 'last_name': value.lastName, - }; -} - - diff --git a/src/models/apple-pay-list-domain-data.ts b/src/models/apple-pay-list-domain-data.ts new file mode 100644 index 0000000..c73a6ad --- /dev/null +++ b/src/models/apple-pay-list-domain-data.ts @@ -0,0 +1,2 @@ +export interface ApplePayListDomainData { +} diff --git a/src/models/apple-pay-list-domain-query.ts b/src/models/apple-pay-list-domain-query.ts new file mode 100644 index 0000000..f744ab9 --- /dev/null +++ b/src/models/apple-pay-list-domain-query.ts @@ -0,0 +1,10 @@ +export interface ApplePayListDomainQuery { + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data + */ + previous?: string; +} diff --git a/src/models/apple-pay-register-domain-body.ts b/src/models/apple-pay-register-domain-body.ts new file mode 100644 index 0000000..6bbf36c --- /dev/null +++ b/src/models/apple-pay-register-domain-body.ts @@ -0,0 +1,4 @@ +export interface ApplePayRegisterDomainBody { + /** The domain or subdomain for your application */ + domainName: string; +} diff --git a/src/models/apple-pay-unregister-domain-body.ts b/src/models/apple-pay-unregister-domain-body.ts new file mode 100644 index 0000000..1218eda --- /dev/null +++ b/src/models/apple-pay-unregister-domain-body.ts @@ -0,0 +1,4 @@ +export interface ApplePayUnregisterDomainBody { + /** The domain or subdomain for your application */ + domainName: string; +} diff --git a/src/models/apple-pay-unregister-domain-data.ts b/src/models/apple-pay-unregister-domain-data.ts new file mode 100644 index 0000000..cddb668 --- /dev/null +++ b/src/models/apple-pay-unregister-domain-data.ts @@ -0,0 +1,2 @@ +export interface ApplePayUnregisterDomainData { +} diff --git a/src/models/balance-fetch-data.ts b/src/models/balance-fetch-data.ts new file mode 100644 index 0000000..4f0a2f9 --- /dev/null +++ b/src/models/balance-fetch-data.ts @@ -0,0 +1,2 @@ +export interface BalanceFetchData { +} diff --git a/src/models/balance-ledger-data.ts b/src/models/balance-ledger-data.ts new file mode 100644 index 0000000..c1fb497 --- /dev/null +++ b/src/models/balance-ledger-data.ts @@ -0,0 +1,2 @@ +export interface BalanceLedgerData { +} diff --git a/src/models/balance-ledger-query.ts b/src/models/balance-ledger-query.ts new file mode 100644 index 0000000..6691f66 --- /dev/null +++ b/src/models/balance-ledger-query.ts @@ -0,0 +1,10 @@ +export interface BalanceLedgerQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/bank-list-data.ts b/src/models/bank-list-data.ts new file mode 100644 index 0000000..de2b09b --- /dev/null +++ b/src/models/bank-list-data.ts @@ -0,0 +1,2 @@ +export interface BankListData { +} diff --git a/src/models/bank-list-query.ts b/src/models/bank-list-query.ts new file mode 100644 index 0000000..0412d1c --- /dev/null +++ b/src/models/bank-list-query.ts @@ -0,0 +1,36 @@ +export interface BankListQuery { + /** The country from which to obtain the list of supported banks */ + country?: "ghana" | "kenya" | "nigeria" | "south africa"; + /** The country from which to obtain the list of supported banks */ + currency?: "GHS" | "KES" | "NGN" | "ZAR"; + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** The number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; + /** An alphanumeric value returned for every cursor based retrieval, used to +retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to +retrieve the previous set of data + */ + previous?: string; + /** A flag to filter for available banks a customer can make a transfer to complete a payment */ + pay_with_bank_transfer?: boolean; + /** A flag to filter for banks a customer can pay directly from */ + pay_with_bank?: boolean; + /** A flag to filter the banks that are supported for account verification in South Africa. +You need to combine this with either the `currency` or `country` filter. + */ + enabled_for_verification?: boolean; + /** The type of gateway for a Nigerian bank */ + gateway?: "emandate" | "digitalbankmandate"; + /** Type of financial channel */ + type?: "ghipps" | "mobile_money" | "nuban" | "kepss" | "basa"; + /** A flag that returns Nigerian banks with their NIP institution code. +The returned value can be used in identifying institutions on NIP. + */ + include_nip_sort_code?: boolean; +} diff --git a/src/models/bank-resolve-account-number-data.ts b/src/models/bank-resolve-account-number-data.ts new file mode 100644 index 0000000..42d20a0 --- /dev/null +++ b/src/models/bank-resolve-account-number-data.ts @@ -0,0 +1,8 @@ +export interface BankResolveAccountNumberData { + /** */ + account_number: string; + /** */ + account_name: string; + /** */ + bank_id: number; +} diff --git a/src/models/bank-resolve-account-number-query.ts b/src/models/bank-resolve-account-number-query.ts new file mode 100644 index 0000000..91676ef --- /dev/null +++ b/src/models/bank-resolve-account-number-query.ts @@ -0,0 +1,6 @@ +export interface BankResolveAccountNumberQuery { + /** The account number of interest */ + account_number?: number; + /** The bank code associated with the account number */ + bank_code?: number; +} diff --git a/src/models/bank-validate-account-number-body.ts b/src/models/bank-validate-account-number-body.ts new file mode 100644 index 0000000..bdc95ba --- /dev/null +++ b/src/models/bank-validate-account-number-body.ts @@ -0,0 +1,16 @@ +export interface BankValidateAccountNumberBody { + /** Customer's first and last name registered with their bank */ + account_name: string; + /** Customer's account number */ + account_number: string; + /** The type of the customer's account number */ + account_type: "personal" | "business"; + /** The bank code of the customer’s bank. You can fetch the bank codes by using our List Banks endpoint */ + bank_code: string; + /** The two digit ISO code of the customer’s bank */ + country_code: string; + /** Customer’s mode of identity */ + document_type: "identityNumber" | "passportNumber" | "businessRegistrationNumber"; + /** Customer’s mode of identity number */ + document_number?: string; +} diff --git a/src/models/bank-validate-account-number-data.ts b/src/models/bank-validate-account-number-data.ts new file mode 100644 index 0000000..1fcb2ee --- /dev/null +++ b/src/models/bank-validate-account-number-data.ts @@ -0,0 +1,16 @@ +export interface BankValidateAccountNumberData { + /** */ + verified: boolean; + /** */ + verificationMessage: string; + /** */ + accountAcceptsDebits: boolean; + /** */ + accountAcceptsCredits: boolean; + /** */ + accountOpenForMoreThanThreeMonths: boolean; + /** */ + accountHolderMatch: boolean; + /** */ + accountOpen: boolean; +} diff --git a/src/models/bulk-charge-charges-data.ts b/src/models/bulk-charge-charges-data.ts new file mode 100644 index 0000000..62e01b6 --- /dev/null +++ b/src/models/bulk-charge-charges-data.ts @@ -0,0 +1,2 @@ +export interface BulkChargeChargesData { +} diff --git a/src/models/bulk-charge-charges-query.ts b/src/models/bulk-charge-charges-query.ts new file mode 100644 index 0000000..cd12a13 --- /dev/null +++ b/src/models/bulk-charge-charges-query.ts @@ -0,0 +1,8 @@ +export interface BulkChargeChargesQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; + /** Filter by the status of the charges */ + status?: "success" | "failed" | "pending" | "error" | "inactive_authorization"; +} diff --git a/src/models/bulk-charge-fetch-data.ts b/src/models/bulk-charge-fetch-data.ts new file mode 100644 index 0000000..35b2a7d --- /dev/null +++ b/src/models/bulk-charge-fetch-data.ts @@ -0,0 +1,22 @@ +export interface BulkChargeFetchData { + /** */ + batch_code: string; + /** */ + reference: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + total_charges: number; + /** */ + pending_charges: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/bulk-charge-initiate-body.ts b/src/models/bulk-charge-initiate-body.ts new file mode 100644 index 0000000..1ce118c --- /dev/null +++ b/src/models/bulk-charge-initiate-body.ts @@ -0,0 +1,4 @@ +export interface BulkChargeInitiateBody { + /** */ + body: Array<{ authorization: string; amount: number; reference?: string; attempt_partial_debit?: boolean; at_least?: number; metadata?: Record }>; +} diff --git a/src/models/bulk-charge-initiate-data.ts b/src/models/bulk-charge-initiate-data.ts new file mode 100644 index 0000000..b48e519 --- /dev/null +++ b/src/models/bulk-charge-initiate-data.ts @@ -0,0 +1,22 @@ +export interface BulkChargeInitiateData { + /** */ + batch_code: string; + /** */ + reference: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + total_charges: number; + /** */ + pending_charges: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/bulk-charge-list-data.ts b/src/models/bulk-charge-list-data.ts new file mode 100644 index 0000000..a2e40dd --- /dev/null +++ b/src/models/bulk-charge-list-data.ts @@ -0,0 +1,2 @@ +export interface BulkChargeListData { +} diff --git a/src/models/bulk-charge-list-query.ts b/src/models/bulk-charge-list-query.ts new file mode 100644 index 0000000..7a3641e --- /dev/null +++ b/src/models/bulk-charge-list-query.ts @@ -0,0 +1,8 @@ +export interface BulkChargeListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; + /** Filter by the status of the charges */ + status?: "active" | "paused" | "complete"; +} diff --git a/src/models/charge-check-data.ts b/src/models/charge-check-data.ts new file mode 100644 index 0000000..f6c8de5 --- /dev/null +++ b/src/models/charge-check-data.ts @@ -0,0 +1,30 @@ +export interface ChargeCheckData { + /** */ + status: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + redirect_url: string; + /** */ + metadata: Record; + /** */ + gateway_response: string; + /** */ + message: string; + /** */ + channel: string; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string }; + /** */ + customer: { first_name: string; last_name: string; email: string; customer_code: string; phone: string; risk_action: string }; +} diff --git a/src/models/charge-create-body.ts b/src/models/charge-create-body.ts new file mode 100644 index 0000000..6a32aad --- /dev/null +++ b/src/models/charge-create-body.ts @@ -0,0 +1,27 @@ +export interface ChargeCreateBody { + /** Customer's email address */ + email: string; + /** Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR */ + amount: number; + /** An authorization code to charge. */ + authorization_code?: string; + /** 4-digit PIN (send with a non-reusable authorization code) */ + pin?: string; + /** Unique transaction reference. Only -, .`, = and alphanumeric characters allowed. */ + reference?: string; + /** The customer's birthday in the format YYYY-MM-DD e.g 2017-05-16 */ + birthday?: string; + /** This is the unique identifier of the device a user uses in making payment. +Only -, .`, = and alphanumeric characters are allowed. */ + device_id?: string; + /** JSON object of custom data */ + metadata?: Record; + /** The bank object if charging a bank account */ + bank?: { code?: string; account_number?: string }; + /** Details of the mobile service provider */ + mobile_money?: { phone?: string; provider?: string }; + /** The USSD code for the provider to charge */ + ussd?: { type?: "737" | "919" | "822" | "966" }; + /** Details of the EFT provider */ + eft?: { provider?: string }; +} diff --git a/src/models/charge-create-data.ts b/src/models/charge-create-data.ts new file mode 100644 index 0000000..5fe1c17 --- /dev/null +++ b/src/models/charge-create-data.ts @@ -0,0 +1,66 @@ +export interface ChargeCreateData { + /** */ + id: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + reference: string; + /** */ + receipt_number: unknown; + /** */ + amount: number; + /** */ + message: string; + /** */ + gateway_response: string; + /** */ + paid_at: string; + /** */ + created_at: string; + /** */ + channel: string; + /** */ + currency: string; + /** */ + ip_address: string; + /** */ + metadata: { custom_fields: Array<{ value: string; display_name: string; variable_name: string }> }; + /** */ + log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; + /** */ + fees: number; + /** */ + fees_split: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string; account_name: unknown; receiver_bank_account_number: unknown; receiver_bank: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + plan: unknown; + /** */ + split: Record; + /** */ + order_id: unknown; + /** */ + paidAt: string; + /** */ + createdAt: string; + /** */ + requested_amount: number; + /** */ + pos_transaction_data: unknown; + /** */ + source: unknown; + /** */ + fees_breakdown: unknown; + /** */ + connect: unknown; + /** */ + transaction_date: string; + /** */ + plan_object: Record; + /** */ + subaccount: Record; +} diff --git a/src/models/charge-submit-address-body.ts b/src/models/charge-submit-address-body.ts new file mode 100644 index 0000000..9f2589d --- /dev/null +++ b/src/models/charge-submit-address-body.ts @@ -0,0 +1,12 @@ +export interface ChargeSubmitAddressBody { + /** Customer's address */ + address: string; + /** Customer's city */ + city: string; + /** Customer's state */ + state: string; + /** Customer's zipcode */ + zip_code: string; + /** The reference of the ongoing transaction */ + reference: string; +} diff --git a/src/models/charge-submit-address-data.ts b/src/models/charge-submit-address-data.ts new file mode 100644 index 0000000..cf11d49 --- /dev/null +++ b/src/models/charge-submit-address-data.ts @@ -0,0 +1,2 @@ +export interface ChargeSubmitAddressData { +} diff --git a/src/models/charge-submit-birthday-body.ts b/src/models/charge-submit-birthday-body.ts new file mode 100644 index 0000000..3f17c94 --- /dev/null +++ b/src/models/charge-submit-birthday-body.ts @@ -0,0 +1,6 @@ +export interface ChargeSubmitBirthdayBody { + /** Customer's birthday in the format YYYY-MM-DD e.g 2016-09-21 */ + birthday: string; + /** The reference of the ongoing transaction */ + reference: string; +} diff --git a/src/models/charge-submit-birthday-data.ts b/src/models/charge-submit-birthday-data.ts new file mode 100644 index 0000000..6c9e89f --- /dev/null +++ b/src/models/charge-submit-birthday-data.ts @@ -0,0 +1,6 @@ +export interface ChargeSubmitBirthdayData { + /** */ + status: string; + /** */ + display_text: string; +} diff --git a/src/models/charge-submit-otp-body.ts b/src/models/charge-submit-otp-body.ts new file mode 100644 index 0000000..d8cb172 --- /dev/null +++ b/src/models/charge-submit-otp-body.ts @@ -0,0 +1,6 @@ +export interface ChargeSubmitOtpBody { + /** Customer's OTP for ongoing transaction */ + otp: string; + /** The reference of the ongoing transaction */ + reference: string; +} diff --git a/src/models/charge-submit-otp-data.ts b/src/models/charge-submit-otp-data.ts new file mode 100644 index 0000000..5c948d0 --- /dev/null +++ b/src/models/charge-submit-otp-data.ts @@ -0,0 +1,30 @@ +export interface ChargeSubmitOtpData { + /** */ + status: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + redirect_url: string; + /** */ + metadata: Record; + /** */ + gateway_response: string; + /** */ + message: string; + /** */ + channel: string; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string }; + /** */ + customer: { first_name: string; last_name: string; email: string; customer_code: string; phone: string; risk_action: string }; +} diff --git a/src/models/charge-submit-phone-body.ts b/src/models/charge-submit-phone-body.ts new file mode 100644 index 0000000..d0f2e8c --- /dev/null +++ b/src/models/charge-submit-phone-body.ts @@ -0,0 +1,6 @@ +export interface ChargeSubmitPhoneBody { + /** Customer's mobile number */ + phone: string; + /** The reference of the ongoing transaction */ + reference: string; +} diff --git a/src/models/charge-submit-phone-data.ts b/src/models/charge-submit-phone-data.ts new file mode 100644 index 0000000..1956a93 --- /dev/null +++ b/src/models/charge-submit-phone-data.ts @@ -0,0 +1,32 @@ +export interface ChargeSubmitPhoneData { + /** */ + status: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + redirect_url: string; + /** */ + metadata: Record; + /** */ + gateway_response: string; + /** */ + message: string; + /** */ + channel: string; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string }; + /** */ + customer: { first_name: string; last_name: string; email: string; customer_code: string; phone: string; risk_action: string }; + /** */ + display_text: string; +} diff --git a/src/models/charge-submit-pin-body.ts b/src/models/charge-submit-pin-body.ts new file mode 100644 index 0000000..ac66bfc --- /dev/null +++ b/src/models/charge-submit-pin-body.ts @@ -0,0 +1,6 @@ +export interface ChargeSubmitPinBody { + /** Customer's PIN for the ongoing transaction */ + pin: string; + /** Transaction reference that requires the PIN */ + reference: string; +} diff --git a/src/models/charge-submit-pin-data.ts b/src/models/charge-submit-pin-data.ts new file mode 100644 index 0000000..99372e7 --- /dev/null +++ b/src/models/charge-submit-pin-data.ts @@ -0,0 +1,30 @@ +export interface ChargeSubmitPinData { + /** */ + status: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + redirect_url: string; + /** */ + metadata: Record; + /** */ + gateway_response: string; + /** */ + message: string; + /** */ + channel: string; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string }; + /** */ + customer: { first_name: string; last_name: string; email: string; customer_code: string; phone: string; risk_action: string }; +} diff --git a/src/models/customer-create-body.ts b/src/models/customer-create-body.ts new file mode 100644 index 0000000..021a194 --- /dev/null +++ b/src/models/customer-create-body.ts @@ -0,0 +1,12 @@ +export interface CustomerCreateBody { + /** Customer's email address */ + email: string; + /** Customer's first name */ + first_name?: string; + /** Customer's last name */ + last_name?: string; + /** Customer's phone number */ + phone?: string; + /** Stringified JSON object of custom data */ + metadata?: string; +} diff --git a/src/models/customer-create-data.ts b/src/models/customer-create-data.ts new file mode 100644 index 0000000..4c3fab4 --- /dev/null +++ b/src/models/customer-create-data.ts @@ -0,0 +1,36 @@ +export interface CustomerCreateData { + /** */ + transactions: Array; + /** */ + subscriptions: Array; + /** */ + authorizations: Array; + /** */ + email: string; + /** */ + first_name: string; + /** */ + last_name: string; + /** */ + phone: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + metadata: { calling_code?: string }; + /** */ + customer_code: string; + /** */ + risk_action: string; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + identified: boolean; + /** */ + identifications: unknown; +} diff --git a/src/models/customer-deactivate-authorization-body.ts b/src/models/customer-deactivate-authorization-body.ts new file mode 100644 index 0000000..1bf701e --- /dev/null +++ b/src/models/customer-deactivate-authorization-body.ts @@ -0,0 +1,4 @@ +export interface CustomerDeactivateAuthorizationBody { + /** Authorization code to be deactivated */ + authorization_code: string; +} diff --git a/src/models/customer-direct-debit-activation-charge-body.ts b/src/models/customer-direct-debit-activation-charge-body.ts new file mode 100644 index 0000000..ca65530 --- /dev/null +++ b/src/models/customer-direct-debit-activation-charge-body.ts @@ -0,0 +1,4 @@ +export interface CustomerDirectDebitActivationChargeBody { + /** The authorization ID gotten from the initiation response */ + authorization_id: number; +} diff --git a/src/models/customer-fetch-data.ts b/src/models/customer-fetch-data.ts new file mode 100644 index 0000000..33b35e0 --- /dev/null +++ b/src/models/customer-fetch-data.ts @@ -0,0 +1,48 @@ +export interface CustomerFetchData { + /** */ + transactions: Array; + /** */ + subscriptions: Array; + /** */ + authorizations: Array; + /** */ + first_name: string; + /** */ + last_name: string; + /** */ + email: string; + /** */ + phone: string; + /** */ + metadata: { calling_code?: string }; + /** */ + domain: string; + /** */ + customer_code: string; + /** */ + risk_action: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + created_at: string; + /** */ + updated_at: string; + /** */ + total_transactions: number; + /** */ + total_transaction_value: Array; + /** */ + dedicated_account: unknown; + /** */ + dedicated_accounts: Array; + /** */ + identified: boolean; + /** */ + identifications: unknown; +} diff --git a/src/models/customer-fetch-mandate-authorizations-data.ts b/src/models/customer-fetch-mandate-authorizations-data.ts new file mode 100644 index 0000000..54769de --- /dev/null +++ b/src/models/customer-fetch-mandate-authorizations-data.ts @@ -0,0 +1,2 @@ +export interface CustomerFetchMandateAuthorizationsData { +} diff --git a/src/models/customer-initialize-authorization-body.ts b/src/models/customer-initialize-authorization-body.ts new file mode 100644 index 0000000..9ee0e22 --- /dev/null +++ b/src/models/customer-initialize-authorization-body.ts @@ -0,0 +1,12 @@ +export interface CustomerInitializeAuthorizationBody { + /** Customer's email address */ + email: string; + /** direct_debit is the only supported option for now */ + channel: "direct_debit"; + /** Fully qualified url (e.g. https://example.com/) to redirect your customer to */ + callback_url?: string; + /** */ + account?: { number: string; bank_code: string }; + /** */ + address?: { street: string; city: string; state: string }; +} diff --git a/src/models/customer-initialize-authorization-data.ts b/src/models/customer-initialize-authorization-data.ts new file mode 100644 index 0000000..4ceab7a --- /dev/null +++ b/src/models/customer-initialize-authorization-data.ts @@ -0,0 +1,8 @@ +export interface CustomerInitializeAuthorizationData { + /** */ + redirect_url: string; + /** */ + access_code: string; + /** */ + reference: string; +} diff --git a/src/models/customer-initialize-direct-debit-body.ts b/src/models/customer-initialize-direct-debit-body.ts new file mode 100644 index 0000000..ed41b21 --- /dev/null +++ b/src/models/customer-initialize-direct-debit-body.ts @@ -0,0 +1,6 @@ +export interface CustomerInitializeDirectDebitBody { + /** */ + account: { number: string; bank_code: string }; + /** */ + address: { street: string; city: string; state: string }; +} diff --git a/src/models/customer-initialize-direct-debit-data.ts b/src/models/customer-initialize-direct-debit-data.ts new file mode 100644 index 0000000..191d68a --- /dev/null +++ b/src/models/customer-initialize-direct-debit-data.ts @@ -0,0 +1,8 @@ +export interface CustomerInitializeDirectDebitData { + /** */ + redirect_url: string; + /** */ + access_code: string; + /** */ + reference: string; +} diff --git a/src/models/customer-list-data.ts b/src/models/customer-list-data.ts new file mode 100644 index 0000000..080e8ec --- /dev/null +++ b/src/models/customer-list-data.ts @@ -0,0 +1,2 @@ +export interface CustomerListData { +} diff --git a/src/models/customer-list-query.ts b/src/models/customer-list-query.ts new file mode 100644 index 0000000..9717e64 --- /dev/null +++ b/src/models/customer-list-query.ts @@ -0,0 +1,18 @@ +export interface CustomerListQuery { + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data + */ + previous?: string; + /** The start date */ + from?: string; + /** The end date */ + to?: string; + /** The number of records to fetch per request */ + perPage?: string; + /** The offset to retrieve data from */ + page?: string; +} diff --git a/src/models/customer-risk-action-body.ts b/src/models/customer-risk-action-body.ts new file mode 100644 index 0000000..9f65c2f --- /dev/null +++ b/src/models/customer-risk-action-body.ts @@ -0,0 +1,6 @@ +export interface CustomerRiskActionBody { + /** The customer code from the response of the customer creation */ + customer: string; + /** This determines the fraud rules that should be applied to the customer */ + risk_action?: "allow" | "deny" | "default"; +} diff --git a/src/models/customer-risk-action-data.ts b/src/models/customer-risk-action-data.ts new file mode 100644 index 0000000..19a260e --- /dev/null +++ b/src/models/customer-risk-action-data.ts @@ -0,0 +1,36 @@ +export interface CustomerRiskActionData { + /** */ + transactions: Array; + /** */ + subscriptions: Array; + /** */ + authorizations: Array; + /** */ + first_name: string; + /** */ + last_name: string; + /** */ + email: string; + /** */ + phone: string; + /** */ + metadata: Record; + /** */ + domain: string; + /** */ + customer_code: string; + /** */ + risk_action: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + identified: boolean; + /** */ + identifications: unknown; +} diff --git a/src/models/customer-update-body.ts b/src/models/customer-update-body.ts new file mode 100644 index 0000000..c58a104 --- /dev/null +++ b/src/models/customer-update-body.ts @@ -0,0 +1,10 @@ +export interface CustomerUpdateBody { + /** Customer's first name */ + first_name?: string; + /** Customer's last name */ + last_name?: string; + /** Customer's phone number */ + phone?: string; + /** Stringified JSON object of custom data */ + metadata?: string; +} diff --git a/src/models/customer-update-data.ts b/src/models/customer-update-data.ts new file mode 100644 index 0000000..4ce2d00 --- /dev/null +++ b/src/models/customer-update-data.ts @@ -0,0 +1,30 @@ +export interface CustomerUpdateData { + /** */ + first_name: string; + /** */ + last_name: string; + /** */ + email: string; + /** */ + phone: string; + /** */ + metadata: Record; + /** */ + domain: string; + /** */ + customer_code: string; + /** */ + risk_action: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + identified: boolean; + /** */ + identifications: unknown; +} diff --git a/src/models/customer-validate-body.ts b/src/models/customer-validate-body.ts new file mode 100644 index 0000000..9428490 --- /dev/null +++ b/src/models/customer-validate-body.ts @@ -0,0 +1,20 @@ +export interface CustomerValidateBody { + /** Customer's first name */ + first_name: string; + /** Customer's middle name */ + middle_name?: string; + /** Customer's last name */ + last_name: string; + /** Predefined types of identification. */ + type: string; + /** Customer's identification number. */ + value?: string; + /** Two-letter country code of identification issuer */ + country: string; + /** Customer's Bank Verification Number */ + bvn: string; + /** You can get the list of bank codes by calling the List Banks endpoint (https://api.paystack.co/bank). */ + bank_code: string; + /** Customer's bank account number. */ + account_number: string; +} diff --git a/src/models/customer-verify-authorization-data.ts b/src/models/customer-verify-authorization-data.ts new file mode 100644 index 0000000..22135e9 --- /dev/null +++ b/src/models/customer-verify-authorization-data.ts @@ -0,0 +1,12 @@ +export interface CustomerVerifyAuthorizationData { + /** */ + authorization_code: string; + /** */ + channel: string; + /** */ + bank: string; + /** */ + active: boolean; + /** */ + customer: { code: string; email: string }; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-add-split-body.ts b/src/models/dedicated-virtual-account-dedicated-account-add-split-body.ts new file mode 100644 index 0000000..d58f3ab --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-add-split-body.ts @@ -0,0 +1,8 @@ +export interface DedicatedVirtualAccountDedicatedAccountAddSplitBody { + /** Valid Dedicated virtual account */ + account_number: string; + /** Subaccount code of the account you want to split the transaction with */ + subaccount?: string; + /** Split code consisting of the lists of accounts you want to split the transaction with */ + split_code?: string; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-add-split-data.ts b/src/models/dedicated-virtual-account-dedicated-account-add-split-data.ts new file mode 100644 index 0000000..7273cdc --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-add-split-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountAddSplitData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-assign-body.ts b/src/models/dedicated-virtual-account-dedicated-account-assign-body.ts new file mode 100644 index 0000000..1c817c0 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-assign-body.ts @@ -0,0 +1,26 @@ +export interface DedicatedVirtualAccountDedicatedAccountAssignBody { + /** Customer's email address */ + email: string; + /** Customer's first name */ + first_name: string; + /** Customer's last name */ + last_name: string; + /** Customer's phone name */ + phone: string; + /** The bank slug for preferred bank. To get a list of available banks, +use the List Banks endpoint, passing `pay_with_bank_transfer=true` query parameter + */ + preferred_bank: string; + /** The two letter code country */ + country: "NG" | "GH"; + /** Customer's account number */ + account_number?: string; + /** Customer's Bank Verification Number */ + bvn?: string; + /** Customer's bank code */ + bank_code?: string; + /** Subaccount code of the account you want to split the transaction with */ + subaccount?: string; + /** Split code consisting of the lists of accounts you want to split the transaction with */ + split_code?: string; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-assign-data.ts b/src/models/dedicated-virtual-account-dedicated-account-assign-data.ts new file mode 100644 index 0000000..8155afb --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-assign-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountAssignData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-available-providers-data.ts b/src/models/dedicated-virtual-account-dedicated-account-available-providers-data.ts new file mode 100644 index 0000000..cef4238 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-available-providers-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountAvailableProvidersData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-create-body.ts b/src/models/dedicated-virtual-account-dedicated-account-create-body.ts new file mode 100644 index 0000000..5af714e --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-create-body.ts @@ -0,0 +1,10 @@ +export interface DedicatedVirtualAccountDedicatedAccountCreateBody { + /** The code for the previously created customer */ + customer: string; + /** The bank slug for preferred bank. To get a list of available banks, use the List Providers endpoint */ + preferred_bank?: string; + /** Subaccount code of the account you want to split the transaction with */ + subaccount?: string; + /** Split code consisting of the lists of accounts you want to split the transaction with */ + split_code?: string; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-create-data.ts b/src/models/dedicated-virtual-account-dedicated-account-create-data.ts new file mode 100644 index 0000000..c6eb668 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-create-data.ts @@ -0,0 +1,26 @@ +export interface DedicatedVirtualAccountDedicatedAccountCreateData { + /** */ + bank: { name: string; id: number; slug: string }; + /** */ + account_name: string; + /** */ + account_number: string; + /** */ + assigned: boolean; + /** */ + currency: string; + /** */ + metadata: unknown; + /** */ + active: boolean; + /** */ + id: number; + /** */ + created_at: string; + /** */ + updated_at: string; + /** */ + assignment: { integration: number; assignee_id: number; assignee_type: string; expired: boolean; account_type: string; assigned_at: string; expired_at: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-deactivate-data.ts b/src/models/dedicated-virtual-account-dedicated-account-deactivate-data.ts new file mode 100644 index 0000000..5763a67 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-deactivate-data.ts @@ -0,0 +1,24 @@ +export interface DedicatedVirtualAccountDedicatedAccountDeactivateData { + /** */ + bank: { name: string; id: number; slug: string }; + /** */ + account_name: string; + /** */ + account_number: string; + /** */ + assigned: boolean; + /** */ + currency: string; + /** */ + metadata: unknown; + /** */ + active: boolean; + /** */ + id: number; + /** */ + created_at: string; + /** */ + updated_at: string; + /** */ + assignment: { assignee_id: number; assignee_type: string; assigned_at: string; integration: number; account_type: string }; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-fetch-data.ts b/src/models/dedicated-virtual-account-dedicated-account-fetch-data.ts new file mode 100644 index 0000000..bfd2621 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-fetch-data.ts @@ -0,0 +1,24 @@ +export interface DedicatedVirtualAccountDedicatedAccountFetchData { + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + bank: { name: string; id: number; slug: string }; + /** */ + id: number; + /** */ + account_name: string; + /** */ + account_number: string; + /** */ + created_at: string; + /** */ + updated_at: string; + /** */ + currency: string; + /** */ + split_config: unknown; + /** */ + active: boolean; + /** */ + assigned: boolean; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-list-data.ts b/src/models/dedicated-virtual-account-dedicated-account-list-data.ts new file mode 100644 index 0000000..3006cbb --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-list-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountListData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-list-query.ts b/src/models/dedicated-virtual-account-dedicated-account-list-query.ts new file mode 100644 index 0000000..60cbe29 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-list-query.ts @@ -0,0 +1,16 @@ +export interface DedicatedVirtualAccountDedicatedAccountListQuery { + /** Status of the dedicated virtual account */ + active?: boolean; + /** The customer's ID */ + customer?: number; + /** The currency of the dedicated virtual account */ + currency?: "NGN" | "GHS"; + /** The bank's slug in lowercase, without spaces */ + provider_slug?: string; + /** The bank's ID */ + bank_id?: string; + /** The number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-remove-split-body.ts b/src/models/dedicated-virtual-account-dedicated-account-remove-split-body.ts new file mode 100644 index 0000000..e09ceac --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-remove-split-body.ts @@ -0,0 +1,4 @@ +export interface DedicatedVirtualAccountDedicatedAccountRemoveSplitBody { + /** Valid Dedicated virtual account */ + account_number: string; +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-remove-split-data.ts b/src/models/dedicated-virtual-account-dedicated-account-remove-split-data.ts new file mode 100644 index 0000000..a17c568 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-remove-split-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountRemoveSplitData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-requery-data.ts b/src/models/dedicated-virtual-account-dedicated-account-requery-data.ts new file mode 100644 index 0000000..b637ade --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-requery-data.ts @@ -0,0 +1,2 @@ +export interface DedicatedVirtualAccountDedicatedAccountRequeryData { +} diff --git a/src/models/dedicated-virtual-account-dedicated-account-requery-query.ts b/src/models/dedicated-virtual-account-dedicated-account-requery-query.ts new file mode 100644 index 0000000..6d1a148 --- /dev/null +++ b/src/models/dedicated-virtual-account-dedicated-account-requery-query.ts @@ -0,0 +1,8 @@ +export interface DedicatedVirtualAccountDedicatedAccountRequeryQuery { + /** Virtual account number to requery */ + account_number?: string; + /** The bank's slug in lowercase, without spaces. */ + provider_slug?: string; + /** The day the transfer was made */ + date?: string; +} diff --git a/src/models/direct-debit-directdebit-list-mandate-authorizations-data.ts b/src/models/direct-debit-directdebit-list-mandate-authorizations-data.ts new file mode 100644 index 0000000..25a96e4 --- /dev/null +++ b/src/models/direct-debit-directdebit-list-mandate-authorizations-data.ts @@ -0,0 +1,2 @@ +export interface DirectDebitDirectdebitListMandateAuthorizationsData { +} diff --git a/src/models/direct-debit-directdebit-list-mandate-authorizations-query.ts b/src/models/direct-debit-directdebit-list-mandate-authorizations-query.ts new file mode 100644 index 0000000..9a3eae0 --- /dev/null +++ b/src/models/direct-debit-directdebit-list-mandate-authorizations-query.ts @@ -0,0 +1,8 @@ +export interface DirectDebitDirectdebitListMandateAuthorizationsQuery { + /** The cursor value of the next set of authorizations to fetch. You can get this from the meta object of the response */ + cursor?: string; + /** Filter by the authorization status */ + status?: "pending" | "active" | "revoked"; + /** The number of authorizations to fetch per request */ + per_page?: number; +} diff --git a/src/models/direct-debit-directdebit-trigger-activation-charge-body.ts b/src/models/direct-debit-directdebit-trigger-activation-charge-body.ts new file mode 100644 index 0000000..438b2ba --- /dev/null +++ b/src/models/direct-debit-directdebit-trigger-activation-charge-body.ts @@ -0,0 +1,4 @@ +export interface DirectDebitDirectdebitTriggerActivationChargeBody { + /** Array of customer IDs to trigger activation charge for */ + customer_ids: Array; +} diff --git a/src/models/dispute-download-data.ts b/src/models/dispute-download-data.ts new file mode 100644 index 0000000..c0446e3 --- /dev/null +++ b/src/models/dispute-download-data.ts @@ -0,0 +1,6 @@ +export interface DisputeDownloadData { + /** */ + path: string; + /** */ + expiresAt: string; +} diff --git a/src/models/dispute-download-query.ts b/src/models/dispute-download-query.ts new file mode 100644 index 0000000..27913d7 --- /dev/null +++ b/src/models/dispute-download-query.ts @@ -0,0 +1,12 @@ +export interface DisputeDownloadQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** */ + status?: "awaiting-merchant-feedback" | "awaiting-bank-feedback" | "pending" | "resolved"; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/dispute-evidence-body.ts b/src/models/dispute-evidence-body.ts new file mode 100644 index 0000000..a21775c --- /dev/null +++ b/src/models/dispute-evidence-body.ts @@ -0,0 +1,14 @@ +export interface DisputeEvidenceBody { + /** Customer email */ + customer_email: string; + /** Customer name */ + customer_name: string; + /** Customer mobile number */ + customer_phone: string; + /** Details of service offered */ + service_details: string; + /** Delivery address */ + delivery_address?: string; + /** ISO 8601 representation of delivery date (YYYY-MM-DD) */ + delivery_date?: string; +} diff --git a/src/models/dispute-evidence-data.ts b/src/models/dispute-evidence-data.ts new file mode 100644 index 0000000..b94dba9 --- /dev/null +++ b/src/models/dispute-evidence-data.ts @@ -0,0 +1,22 @@ +export interface DisputeEvidenceData { + /** */ + customer_email: string; + /** */ + customer_name: string; + /** */ + customer_phone: string; + /** */ + service_details: string; + /** */ + delivery_address: string; + /** */ + delivery_date: string; + /** */ + dispute: number; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/dispute-fetch-data.ts b/src/models/dispute-fetch-data.ts new file mode 100644 index 0000000..f106a4d --- /dev/null +++ b/src/models/dispute-fetch-data.ts @@ -0,0 +1,44 @@ +export interface DisputeFetchData { + /** */ + id: number; + /** */ + refund_amount: number; + /** */ + currency: string; + /** */ + status: string; + /** */ + resolution: unknown; + /** */ + domain: string; + /** */ + transaction: { id: number; domain: string; status: string; reference: string; receipt_number?: number; amount: number; message: unknown; gateway_response: string; paid_at: string; created_at: string; channel: string; currency: string; ip_address: string; metadata: { custom_fields: Array<{ value: string; display_name: string; variable_name: string }> }; log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; fees: number; fees_split: number; authorization: { receiver_bank_account_number: unknown; receiver_bank: unknown }; customer: { international_format_phone: unknown }; plan: Record; subaccount: Record; split: Record; order_id: unknown; paidAt: string; createdAt: string; requested_amount: number; pos_transaction_data: unknown; source: unknown; fees_breakdown: unknown; connect: unknown }; + /** */ + transaction_reference: unknown; + /** */ + category: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + bin: string; + /** */ + last4: string; + /** */ + dueAt: unknown; + /** */ + resolvedAt: unknown; + /** */ + evidence: unknown; + /** */ + attachments: unknown; + /** */ + note: unknown; + /** */ + history: Array<{ status: string; by: string; createdAt: string }>; + /** */ + messages: Array<{ sender: string; body: string; createdAt: string }>; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/dispute-list-data.ts b/src/models/dispute-list-data.ts new file mode 100644 index 0000000..2aedc6c --- /dev/null +++ b/src/models/dispute-list-data.ts @@ -0,0 +1,2 @@ +export interface DisputeListData { +} diff --git a/src/models/dispute-list-query.ts b/src/models/dispute-list-query.ts new file mode 100644 index 0000000..e30f550 --- /dev/null +++ b/src/models/dispute-list-query.ts @@ -0,0 +1,14 @@ +export interface DisputeListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** Dispute status */ + status?: "awaiting-merchant-feedback" | "awaiting-bank-feedback" | "pending" | "resolved"; + /** Transaction ID */ + transaction?: string; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/dispute-resolve-body.ts b/src/models/dispute-resolve-body.ts new file mode 100644 index 0000000..1673434 --- /dev/null +++ b/src/models/dispute-resolve-body.ts @@ -0,0 +1,12 @@ +export interface DisputeResolveBody { + /** Dispute resolution. Accepted values, merchant-accepted, declined */ + resolution: string; + /** Reason for resolving */ + message: string; + /** The amount to refund, in the subunit of your integration currency */ + refund_amount: number; + /** Filename of attachment returned via response from the Dispute upload URL */ + uploaded_filename: string; + /** Evidence Id for fraud claims */ + evidence?: number; +} diff --git a/src/models/dispute-resolve-data.ts b/src/models/dispute-resolve-data.ts new file mode 100644 index 0000000..38d516e --- /dev/null +++ b/src/models/dispute-resolve-data.ts @@ -0,0 +1,46 @@ +export interface DisputeResolveData { + /** */ + currency: string; + /** */ + last4: string; + /** */ + bin: string; + /** */ + transaction_reference: unknown; + /** */ + merchant_transaction_reference: string; + /** */ + refund_amount: number; + /** */ + status: string; + /** */ + domain: string; + /** */ + resolution: string; + /** */ + category: string; + /** */ + note: unknown; + /** */ + attachments: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + transaction: number; + /** */ + created_by: number; + /** */ + evidence: number; + /** */ + resolvedAt: string; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + dueAt: unknown; + /** */ + message: { dispute: number; sender: string; body: string; id: number; createdAt: string; updatedAt: string }; +} diff --git a/src/models/dispute-transaction-data.ts b/src/models/dispute-transaction-data.ts new file mode 100644 index 0000000..c20d103 --- /dev/null +++ b/src/models/dispute-transaction-data.ts @@ -0,0 +1,48 @@ +export interface DisputeTransactionData { + /** */ + history: Array<{ status: string; by: string; createdAt: string }>; + /** */ + messages: Array<{ sender: string; body: string; createdAt: string }>; + /** */ + currency: string; + /** */ + last4: string; + /** */ + bin: string; + /** */ + transaction_reference: unknown; + /** */ + merchant_transaction_reference: string; + /** */ + refund_amount: number; + /** */ + status: string; + /** */ + domain: string; + /** */ + resolution: unknown; + /** */ + category: string; + /** */ + note: unknown; + /** */ + attachments: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + transaction: { id: number; domain: string; status: string; reference: string; receipt_number?: number; amount: number; message: unknown; gateway_response: string; paid_at: string; created_at: string; channel: string; currency: string; ip_address: string; metadata: { custom_fields: Array<{ value: string; display_name: string; variable_name: string }> }; log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; fees: number; fees_split: number; authorization: { receiver_bank_account_number: unknown; receiver_bank: unknown }; customer: { international_format_phone: unknown }; plan: Record; subaccount: Record; split: Record; order_id: unknown; paidAt: string; createdAt: string; requested_amount: number; pos_transaction_data: unknown; source: unknown; fees_breakdown: unknown; connect: Record }; + /** */ + created_by: number; + /** */ + evidence: unknown; + /** */ + resolvedAt: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + dueAt: unknown; +} diff --git a/src/models/dispute-update-body.ts b/src/models/dispute-update-body.ts new file mode 100644 index 0000000..34c7539 --- /dev/null +++ b/src/models/dispute-update-body.ts @@ -0,0 +1,6 @@ +export interface DisputeUpdateBody { + /** The amount to refund, in the subunit of your currency */ + refund_amount: number; + /** Filename of attachment returned via response from the Dispute upload URL */ + uploaded_filename?: string; +} diff --git a/src/models/dispute-update-data.ts b/src/models/dispute-update-data.ts new file mode 100644 index 0000000..1a5cd9e --- /dev/null +++ b/src/models/dispute-update-data.ts @@ -0,0 +1,44 @@ +export interface DisputeUpdateData { + /** */ + id: number; + /** */ + refund_amount: number; + /** */ + currency: string; + /** */ + status: string; + /** */ + resolution: unknown; + /** */ + domain: string; + /** */ + transaction: { id: number; domain: string; status: string; reference: string; receipt_number?: number; amount: number; message: unknown; gateway_response: string; paid_at: string; created_at: string; channel: string; currency: string; ip_address: string; metadata: { custom_fields: Array<{ value: string; display_name: string; variable_name: string }> }; log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; fees: number; fees_split: number; authorization: { receiver_bank_account_number: unknown; receiver_bank: unknown }; customer: { international_format_phone: unknown }; plan: Record; subaccount: Record; split: Record; order_id: unknown; paidAt: string; createdAt: string; requested_amount: number; pos_transaction_data: unknown; source: unknown; fees_breakdown: unknown; connect: unknown }; + /** */ + transaction_reference: unknown; + /** */ + category: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + bin: string; + /** */ + last4: string; + /** */ + dueAt: unknown; + /** */ + resolvedAt: unknown; + /** */ + evidence: unknown; + /** */ + attachments: unknown; + /** */ + note: unknown; + /** */ + history: Array<{ status: string; by: string; createdAt: string }>; + /** */ + messages: Array<{ sender: string; body: string; createdAt: string }>; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/dispute-upload-url-data.ts b/src/models/dispute-upload-url-data.ts new file mode 100644 index 0000000..c91672a --- /dev/null +++ b/src/models/dispute-upload-url-data.ts @@ -0,0 +1,6 @@ +export interface DisputeUploadUrlData { + /** */ + signedUrl: string; + /** */ + fileName: string; +} diff --git a/src/models/index.ts b/src/models/index.ts index 8680e5b..398ee38 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,55 +1,240 @@ -export * from './Accepted'; -export * from './Bank'; -export * from './BulkChargeInitiate'; -export * from './ChargeCreate'; -export * from './ChargeSubmitAddress'; -export * from './ChargeSubmitBirthday'; -export * from './ChargeSubmitOTP'; -export * from './ChargeSubmitPhone'; -export * from './ChargeSubmitPin'; -export * from './CustomerCreate'; -export * from './CustomerDeactivateAuthorization'; -export * from './CustomerRiskAction'; -export * from './CustomerUpdate'; -export * from './CustomerValidate'; -export * from './CustomerValidation'; -export * from './DedicatedVirtualAccountCreate'; -export * from './DedicatedVirtualAccountSplit'; -export * from './DisputeEvidence'; -export * from './DisputeResolve'; -export * from './DisputeUpdate'; -export * from './EFT'; -export * from './MobileMoney'; -export * from './ModelError'; -export * from './PageCreate'; -export * from './PageProduct'; -export * from './PageUpdate'; -export * from './PaymentRequestCreate'; -export * from './PaymentRequestUpdate'; -export * from './PlanCreate'; -export * from './PlanUpdate'; -export * from './ProductCreate'; -export * from './ProductUpdate'; -export * from './RefundCreate'; -export * from './Response'; -export * from './SplitCreate'; -export * from './SplitSubaccounts'; -export * from './SplitUpdate'; -export * from './SubaccountCreate'; -export * from './SubaccountUpdate'; -export * from './SubscriptionCreate'; -export * from './SubscriptionToggle'; -export * from './TransactionChargeAuthorization'; -export * from './TransactionCheckAuthorization'; -export * from './TransactionInitialize'; -export * from './TransactionPartialDebit'; -export * from './TransferBulk'; -export * from './TransferFinalize'; -export * from './TransferFinalizeDisableOTP'; -export * from './TransferInitiate'; -export * from './TransferRecipientBulk'; -export * from './TransferRecipientCreate'; -export * from './TransferRecipientUpdate'; -export * from './TransferResendOTP'; -export * from './USSD'; -export * from './VerificationBVNMatch'; + +export type { TransactionInitializeBody } from "./transaction-initialize-body.js"; +export type { TransactionInitializeData } from "./transaction-initialize-data.js"; +export type { TransactionChargeAuthorizationBody } from "./transaction-charge-authorization-body.js"; +export type { TransactionChargeAuthorizationData } from "./transaction-charge-authorization-data.js"; +export type { TransactionPartialDebitBody } from "./transaction-partial-debit-body.js"; +export type { TransactionPartialDebitData } from "./transaction-partial-debit-data.js"; +export type { TransactionVerifyData } from "./transaction-verify-data.js"; +export type { TransactionListQuery } from "./transaction-list-query.js"; +export type { TransactionListData } from "./transaction-list-data.js"; +export type { TransactionFetchData } from "./transaction-fetch-data.js"; +export type { TransactionTimelineData } from "./transaction-timeline-data.js"; +export type { TransactionTotalsQuery } from "./transaction-totals-query.js"; +export type { TransactionTotalsData } from "./transaction-totals-data.js"; +export type { TransactionExportQuery } from "./transaction-export-query.js"; +export type { TransactionExportData } from "./transaction-export-data.js"; +export type { ChargeCreateBody } from "./charge-create-body.js"; +export type { ChargeCreateData } from "./charge-create-data.js"; +export type { ChargeSubmitPinBody } from "./charge-submit-pin-body.js"; +export type { ChargeSubmitPinData } from "./charge-submit-pin-data.js"; +export type { ChargeSubmitOtpBody } from "./charge-submit-otp-body.js"; +export type { ChargeSubmitOtpData } from "./charge-submit-otp-data.js"; +export type { ChargeSubmitPhoneBody } from "./charge-submit-phone-body.js"; +export type { ChargeSubmitPhoneData } from "./charge-submit-phone-data.js"; +export type { ChargeSubmitBirthdayBody } from "./charge-submit-birthday-body.js"; +export type { ChargeSubmitBirthdayData } from "./charge-submit-birthday-data.js"; +export type { ChargeSubmitAddressBody } from "./charge-submit-address-body.js"; +export type { ChargeSubmitAddressData } from "./charge-submit-address-data.js"; +export type { ChargeCheckData } from "./charge-check-data.js"; +export type { BulkChargeListQuery } from "./bulk-charge-list-query.js"; +export type { BulkChargeListData } from "./bulk-charge-list-data.js"; +export type { BulkChargeInitiateBody } from "./bulk-charge-initiate-body.js"; +export type { BulkChargeInitiateData } from "./bulk-charge-initiate-data.js"; +export type { BulkChargeFetchData } from "./bulk-charge-fetch-data.js"; +export type { BulkChargeChargesQuery } from "./bulk-charge-charges-query.js"; +export type { BulkChargeChargesData } from "./bulk-charge-charges-data.js"; +export type { SubaccountListQuery } from "./subaccount-list-query.js"; +export type { SubaccountListData } from "./subaccount-list-data.js"; +export type { SubaccountCreateBody } from "./subaccount-create-body.js"; +export type { SubaccountCreateData } from "./subaccount-create-data.js"; +export type { SubaccountFetchData } from "./subaccount-fetch-data.js"; +export type { SubaccountUpdateBody } from "./subaccount-update-body.js"; +export type { SubaccountUpdateData } from "./subaccount-update-data.js"; +export type { SplitListQuery } from "./split-list-query.js"; +export type { SplitListData } from "./split-list-data.js"; +export type { SplitCreateBody } from "./split-create-body.js"; +export type { SplitCreateData } from "./split-create-data.js"; +export type { SplitFetchData } from "./split-fetch-data.js"; +export type { SplitUpdateBody } from "./split-update-body.js"; +export type { SplitUpdateData } from "./split-update-data.js"; +export type { SplitAddSubaccountBody } from "./split-add-subaccount-body.js"; +export type { SplitAddSubaccountData } from "./split-add-subaccount-data.js"; +export type { SplitRemoveSubaccountBody } from "./split-remove-subaccount-body.js"; +export type { TerminalSendEventBody } from "./terminal-send-event-body.js"; +export type { TerminalSendEventData } from "./terminal-send-event-data.js"; +export type { TerminalFetchEventStatusData } from "./terminal-fetch-event-status-data.js"; +export type { TerminalFetchTerminalStatusData } from "./terminal-fetch-terminal-status-data.js"; +export type { TerminalListQuery } from "./terminal-list-query.js"; +export type { TerminalListData } from "./terminal-list-data.js"; +export type { TerminalFetchData } from "./terminal-fetch-data.js"; +export type { TerminalUpdateBody } from "./terminal-update-body.js"; +export type { TerminalCommissionBody } from "./terminal-commission-body.js"; +export type { TerminalDecommissionBody } from "./terminal-decommission-body.js"; +export type { VirtualTerminalListQuery } from "./virtual-terminal-list-query.js"; +export type { VirtualTerminalListData } from "./virtual-terminal-list-data.js"; +export type { VirtualTerminalCreateBody } from "./virtual-terminal-create-body.js"; +export type { VirtualTerminalCreateData } from "./virtual-terminal-create-data.js"; +export type { VirtualTerminalFetchData } from "./virtual-terminal-fetch-data.js"; +export type { VirtualTerminalUpdateBody } from "./virtual-terminal-update-body.js"; +export type { VirtualTerminalUpdateData } from "./virtual-terminal-update-data.js"; +export type { VirtualTerminalDestinationAssignBody } from "./virtual-terminal-destination-assign-body.js"; +export type { VirtualTerminalDestinationAssignData } from "./virtual-terminal-destination-assign-data.js"; +export type { VirtualTerminalDestinationUnassignBody } from "./virtual-terminal-destination-unassign-body.js"; +export type { VirtualTerminalAddSplitCodeBody } from "./virtual-terminal-add-split-code-body.js"; +export type { VirtualTerminalAddSplitCodeData } from "./virtual-terminal-add-split-code-data.js"; +export type { VirtualTerminalDeleteSplitCodeBody } from "./virtual-terminal-delete-split-code-body.js"; +export type { CustomerListQuery } from "./customer-list-query.js"; +export type { CustomerListData } from "./customer-list-data.js"; +export type { CustomerCreateBody } from "./customer-create-body.js"; +export type { CustomerCreateData } from "./customer-create-data.js"; +export type { CustomerFetchData } from "./customer-fetch-data.js"; +export type { CustomerUpdateBody } from "./customer-update-body.js"; +export type { CustomerUpdateData } from "./customer-update-data.js"; +export type { CustomerRiskActionBody } from "./customer-risk-action-body.js"; +export type { CustomerRiskActionData } from "./customer-risk-action-data.js"; +export type { CustomerValidateBody } from "./customer-validate-body.js"; +export type { CustomerInitializeAuthorizationBody } from "./customer-initialize-authorization-body.js"; +export type { CustomerInitializeAuthorizationData } from "./customer-initialize-authorization-data.js"; +export type { CustomerVerifyAuthorizationData } from "./customer-verify-authorization-data.js"; +export type { CustomerDeactivateAuthorizationBody } from "./customer-deactivate-authorization-body.js"; +export type { CustomerInitializeDirectDebitBody } from "./customer-initialize-direct-debit-body.js"; +export type { CustomerInitializeDirectDebitData } from "./customer-initialize-direct-debit-data.js"; +export type { CustomerDirectDebitActivationChargeBody } from "./customer-direct-debit-activation-charge-body.js"; +export type { CustomerFetchMandateAuthorizationsData } from "./customer-fetch-mandate-authorizations-data.js"; +export type { DirectDebitDirectdebitTriggerActivationChargeBody } from "./direct-debit-directdebit-trigger-activation-charge-body.js"; +export type { DirectDebitDirectdebitListMandateAuthorizationsQuery } from "./direct-debit-directdebit-list-mandate-authorizations-query.js"; +export type { DirectDebitDirectdebitListMandateAuthorizationsData } from "./direct-debit-directdebit-list-mandate-authorizations-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountListQuery } from "./dedicated-virtual-account-dedicated-account-list-query.js"; +export type { DedicatedVirtualAccountDedicatedAccountListData } from "./dedicated-virtual-account-dedicated-account-list-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountCreateBody } from "./dedicated-virtual-account-dedicated-account-create-body.js"; +export type { DedicatedVirtualAccountDedicatedAccountCreateData } from "./dedicated-virtual-account-dedicated-account-create-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountAssignBody } from "./dedicated-virtual-account-dedicated-account-assign-body.js"; +export type { DedicatedVirtualAccountDedicatedAccountAssignData } from "./dedicated-virtual-account-dedicated-account-assign-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountFetchData } from "./dedicated-virtual-account-dedicated-account-fetch-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountDeactivateData } from "./dedicated-virtual-account-dedicated-account-deactivate-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountRequeryQuery } from "./dedicated-virtual-account-dedicated-account-requery-query.js"; +export type { DedicatedVirtualAccountDedicatedAccountRequeryData } from "./dedicated-virtual-account-dedicated-account-requery-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountAddSplitBody } from "./dedicated-virtual-account-dedicated-account-add-split-body.js"; +export type { DedicatedVirtualAccountDedicatedAccountAddSplitData } from "./dedicated-virtual-account-dedicated-account-add-split-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountRemoveSplitBody } from "./dedicated-virtual-account-dedicated-account-remove-split-body.js"; +export type { DedicatedVirtualAccountDedicatedAccountRemoveSplitData } from "./dedicated-virtual-account-dedicated-account-remove-split-data.js"; +export type { DedicatedVirtualAccountDedicatedAccountAvailableProvidersData } from "./dedicated-virtual-account-dedicated-account-available-providers-data.js"; +export type { ApplePayListDomainQuery } from "./apple-pay-list-domain-query.js"; +export type { ApplePayListDomainData } from "./apple-pay-list-domain-data.js"; +export type { ApplePayRegisterDomainBody } from "./apple-pay-register-domain-body.js"; +export type { ApplePayUnregisterDomainBody } from "./apple-pay-unregister-domain-body.js"; +export type { ApplePayUnregisterDomainData } from "./apple-pay-unregister-domain-data.js"; +export type { PlanListQuery } from "./plan-list-query.js"; +export type { PlanListData } from "./plan-list-data.js"; +export type { PlanCreateBody } from "./plan-create-body.js"; +export type { PlanCreateData } from "./plan-create-data.js"; +export type { PlanFetchData } from "./plan-fetch-data.js"; +export type { PlanUpdateBody } from "./plan-update-body.js"; +export type { SubscriptionListQuery } from "./subscription-list-query.js"; +export type { SubscriptionListData } from "./subscription-list-data.js"; +export type { SubscriptionCreateBody } from "./subscription-create-body.js"; +export type { SubscriptionCreateData } from "./subscription-create-data.js"; +export type { SubscriptionFetchData } from "./subscription-fetch-data.js"; +export type { SubscriptionDisableBody } from "./subscription-disable-body.js"; +export type { SubscriptionEnableBody } from "./subscription-enable-body.js"; +export type { SubscriptionEnableData } from "./subscription-enable-data.js"; +export type { SubscriptionManageLinkData } from "./subscription-manage-link-data.js"; +export type { SubscriptionManageEmailData } from "./subscription-manage-email-data.js"; +export type { TransferRecipientTransferrecipientListQuery } from "./transfer-recipient-transferrecipient-list-query.js"; +export type { TransferRecipientTransferrecipientListData } from "./transfer-recipient-transferrecipient-list-data.js"; +export type { TransferRecipientTransferrecipientCreateBody } from "./transfer-recipient-transferrecipient-create-body.js"; +export type { TransferRecipientTransferrecipientCreateData } from "./transfer-recipient-transferrecipient-create-data.js"; +export type { TransferRecipientTransferrecipientBulkBody } from "./transfer-recipient-transferrecipient-bulk-body.js"; +export type { TransferRecipientTransferrecipientBulkData } from "./transfer-recipient-transferrecipient-bulk-data.js"; +export type { TransferRecipientTransferrecipientFetchData } from "./transfer-recipient-transferrecipient-fetch-data.js"; +export type { TransferRecipientTransferrecipientUpdateBody } from "./transfer-recipient-transferrecipient-update-body.js"; +export type { TransferListQuery } from "./transfer-list-query.js"; +export type { TransferListData } from "./transfer-list-data.js"; +export type { TransferInitiateBody } from "./transfer-initiate-body.js"; +export type { TransferInitiateData } from "./transfer-initiate-data.js"; +export type { TransferFinalizeBody } from "./transfer-finalize-body.js"; +export type { TransferFinalizeData } from "./transfer-finalize-data.js"; +export type { TransferBulkBody } from "./transfer-bulk-body.js"; +export type { TransferBulkData } from "./transfer-bulk-data.js"; +export type { TransferFetchData } from "./transfer-fetch-data.js"; +export type { TransferVerifyData } from "./transfer-verify-data.js"; +export type { TransferExportTransferQuery } from "./transfer-export-transfer-query.js"; +export type { TransferExportTransferData } from "./transfer-export-transfer-data.js"; +export type { TransferResendOtpBody } from "./transfer-resend-otp-body.js"; +export type { TransferDisableOtpFinalizeBody } from "./transfer-disable-otp-finalize-body.js"; +export type { BalanceFetchData } from "./balance-fetch-data.js"; +export type { BalanceLedgerQuery } from "./balance-ledger-query.js"; +export type { BalanceLedgerData } from "./balance-ledger-data.js"; +export type { PaymentRequestListQuery } from "./payment-request-list-query.js"; +export type { PaymentRequestListData } from "./payment-request-list-data.js"; +export type { PaymentRequestCreateBody } from "./payment-request-create-body.js"; +export type { PaymentRequestCreateData } from "./payment-request-create-data.js"; +export type { PaymentRequestFetchData } from "./payment-request-fetch-data.js"; +export type { PaymentRequestUpdateBody } from "./payment-request-update-body.js"; +export type { PaymentRequestUpdateData } from "./payment-request-update-data.js"; +export type { PaymentRequestVerifyData } from "./payment-request-verify-data.js"; +export type { PaymentRequestTotalsData } from "./payment-request-totals-data.js"; +export type { PaymentRequestFinalizeData } from "./payment-request-finalize-data.js"; +export type { ProductListQuery } from "./product-list-query.js"; +export type { ProductListData } from "./product-list-data.js"; +export type { ProductCreateBody } from "./product-create-body.js"; +export type { ProductCreateData } from "./product-create-data.js"; +export type { ProductFetchData } from "./product-fetch-data.js"; +export type { ProductUpdateBody } from "./product-update-body.js"; +export type { ProductUpdateData } from "./product-update-data.js"; +export type { StorefrontListQuery } from "./storefront-list-query.js"; +export type { StorefrontListData } from "./storefront-list-data.js"; +export type { StorefrontCreateBody } from "./storefront-create-body.js"; +export type { StorefrontCreateData } from "./storefront-create-data.js"; +export type { StorefrontFetchData } from "./storefront-fetch-data.js"; +export type { StorefrontUpdateBody } from "./storefront-update-body.js"; +export type { StorefrontVerifySlugData } from "./storefront-verify-slug-data.js"; +export type { StorefrontFetchOrdersData } from "./storefront-fetch-orders-data.js"; +export type { StorefrontListProductsData } from "./storefront-list-products-data.js"; +export type { StorefrontAddProductsBody } from "./storefront-add-products-body.js"; +export type { StorefrontAddProductsData } from "./storefront-add-products-data.js"; +export type { StorefrontPublishData } from "./storefront-publish-data.js"; +export type { StorefrontDuplicateData } from "./storefront-duplicate-data.js"; +export type { OrderListQuery } from "./order-list-query.js"; +export type { OrderListData } from "./order-list-data.js"; +export type { OrderCreateBody } from "./order-create-body.js"; +export type { OrderCreateData } from "./order-create-data.js"; +export type { OrderFetchData } from "./order-fetch-data.js"; +export type { OrderProductData } from "./order-product-data.js"; +export type { OrderValidateData } from "./order-validate-data.js"; +export type { PageListQuery } from "./page-list-query.js"; +export type { PageListData } from "./page-list-data.js"; +export type { PageCreateBody } from "./page-create-body.js"; +export type { PageCreateData } from "./page-create-data.js"; +export type { PageFetchData } from "./page-fetch-data.js"; +export type { PageUpdateBody } from "./page-update-body.js"; +export type { PageUpdateData } from "./page-update-data.js"; +export type { PageAddProductsBody } from "./page-add-products-body.js"; +export type { PageAddProductsData } from "./page-add-products-data.js"; +export type { SettlementSettlementsFetchQuery } from "./settlement-settlements-fetch-query.js"; +export type { SettlementSettlementsFetchData } from "./settlement-settlements-fetch-data.js"; +export type { SettlementSettlementsTransactionData } from "./settlement-settlements-transaction-data.js"; +export type { IntegrationFetchPaymentSessionTimeoutData } from "./integration-fetch-payment-session-timeout-data.js"; +export type { IntegrationUpdatePaymentSessionTimeoutBody } from "./integration-update-payment-session-timeout-body.js"; +export type { IntegrationUpdatePaymentSessionTimeoutData } from "./integration-update-payment-session-timeout-data.js"; +export type { RefundListQuery } from "./refund-list-query.js"; +export type { RefundListData } from "./refund-list-data.js"; +export type { RefundCreateBody } from "./refund-create-body.js"; +export type { RefundCreateData } from "./refund-create-data.js"; +export type { RefundRetryBody } from "./refund-retry-body.js"; +export type { RefundRetryData } from "./refund-retry-data.js"; +export type { RefundFetchData } from "./refund-fetch-data.js"; +export type { DisputeListQuery } from "./dispute-list-query.js"; +export type { DisputeListData } from "./dispute-list-data.js"; +export type { DisputeFetchData } from "./dispute-fetch-data.js"; +export type { DisputeUpdateBody } from "./dispute-update-body.js"; +export type { DisputeUpdateData } from "./dispute-update-data.js"; +export type { DisputeUploadUrlData } from "./dispute-upload-url-data.js"; +export type { DisputeDownloadQuery } from "./dispute-download-query.js"; +export type { DisputeDownloadData } from "./dispute-download-data.js"; +export type { DisputeTransactionData } from "./dispute-transaction-data.js"; +export type { DisputeResolveBody } from "./dispute-resolve-body.js"; +export type { DisputeResolveData } from "./dispute-resolve-data.js"; +export type { DisputeEvidenceBody } from "./dispute-evidence-body.js"; +export type { DisputeEvidenceData } from "./dispute-evidence-data.js"; +export type { BankListQuery } from "./bank-list-query.js"; +export type { BankListData } from "./bank-list-data.js"; +export type { BankResolveAccountNumberQuery } from "./bank-resolve-account-number-query.js"; +export type { BankResolveAccountNumberData } from "./bank-resolve-account-number-data.js"; +export type { BankValidateAccountNumberBody } from "./bank-validate-account-number-body.js"; +export type { BankValidateAccountNumberData } from "./bank-validate-account-number-data.js"; +export type { MiscellaneousResolveCardBinData } from "./miscellaneous-resolve-card-bin-data.js"; +export type { MiscellaneousListCountriesData } from "./miscellaneous-list-countries-data.js"; +export type { MiscellaneousAvsQuery } from "./miscellaneous-avs-query.js"; +export type { MiscellaneousAvsData } from "./miscellaneous-avs-data.js"; diff --git a/src/models/integration-fetch-payment-session-timeout-data.ts b/src/models/integration-fetch-payment-session-timeout-data.ts new file mode 100644 index 0000000..4d6b2c2 --- /dev/null +++ b/src/models/integration-fetch-payment-session-timeout-data.ts @@ -0,0 +1,4 @@ +export interface IntegrationFetchPaymentSessionTimeoutData { + /** */ + payment_session_timeout: number; +} diff --git a/src/models/integration-update-payment-session-timeout-body.ts b/src/models/integration-update-payment-session-timeout-body.ts new file mode 100644 index 0000000..df6e420 --- /dev/null +++ b/src/models/integration-update-payment-session-timeout-body.ts @@ -0,0 +1,4 @@ +export interface IntegrationUpdatePaymentSessionTimeoutBody { + /** Time in seconds before a transaction becomes invalid */ + timeout: number; +} diff --git a/src/models/integration-update-payment-session-timeout-data.ts b/src/models/integration-update-payment-session-timeout-data.ts new file mode 100644 index 0000000..901c0bd --- /dev/null +++ b/src/models/integration-update-payment-session-timeout-data.ts @@ -0,0 +1,4 @@ +export interface IntegrationUpdatePaymentSessionTimeoutData { + /** */ + payment_session_timeout: number; +} diff --git a/src/models/miscellaneous-avs-data.ts b/src/models/miscellaneous-avs-data.ts new file mode 100644 index 0000000..e979141 --- /dev/null +++ b/src/models/miscellaneous-avs-data.ts @@ -0,0 +1,2 @@ +export interface MiscellaneousAvsData { +} diff --git a/src/models/miscellaneous-avs-query.ts b/src/models/miscellaneous-avs-query.ts new file mode 100644 index 0000000..d245e29 --- /dev/null +++ b/src/models/miscellaneous-avs-query.ts @@ -0,0 +1,4 @@ +export interface MiscellaneousAvsQuery { + /** The country code of the states to list. It is gotten after the charge request */ + country?: string; +} diff --git a/src/models/miscellaneous-list-countries-data.ts b/src/models/miscellaneous-list-countries-data.ts new file mode 100644 index 0000000..0fa46f5 --- /dev/null +++ b/src/models/miscellaneous-list-countries-data.ts @@ -0,0 +1,2 @@ +export interface MiscellaneousListCountriesData { +} diff --git a/src/models/miscellaneous-resolve-card-bin-data.ts b/src/models/miscellaneous-resolve-card-bin-data.ts new file mode 100644 index 0000000..2a1ffda --- /dev/null +++ b/src/models/miscellaneous-resolve-card-bin-data.ts @@ -0,0 +1,20 @@ +export interface MiscellaneousResolveCardBinData { + /** */ + bin: string; + /** */ + brand: string; + /** */ + sub_brand: string; + /** */ + country_code: string; + /** */ + country_name: string; + /** */ + card_type: string; + /** */ + bank: string; + /** */ + currency: string; + /** */ + linked_bank_id: number; +} diff --git a/src/models/order-create-body.ts b/src/models/order-create-body.ts new file mode 100644 index 0000000..905d5ac --- /dev/null +++ b/src/models/order-create-body.ts @@ -0,0 +1,20 @@ +export interface OrderCreateBody { + /** The email of the customer placing the order */ + email: string; + /** The customer's first name */ + first_name: string; + /** The customer's last name */ + last_name: string; + /** The customer's mobile number */ + phone: string; + /** Currency in which amount is set */ + currency: "GHS" | "KES" | "NGN" | "USD" | "ZAR"; + /** */ + items: Array<{ item: number; type: string; quantity: number; amount: number }>; + /** The shipping details of the order */ + shipping: { street_line: string; city: string; state: string; country: string; shipping_fee: number; delivery_note?: string }; + /** A flag to indicate if the order is for someone else */ + is_gift?: boolean; + /** A flag to indicate if the someone else should pay for the order */ + pay_for_me?: boolean; +} diff --git a/src/models/order-create-data.ts b/src/models/order-create-data.ts new file mode 100644 index 0000000..d4e0b5e --- /dev/null +++ b/src/models/order-create-data.ts @@ -0,0 +1,50 @@ +export interface OrderCreateData { + /** */ + discounts: Array; + /** */ + currency: string; + /** */ + shipping_address: unknown; + /** */ + integration: number; + /** */ + domain: string; + /** */ + email: string; + /** */ + customer: number; + /** */ + amount: number; + /** */ + pay_for_me: boolean; + /** */ + shipping: { customer: number; integration: number; domain: string; fees: number; delivery_note: unknown; street_line: string; city: string; state: string; country: string; is_shipped: boolean; delivery_tracking_link: unknown; id: number; createdAt: string; updatedAt: string }; + /** */ + shipping_fees: number; + /** */ + shipping_method?: { region: string; fee: number; currency: string }; + /** */ + metadata: Record; + /** */ + order_code: string; + /** */ + status: string; + /** */ + refunded: boolean; + /** */ + is_viewed: boolean; + /** */ + expiration_date: unknown; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + items: Array; + /** */ + pay_for_me_code: string; + /** */ + discount_amount: number; +} diff --git a/src/models/order-fetch-data.ts b/src/models/order-fetch-data.ts new file mode 100644 index 0000000..7f88c35 --- /dev/null +++ b/src/models/order-fetch-data.ts @@ -0,0 +1,62 @@ +export interface OrderFetchData { + /** */ + discounts: Array; + /** */ + order_code: string; + /** */ + domain: string; + /** */ + currency: string; + /** */ + amount: number; + /** */ + email: string; + /** */ + status: string; + /** */ + refunded: boolean; + /** */ + paid_at: string; + /** */ + shipping_address: unknown; + /** */ + metadata: Record; + /** */ + shipping_fees: number; + /** */ + shipping_method: unknown; + /** */ + is_viewed: boolean; + /** */ + expiration_date: string; + /** */ + pay_for_me: boolean; + /** */ + id: number; + /** */ + integration: number; + /** */ + page: unknown; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + shipping: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + transaction: number; + /** */ + is_gift: boolean; + /** */ + payer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + fully_refunded: boolean; + /** */ + refunded_amount: number; + /** */ + items: Array<{ order_item_id: number; orderId: number; type: string; item: number; current_total_items_price: number; files: string; order: number; amount: number; quantity: number; createdAt: string; name: string; product_level_type: string; product_id: number; product_success_message: unknown; product_redirect_url: unknown; IFNULL_p1_expires_in__p2_expires_in_: unknown; product_quantity_sold: number; product_notification_emails: unknown; IFNULL_p1_metadata__p2_metadata_: string; storefront_redirect_url: unknown; storefront_success_message: unknown }>; + /** */ + discount_amount: unknown; +} diff --git a/src/models/order-list-data.ts b/src/models/order-list-data.ts new file mode 100644 index 0000000..ca28601 --- /dev/null +++ b/src/models/order-list-data.ts @@ -0,0 +1,2 @@ +export interface OrderListData { +} diff --git a/src/models/order-list-query.ts b/src/models/order-list-query.ts new file mode 100644 index 0000000..853c868 --- /dev/null +++ b/src/models/order-list-query.ts @@ -0,0 +1,10 @@ +export interface OrderListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/order-product-data.ts b/src/models/order-product-data.ts new file mode 100644 index 0000000..e4a2ea8 --- /dev/null +++ b/src/models/order-product-data.ts @@ -0,0 +1,2 @@ +export interface OrderProductData { +} diff --git a/src/models/order-validate-data.ts b/src/models/order-validate-data.ts new file mode 100644 index 0000000..2863ef2 --- /dev/null +++ b/src/models/order-validate-data.ts @@ -0,0 +1,50 @@ +export interface OrderValidateData { + /** */ + order_code: string; + /** */ + domain: string; + /** */ + currency: string; + /** */ + amount: number; + /** */ + email: string; + /** */ + status: string; + /** */ + refunded: boolean; + /** */ + paid_at: unknown; + /** */ + shipping_address: unknown; + /** */ + metadata: unknown; + /** */ + shipping_fees: number; + /** */ + shipping_method: unknown; + /** */ + is_viewed: boolean; + /** */ + expiration_date: string; + /** */ + pay_for_me: boolean; + /** */ + id: number; + /** */ + integration: { key: string; name: string; logo: string; allowed_currencies: Array }; + /** */ + transaction: unknown; + /** */ + page: unknown; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + shipping: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + payer: unknown; +} diff --git a/src/models/page-add-products-body.ts b/src/models/page-add-products-body.ts new file mode 100644 index 0000000..fef5625 --- /dev/null +++ b/src/models/page-add-products-body.ts @@ -0,0 +1,4 @@ +export interface PageAddProductsBody { + /** A list of IDs of products to add to a page. */ + products: Array; +} diff --git a/src/models/page-add-products-data.ts b/src/models/page-add-products-data.ts new file mode 100644 index 0000000..85bc198 --- /dev/null +++ b/src/models/page-add-products-data.ts @@ -0,0 +1,48 @@ +export interface PageAddProductsData { + /** */ + integration: number; + /** */ + plan: unknown; + /** */ + domain: string; + /** */ + name: string; + /** */ + description: unknown; + /** */ + amount: unknown; + /** */ + currency: string; + /** */ + slug: string; + /** */ + custom_fields: unknown; + /** */ + type: string; + /** */ + redirect_url: unknown; + /** */ + success_message: unknown; + /** */ + collect_phone: boolean; + /** */ + active: boolean; + /** */ + published: boolean; + /** */ + migrate: boolean; + /** */ + notification_email: unknown; + /** */ + metadata: unknown; + /** */ + split_code: unknown; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + products: Array<{ product_id: number; name: string; description: string; product_code: string; page: number; price: number; currency: string; quantity: number; type: string; features: unknown; is_shippable: number; domain: string; integration: number; active: number; in_stock: number }>; +} diff --git a/src/models/page-create-body.ts b/src/models/page-create-body.ts new file mode 100644 index 0000000..28c8293 --- /dev/null +++ b/src/models/page-create-body.ts @@ -0,0 +1,37 @@ +export interface PageCreateBody { + /** Name of page */ + name: string; + /** The description of the page */ + description?: string; + /** Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR */ + amount?: number; + /** The transaction currency. Defaults to your integration currency. */ + currency?: "NGN" | "GHS" | "ZAR" | "KES" | "USD"; + /** URL slug you would like to be associated with this page. Page will be accessible at `https://paystack.com/pay/[slug]` */ + slug?: string; + /** The type of payment page to create. Defaults to `payment` if no type is specified. + */ + type?: "payment" | "subscription" | "product" | "plan"; + /** The ID of the plan to subscribe customers on this payment page to when `type` is set to `subscription`. */ + plan?: string; + /** Specifies whether to collect a fixed amount on the payment page. If true, `amount` must be passed. */ + fixed_amount?: boolean; + /** The split code of the transaction split. e.g. `SPL_98WF13Eb3w` */ + split_code?: string; + /** JSON object of custom data */ + metadata?: Record; + /** If you would like Paystack to redirect to a URL upon successful payment, specify the URL here. + */ + redirect_url?: string; + /** A success message to display to the customer after a successful transaction + */ + success_message?: string; + /** An email address that will receive transaction notifications for this payment page + */ + notification_email?: string; + /** Specify whether to collect phone numbers on the payment page + */ + collect_phone?: boolean; + /** If you would like to accept custom fields, specify them here. */ + custom_fields?: Array>; +} diff --git a/src/models/page-create-data.ts b/src/models/page-create-data.ts new file mode 100644 index 0000000..1d6d050 --- /dev/null +++ b/src/models/page-create-data.ts @@ -0,0 +1,28 @@ +export interface PageCreateData { + /** */ + name: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + slug: string; + /** */ + currency: string; + /** */ + type: string; + /** */ + collect_phone: boolean; + /** */ + active: boolean; + /** */ + published: boolean; + /** */ + migrate: boolean; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/page-fetch-data.ts b/src/models/page-fetch-data.ts new file mode 100644 index 0000000..65419d9 --- /dev/null +++ b/src/models/page-fetch-data.ts @@ -0,0 +1,44 @@ +export interface PageFetchData { + /** */ + integration: number; + /** */ + domain: string; + /** */ + name: string; + /** */ + description: unknown; + /** */ + amount: number; + /** */ + currency: string; + /** */ + slug: string; + /** */ + custom_fields: unknown; + /** */ + type: string; + /** */ + redirect_url: unknown; + /** */ + success_message: unknown; + /** */ + collect_phone: boolean; + /** */ + active: boolean; + /** */ + published: boolean; + /** */ + migrate: boolean; + /** */ + notification_email: unknown; + /** */ + metadata: unknown; + /** */ + split_code: unknown; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/page-list-data.ts b/src/models/page-list-data.ts new file mode 100644 index 0000000..5a1445b --- /dev/null +++ b/src/models/page-list-data.ts @@ -0,0 +1,2 @@ +export interface PageListData { +} diff --git a/src/models/page-list-query.ts b/src/models/page-list-query.ts new file mode 100644 index 0000000..aba59a0 --- /dev/null +++ b/src/models/page-list-query.ts @@ -0,0 +1,10 @@ +export interface PageListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/page-update-body.ts b/src/models/page-update-body.ts new file mode 100644 index 0000000..cb03d72 --- /dev/null +++ b/src/models/page-update-body.ts @@ -0,0 +1,10 @@ +export interface PageUpdateBody { + /** Name of page */ + name?: string; + /** The description of the page */ + description?: string; + /** Amount should be in the subunit of the currency */ + amount?: number; + /** Set to false to deactivate page url */ + active?: boolean; +} diff --git a/src/models/page-update-data.ts b/src/models/page-update-data.ts new file mode 100644 index 0000000..98333e2 --- /dev/null +++ b/src/models/page-update-data.ts @@ -0,0 +1,46 @@ +export interface PageUpdateData { + /** */ + domain: string; + /** */ + name: string; + /** */ + description: unknown; + /** */ + amount: unknown; + /** */ + currency: string; + /** */ + slug: string; + /** */ + custom_fields: unknown; + /** */ + type: string; + /** */ + redirect_url: unknown; + /** */ + success_message: unknown; + /** */ + collect_phone: boolean; + /** */ + active: boolean; + /** */ + published: boolean; + /** */ + migrate: boolean; + /** */ + notification_email: unknown; + /** */ + metadata: unknown; + /** */ + split_code: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + plan: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/payment-request-create-body.ts b/src/models/payment-request-create-body.ts new file mode 100644 index 0000000..ba80b03 --- /dev/null +++ b/src/models/payment-request-create-body.ts @@ -0,0 +1,27 @@ +export interface PaymentRequestCreateBody { + /** Customer id or code */ + customer: string; + /** Payment request amount. Only useful if line items and tax values are ignored. +The endpoint will throw a friendly warning if neither is available. */ + amount: number; + /** Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN */ + currency?: string; + /** ISO 8601 representation of request due date */ + due_date?: string; + /** A short description of the payment request */ + description?: string; + /** Array of line items */ + line_items?: Array>; + /** Array of taxes */ + tax?: Array>; + /** Indicates whether Paystack sends an email notification to customer. Defaults to true */ + send_notification?: boolean; + /** Indicate if request should be saved as draft. Defaults to false and overrides send_notification */ + draft?: boolean; + /** Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) even if there are no line_items or tax passed */ + has_invoice?: boolean; + /** Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. */ + invoice_number?: number; + /** The split code of the transaction split. */ + split_code?: string; +} diff --git a/src/models/payment-request-create-data.ts b/src/models/payment-request-create-data.ts new file mode 100644 index 0000000..80f1d33 --- /dev/null +++ b/src/models/payment-request-create-data.ts @@ -0,0 +1,44 @@ +export interface PaymentRequestCreateData { + /** */ + id: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + due_date: string; + /** */ + has_invoice: boolean; + /** */ + invoice_number: number; + /** */ + description: string; + /** */ + line_items: Array; + /** */ + tax: Array; + /** */ + request_code: string; + /** */ + status: string; + /** */ + paid: boolean; + /** */ + metadata: Record; + /** */ + notifications: Array; + /** */ + offline_reference: string; + /** */ + customer: number; + /** */ + created_at: string; + /** */ + discount: unknown; + /** */ + split_code: string; +} diff --git a/src/models/payment-request-fetch-data.ts b/src/models/payment-request-fetch-data.ts new file mode 100644 index 0000000..c1be90b --- /dev/null +++ b/src/models/payment-request-fetch-data.ts @@ -0,0 +1,2 @@ +export interface PaymentRequestFetchData { +} diff --git a/src/models/payment-request-finalize-data.ts b/src/models/payment-request-finalize-data.ts new file mode 100644 index 0000000..a82f3c7 --- /dev/null +++ b/src/models/payment-request-finalize-data.ts @@ -0,0 +1,50 @@ +export interface PaymentRequestFinalizeData { + /** */ + id: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + due_date: string; + /** */ + has_invoice: boolean; + /** */ + invoice_number: number; + /** */ + description: string; + /** */ + pdf_url: unknown; + /** */ + line_items: Array<{ name: string; amount: number; quantity: number }>; + /** */ + tax: Array<{ name: string; amount: number }>; + /** */ + request_code: string; + /** */ + status: string; + /** */ + paid: boolean; + /** */ + paid_at: unknown; + /** */ + metadata: unknown; + /** */ + notifications: Array; + /** */ + offline_reference: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: { calling_code?: string }; risk_action: string; international_format_phone: string }; + /** */ + created_at: string; + /** */ + discount: { type: string; amount: number }; + /** */ + split_code: unknown; + /** */ + pending_amount: number; +} diff --git a/src/models/payment-request-list-data.ts b/src/models/payment-request-list-data.ts new file mode 100644 index 0000000..f432dec --- /dev/null +++ b/src/models/payment-request-list-data.ts @@ -0,0 +1,2 @@ +export interface PaymentRequestListData { +} diff --git a/src/models/payment-request-list-query.ts b/src/models/payment-request-list-query.ts new file mode 100644 index 0000000..4e94981 --- /dev/null +++ b/src/models/payment-request-list-query.ts @@ -0,0 +1,16 @@ +export interface PaymentRequestListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** Customer ID */ + customer?: string; + /** Invoice status to filter */ + status?: "draft" | "pending" | "success" | "failed"; + /** If your integration supports more than one currency, choose the one to filter */ + currency?: string; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/payment-request-totals-data.ts b/src/models/payment-request-totals-data.ts new file mode 100644 index 0000000..482e4a9 --- /dev/null +++ b/src/models/payment-request-totals-data.ts @@ -0,0 +1,8 @@ +export interface PaymentRequestTotalsData { + /** */ + pending: Array<{ currency: string; amount: number }>; + /** */ + successful: Array<{ currency: string; amount: number }>; + /** */ + total: Array<{ currency: string; amount: number }>; +} diff --git a/src/models/payment-request-update-body.ts b/src/models/payment-request-update-body.ts new file mode 100644 index 0000000..d390467 --- /dev/null +++ b/src/models/payment-request-update-body.ts @@ -0,0 +1,27 @@ +export interface PaymentRequestUpdateBody { + /** Customer id or code */ + customer?: string; + /** Payment request amount. Only useful if line items and tax values are ignored. +The endpoint will throw a friendly warning if neither is available. */ + amount?: number; + /** Specify the currency of the invoice. Allowed values are NGN, GHS, ZAR and USD. Defaults to NGN */ + currency?: string; + /** ISO 8601 representation of request due date */ + due_date?: string; + /** A short description of the payment request */ + description?: string; + /** Array of line items */ + line_items?: Array>; + /** Array of taxes */ + tax?: Array>; + /** Indicates whether Paystack sends an email notification to customer. Defaults to true */ + send_notification?: boolean; + /** Indicate if request should be saved as draft. Defaults to false and overrides send_notification */ + draft?: boolean; + /** Set to true to create a draft invoice (adds an auto incrementing invoice number if none is provided) even if there are no line_items or tax passed */ + has_invoice?: boolean; + /** Numeric value of invoice. Invoice will start from 1 and auto increment from there. This field is to help override whatever value Paystack decides. Auto increment for subsequent invoices continue from this point. */ + invoice_number?: number; + /** The split code of the transaction split. */ + split_code?: string; +} diff --git a/src/models/payment-request-update-data.ts b/src/models/payment-request-update-data.ts new file mode 100644 index 0000000..b39adeb --- /dev/null +++ b/src/models/payment-request-update-data.ts @@ -0,0 +1,48 @@ +export interface PaymentRequestUpdateData { + /** */ + id: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + due_date: string; + /** */ + has_invoice: boolean; + /** */ + invoice_number: number; + /** */ + description: unknown; + /** */ + pdf_url: string; + /** */ + line_items: Array; + /** */ + tax: Array; + /** */ + request_code: string; + /** */ + status: string; + /** */ + paid: boolean; + /** */ + paid_at: unknown; + /** */ + metadata: unknown; + /** */ + notifications: Array<{ sent_at: string; channel: string }>; + /** */ + offline_reference: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: { calling_code?: string }; risk_action: string; international_format_phone: string }; + /** */ + created_at: string; + /** */ + discount: unknown; + /** */ + split_code: unknown; +} diff --git a/src/models/payment-request-verify-data.ts b/src/models/payment-request-verify-data.ts new file mode 100644 index 0000000..719a14a --- /dev/null +++ b/src/models/payment-request-verify-data.ts @@ -0,0 +1,50 @@ +export interface PaymentRequestVerifyData { + /** */ + id: number; + /** */ + integration: { key: string; name: string; logo: string; allowed_currencies: Array }; + /** */ + domain: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + due_date: string; + /** */ + has_invoice: boolean; + /** */ + invoice_number: number; + /** */ + description: unknown; + /** */ + pdf_url: string; + /** */ + line_items: Array; + /** */ + tax: Array; + /** */ + request_code: string; + /** */ + status: string; + /** */ + paid: boolean; + /** */ + paid_at: unknown; + /** */ + metadata: unknown; + /** */ + notifications: Array<{ sent_at: string; channel: string }>; + /** */ + offline_reference: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: { calling_code?: string }; risk_action: string; international_format_phone: string }; + /** */ + created_at: string; + /** */ + discount: unknown; + /** */ + split_code: unknown; + /** */ + pending_amount: number; +} diff --git a/src/models/plan-create-body.ts b/src/models/plan-create-body.ts new file mode 100644 index 0000000..e92e582 --- /dev/null +++ b/src/models/plan-create-body.ts @@ -0,0 +1,19 @@ +export interface PlanCreateBody { + /** Name of plan */ + name: string; + /** Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR */ + amount: number; + /** Payment interval */ + interval: "daily" | "weekly" | "monthly" | "biannually" | "annually"; + /** A description for this plan */ + description?: string; + /** Set to false if you don't want invoices to be sent to your customers */ + send_invoices?: boolean; + /** Set to false if you don't want text messages to be sent to your customers */ + send_sms?: boolean; + /** Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD */ + currency?: string; + /** Number of invoices to raise during subscription to this plan. +Can be overridden by specifying an invoice_limit while subscribing. */ + invoice_limit?: number; +} diff --git a/src/models/plan-create-data.ts b/src/models/plan-create-data.ts new file mode 100644 index 0000000..9588554 --- /dev/null +++ b/src/models/plan-create-data.ts @@ -0,0 +1,34 @@ +export interface PlanCreateData { + /** */ + currency: string; + /** */ + name: string; + /** */ + amount: number; + /** */ + interval: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + plan_code: string; + /** */ + invoice_limit: number; + /** */ + send_invoices: boolean; + /** */ + send_sms: boolean; + /** */ + hosted_page: boolean; + /** */ + migrate: boolean; + /** */ + is_archived: boolean; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/plan-fetch-data.ts b/src/models/plan-fetch-data.ts new file mode 100644 index 0000000..e5614cd --- /dev/null +++ b/src/models/plan-fetch-data.ts @@ -0,0 +1,58 @@ +export interface PlanFetchData { + /** */ + subscriptions: Array; + /** */ + pages: Array; + /** */ + domain: string; + /** */ + name: string; + /** */ + plan_code: string; + /** */ + description: unknown; + /** */ + amount: number; + /** */ + interval: string; + /** */ + invoice_limit: number; + /** */ + send_invoices: boolean; + /** */ + send_sms: boolean; + /** */ + hosted_page: boolean; + /** */ + hosted_page_url: unknown; + /** */ + hosted_page_summary: unknown; + /** */ + currency: string; + /** */ + migrate: boolean; + /** */ + is_deleted: boolean; + /** */ + is_archived: boolean; + /** */ + id: number; + /** */ + integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + pages_count: number; + /** */ + subscribers_count: number; + /** */ + subscriptions_count: number; + /** */ + active_subscriptions_count: number; + /** */ + total_revenue: number; + /** */ + subscribers: Array; +} diff --git a/src/models/plan-list-data.ts b/src/models/plan-list-data.ts new file mode 100644 index 0000000..f4aca2b --- /dev/null +++ b/src/models/plan-list-data.ts @@ -0,0 +1,2 @@ +export interface PlanListData { +} diff --git a/src/models/plan-list-query.ts b/src/models/plan-list-query.ts new file mode 100644 index 0000000..bda8617 --- /dev/null +++ b/src/models/plan-list-query.ts @@ -0,0 +1,14 @@ +export interface PlanListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** Specify interval of the plan */ + interval?: "daily" | "weekly" | "monthly" | "biannually" | "annually"; + /** The amount on the plans to retrieve */ + amount?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/plan-update-body.ts b/src/models/plan-update-body.ts new file mode 100644 index 0000000..29e93a1 --- /dev/null +++ b/src/models/plan-update-body.ts @@ -0,0 +1,19 @@ +export interface PlanUpdateBody { + /** Name of plan */ + name?: string; + /** Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR */ + amount?: number; + /** Payment interval */ + interval?: "daily" | "weekly" | "monthly" | "biannually" | "annually"; + /** A description for this plan */ + description?: boolean; + /** Set to false if you don't want invoices to be sent to your customers */ + send_invoices?: boolean; + /** Set to false if you don't want text messages to be sent to your customers */ + send_sms?: boolean; + /** Currency in which amount is set. Allowed values are NGN, GHS, ZAR or USD */ + currency?: string; + /** Number of invoices to raise during subscription to this plan. +Can be overridden by specifying an invoice_limit while subscribing. */ + invoice_limit?: number; +} diff --git a/src/models/product-create-body.ts b/src/models/product-create-body.ts new file mode 100644 index 0000000..ee00fc2 --- /dev/null +++ b/src/models/product-create-body.ts @@ -0,0 +1,23 @@ +export interface ProductCreateBody { + /** Name of product */ + name: string; + /** The description of the product */ + description: string; + /** Price should be in kobo if currency is NGN, pesewas, if currency is GHS, +and cents, if currency is ZAR + */ + price: number; + /** Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD + */ + currency: string; + /** Set to true if the product has unlimited stock. Leave as false if the +product has limited stock + */ + unlimited?: boolean; + /** Number of products in stock. Use if limited is true */ + quantity?: number; + /** The split code if sharing the transaction with partners */ + split_code?: string; + /** Stringified JSON object of custom data */ + metadata?: string; +} diff --git a/src/models/product-create-data.ts b/src/models/product-create-data.ts new file mode 100644 index 0000000..0f2d46c --- /dev/null +++ b/src/models/product-create-data.ts @@ -0,0 +1,58 @@ +export interface ProductCreateData { + /** */ + variants_options: Array; + /** */ + variants: Array; + /** */ + name: string; + /** */ + description: string; + /** */ + currency: string; + /** */ + price: number; + /** */ + quantity: number; + /** */ + type: string; + /** */ + is_shippable: boolean; + /** */ + unlimited: boolean; + /** */ + files: Array; + /** */ + shipping_fields: { delivery_note: string; shipping_address: string; shipping_fees: Array }; + /** */ + integration: number; + /** */ + domain: string; + /** */ + metadata: { background_color: string }; + /** */ + slug: string; + /** */ + product_code: string; + /** */ + quantity_sold: number; + /** */ + active: boolean; + /** */ + deleted_at: unknown; + /** */ + in_stock: boolean; + /** */ + minimum_orderable: number; + /** */ + maximum_orderable: number; + /** */ + redirect_url?: string; + /** */ + low_stock_alert: boolean; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/product-fetch-data.ts b/src/models/product-fetch-data.ts new file mode 100644 index 0000000..abb46a4 --- /dev/null +++ b/src/models/product-fetch-data.ts @@ -0,0 +1,68 @@ +export interface ProductFetchData { + /** */ + digital_assets: Array; + /** */ + integration: number; + /** */ + name: string; + /** */ + description: string; + /** */ + product_code: string; + /** */ + price: number; + /** */ + currency: string; + /** */ + quantity: number; + /** */ + quantity_sold: unknown; + /** */ + type: string; + /** */ + files: Array; + /** */ + file_path: unknown; + /** */ + is_shippable: boolean; + /** */ + shipping_fields: { delivery_note: string; shipping_address: string; shipping_fees: Array }; + /** */ + unlimited: boolean; + /** */ + domain: string; + /** */ + active: boolean; + /** */ + features: unknown; + /** */ + in_stock: boolean; + /** */ + metadata: { background_color: string }; + /** */ + slug: string; + /** */ + success_message: unknown; + /** */ + redirect_url: unknown; + /** */ + split_code: unknown; + /** */ + notification_emails: unknown; + /** */ + minimum_orderable: number; + /** */ + maximum_orderable: unknown; + /** */ + low_stock_alert: boolean; + /** */ + stock_threshold: unknown; + /** */ + expires_in: unknown; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/product-list-data.ts b/src/models/product-list-data.ts new file mode 100644 index 0000000..795f81e --- /dev/null +++ b/src/models/product-list-data.ts @@ -0,0 +1,2 @@ +export interface ProductListData { +} diff --git a/src/models/product-list-query.ts b/src/models/product-list-query.ts new file mode 100644 index 0000000..f1af5b4 --- /dev/null +++ b/src/models/product-list-query.ts @@ -0,0 +1,12 @@ +export interface ProductListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** The state of the product */ + active?: boolean; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/product-update-body.ts b/src/models/product-update-body.ts new file mode 100644 index 0000000..d5abaaa --- /dev/null +++ b/src/models/product-update-body.ts @@ -0,0 +1,23 @@ +export interface ProductUpdateBody { + /** Name of product */ + name?: string; + /** The description of the product */ + description?: string; + /** Price should be in kobo if currency is NGN, pesewas, if currency is GHS, +and cents, if currency is ZAR + */ + price?: number; + /** Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD + */ + currency?: string; + /** Set to true if the product has unlimited stock. Leave as false if the +product has limited stock + */ + unlimited?: boolean; + /** Number of products in stock. Use if limited is true */ + quantity?: number; + /** The split code if sharing the transaction with partners */ + split_code?: string; + /** JSON object of custom data */ + metadata?: Record; +} diff --git a/src/models/product-update-data.ts b/src/models/product-update-data.ts new file mode 100644 index 0000000..4864b6e --- /dev/null +++ b/src/models/product-update-data.ts @@ -0,0 +1,66 @@ +export interface ProductUpdateData { + /** */ + name: string; + /** */ + description: string; + /** */ + product_code: string; + /** */ + price: number; + /** */ + currency: string; + /** */ + quantity: number; + /** */ + quantity_sold: number; + /** */ + type: string; + /** */ + files: Array; + /** */ + file_path: unknown; + /** */ + is_shippable: boolean; + /** */ + shipping_fields: { delivery_note: string; shipping_address: string; shipping_fees: Array }; + /** */ + unlimited: boolean; + /** */ + domain: string; + /** */ + active: boolean; + /** */ + features: unknown; + /** */ + in_stock: boolean; + /** */ + metadata: { background_color: string }; + /** */ + slug: string; + /** */ + success_message: unknown; + /** */ + redirect_url: unknown; + /** */ + split_code: unknown; + /** */ + notification_emails: unknown; + /** */ + minimum_orderable: number; + /** */ + maximum_orderable: unknown; + /** */ + low_stock_alert: boolean; + /** */ + stock_threshold: unknown; + /** */ + expires_in: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/refund-create-body.ts b/src/models/refund-create-body.ts new file mode 100644 index 0000000..cfe96c0 --- /dev/null +++ b/src/models/refund-create-body.ts @@ -0,0 +1,12 @@ +export interface RefundCreateBody { + /** The reference of a previosuly completed transaction */ + transaction: string; + /** Amount to be refunded to the customer. It cannot be more than the original transaction amount */ + amount?: number; + /** Three-letter ISO currency */ + currency?: "GHS" | "KES" | "NGN" | "USD" | "ZAR"; + /** Customer reason */ + customer_note?: string; + /** Merchant reason */ + merchant_note?: string; +} diff --git a/src/models/refund-create-data.ts b/src/models/refund-create-data.ts new file mode 100644 index 0000000..11fc13b --- /dev/null +++ b/src/models/refund-create-data.ts @@ -0,0 +1,34 @@ +export interface RefundCreateData { + /** */ + transaction: { id: number; domain: string; reference: string; amount: number; paid_at: string; channel: string; currency: string; authorization: { exp_month: unknown; exp_year: unknown; account_name: unknown }; customer: { international_format_phone: string }; plan: Record; subaccount: { currency: unknown }; split: Record; order_id: unknown; paidAt: string; pos_transaction_data: unknown; source: unknown; fees_breakdown: unknown }; + /** */ + integration: number; + /** */ + deducted_amount: number; + /** */ + channel: unknown; + /** */ + merchant_note: string; + /** */ + customer_note: string; + /** */ + status: string; + /** */ + refunded_by: string; + /** */ + expected_at: string; + /** */ + currency: string; + /** */ + domain: string; + /** */ + amount: number; + /** */ + fully_deducted: boolean; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/refund-fetch-data.ts b/src/models/refund-fetch-data.ts new file mode 100644 index 0000000..d3e2855 --- /dev/null +++ b/src/models/refund-fetch-data.ts @@ -0,0 +1,54 @@ +export interface RefundFetchData { + /** */ + integration: number; + /** */ + transaction: number; + /** */ + dispute: unknown; + /** */ + settlement: unknown; + /** */ + id: number; + /** */ + domain: string; + /** */ + currency: string; + /** */ + amount: number; + /** */ + status: string; + /** */ + refunded_at: unknown; + /** */ + refunded_by: string; + /** */ + customer_note: string; + /** */ + merchant_note: string; + /** */ + deducted_amount: number; + /** */ + fully_deducted: number; + /** */ + createdAt: string; + /** */ + bank_reference: unknown; + /** */ + transaction_reference: string; + /** */ + reason: string; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: string; risk_action: string; international_format_phone: string }; + /** */ + refund_type: string; + /** */ + transaction_amount: number; + /** */ + initiated_by: string; + /** */ + refund_channel: string; + /** */ + session_id: unknown; + /** */ + collect_account_number: boolean; +} diff --git a/src/models/refund-list-data.ts b/src/models/refund-list-data.ts new file mode 100644 index 0000000..1f63bb9 --- /dev/null +++ b/src/models/refund-list-data.ts @@ -0,0 +1,2 @@ +export interface RefundListData { +} diff --git a/src/models/refund-list-query.ts b/src/models/refund-list-query.ts new file mode 100644 index 0000000..d70b8b1 --- /dev/null +++ b/src/models/refund-list-query.ts @@ -0,0 +1,10 @@ +export interface RefundListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/refund-retry-body.ts b/src/models/refund-retry-body.ts new file mode 100644 index 0000000..3f6bc64 --- /dev/null +++ b/src/models/refund-retry-body.ts @@ -0,0 +1,4 @@ +export interface RefundRetryBody { + /** An object that contains the customer’s account details for refund */ + refund_account_details: { currency: string; account_number: string; bank_id: string }; +} diff --git a/src/models/refund-retry-data.ts b/src/models/refund-retry-data.ts new file mode 100644 index 0000000..da0e108 --- /dev/null +++ b/src/models/refund-retry-data.ts @@ -0,0 +1,48 @@ +export interface RefundRetryData { + /** */ + integration: number; + /** */ + transaction: number; + /** */ + dispute: Record; + /** */ + settlement: Record; + /** */ + id: number; + /** */ + domain: string; + /** */ + currency: string; + /** */ + amount: number; + /** */ + status: string; + /** */ + refunded_at: string; + /** */ + expected_at: string; + /** */ + channel: string; + /** */ + refunded_by: string; + /** */ + customer_note: string; + /** */ + merchant_note: string; + /** */ + deducted_amount: number; + /** */ + fully_deducted: boolean; + /** */ + bank_reference: string; + /** */ + reason: string; + /** */ + customer: Record; + /** */ + initiated_by: string; + /** */ + reversed_at: string; + /** */ + session_id: string; +} diff --git a/src/models/settlement-settlements-fetch-data.ts b/src/models/settlement-settlements-fetch-data.ts new file mode 100644 index 0000000..95b6a2c --- /dev/null +++ b/src/models/settlement-settlements-fetch-data.ts @@ -0,0 +1,2 @@ +export interface SettlementSettlementsFetchData { +} diff --git a/src/models/settlement-settlements-fetch-query.ts b/src/models/settlement-settlements-fetch-query.ts new file mode 100644 index 0000000..a9eb6d3 --- /dev/null +++ b/src/models/settlement-settlements-fetch-query.ts @@ -0,0 +1,6 @@ +export interface SettlementSettlementsFetchQuery { + /** The number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; +} diff --git a/src/models/settlement-settlements-transaction-data.ts b/src/models/settlement-settlements-transaction-data.ts new file mode 100644 index 0000000..bd6e0ef --- /dev/null +++ b/src/models/settlement-settlements-transaction-data.ts @@ -0,0 +1,2 @@ +export interface SettlementSettlementsTransactionData { +} diff --git a/src/models/split-add-subaccount-body.ts b/src/models/split-add-subaccount-body.ts new file mode 100644 index 0000000..d5cd89d --- /dev/null +++ b/src/models/split-add-subaccount-body.ts @@ -0,0 +1,6 @@ +export interface SplitAddSubaccountBody { + /** Subaccount code of the customer or partner */ + subaccount?: string; + /** The percentage or flat quota of the customer or partner */ + share?: number; +} diff --git a/src/models/split-add-subaccount-data.ts b/src/models/split-add-subaccount-data.ts new file mode 100644 index 0000000..c74f9b6 --- /dev/null +++ b/src/models/split-add-subaccount-data.ts @@ -0,0 +1,32 @@ +export interface SplitAddSubaccountData { + /** */ + id: number; + /** */ + name: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + split_code: string; + /** */ + active: boolean; + /** */ + bearer_type: string; + /** */ + bearer_subaccount: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + is_dynamic: boolean; + /** */ + subaccounts: Array<{ subaccount: { id: number; subaccount_code: string; business_name: string; description: string; primary_contact_name: string; primary_contact_email: string; primary_contact_phone: string; metadata: string; settlement_bank: string; currency: string; account_number: string }; share: number }>; + /** */ + total_subaccounts: number; +} diff --git a/src/models/split-create-body.ts b/src/models/split-create-body.ts new file mode 100644 index 0000000..93c9dca --- /dev/null +++ b/src/models/split-create-body.ts @@ -0,0 +1,14 @@ +export interface SplitCreateBody { + /** Name of the transaction split */ + name: string; + /** The type of transaction split you want to create. */ + type: "percentage" | "flat"; + /** A list of object containing subaccount code and number of shares */ + subaccounts: Array<{ subaccount?: string; share?: number }>; + /** The transaction currency */ + currency: "NGN" | "GHS" | "ZAR" | "USD"; + /** This allows you specify how the transaction charge should be processed */ + bearer_type?: "subaccount" | "account" | "all-proportional" | "all"; + /** This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type */ + bearer_subaccount?: string; +} diff --git a/src/models/split-create-data.ts b/src/models/split-create-data.ts new file mode 100644 index 0000000..d056da0 --- /dev/null +++ b/src/models/split-create-data.ts @@ -0,0 +1,32 @@ +export interface SplitCreateData { + /** */ + id: number; + /** */ + name: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + split_code: string; + /** */ + active: boolean; + /** */ + bearer_type: string; + /** */ + bearer_subaccount?: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + is_dynamic: boolean; + /** */ + subaccounts: Array<{ subaccount: { id: number; subaccount_code: string; business_name: string; description: string; primary_contact_name: string; primary_contact_email: string; primary_contact_phone: string; metadata: string; settlement_bank: string; currency: string; account_number: string }; share: number }>; + /** */ + total_subaccounts: number; +} diff --git a/src/models/split-fetch-data.ts b/src/models/split-fetch-data.ts new file mode 100644 index 0000000..f371fad --- /dev/null +++ b/src/models/split-fetch-data.ts @@ -0,0 +1,32 @@ +export interface SplitFetchData { + /** */ + id: number; + /** */ + name: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + split_code: string; + /** */ + active: boolean; + /** */ + bearer_type: string; + /** */ + bearer_subaccount: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + is_dynamic: boolean; + /** */ + subaccounts: Array<{ subaccount: { id: number; subaccount_code: string; business_name: string; description: string; primary_contact_name: string; primary_contact_email: string; primary_contact_phone: string; metadata: string; settlement_bank: string; currency: string; account_number: string }; share: number }>; + /** */ + total_subaccounts: number; +} diff --git a/src/models/split-list-data.ts b/src/models/split-list-data.ts new file mode 100644 index 0000000..c80a906 --- /dev/null +++ b/src/models/split-list-data.ts @@ -0,0 +1,2 @@ +export interface SplitListData { +} diff --git a/src/models/split-list-query.ts b/src/models/split-list-query.ts new file mode 100644 index 0000000..17b8a55 --- /dev/null +++ b/src/models/split-list-query.ts @@ -0,0 +1,16 @@ +export interface SplitListQuery { + /** Filter by subaccount code */ + subaccount_code?: string; + /** The name of the split */ + name?: string; + /** The status of the split */ + active?: boolean; + /** The number of records to fetch per request */ + per_page?: number; + /** The offset to retrieve data from */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/split-remove-subaccount-body.ts b/src/models/split-remove-subaccount-body.ts new file mode 100644 index 0000000..eaae484 --- /dev/null +++ b/src/models/split-remove-subaccount-body.ts @@ -0,0 +1,6 @@ +export interface SplitRemoveSubaccountBody { + /** Subaccount code of the customer or partner */ + subaccount?: string; + /** The percentage or flat quota of the customer or partner */ + share?: number; +} diff --git a/src/models/split-update-body.ts b/src/models/split-update-body.ts new file mode 100644 index 0000000..4c113ac --- /dev/null +++ b/src/models/split-update-body.ts @@ -0,0 +1,10 @@ +export interface SplitUpdateBody { + /** Name of the transaction split */ + name?: string; + /** Toggle status of split. When true, the split is active, else it's inactive */ + active?: boolean; + /** This allows you specify how the transaction charge should be processed */ + bearer_type?: "subaccount" | "account" | "all-proportional" | "all"; + /** This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type */ + bearer_subaccount?: string; +} diff --git a/src/models/split-update-data.ts b/src/models/split-update-data.ts new file mode 100644 index 0000000..a77f790 --- /dev/null +++ b/src/models/split-update-data.ts @@ -0,0 +1,32 @@ +export interface SplitUpdateData { + /** */ + id: number; + /** */ + name: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + split_code: string; + /** */ + active: boolean; + /** */ + bearer_type: string; + /** */ + bearer_subaccount: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + is_dynamic: boolean; + /** */ + subaccounts: Array<{ subaccount: { id: number; subaccount_code: string; business_name: string; description: string; primary_contact_name: string; primary_contact_email: string; primary_contact_phone: string; metadata: string; settlement_bank: string; currency: string; account_number: string }; share: number }>; + /** */ + total_subaccounts: number; +} diff --git a/src/models/storefront-add-products-body.ts b/src/models/storefront-add-products-body.ts new file mode 100644 index 0000000..430d5ec --- /dev/null +++ b/src/models/storefront-add-products-body.ts @@ -0,0 +1,4 @@ +export interface StorefrontAddProductsBody { + /** An array of product IDs */ + products: Array; +} diff --git a/src/models/storefront-add-products-data.ts b/src/models/storefront-add-products-data.ts new file mode 100644 index 0000000..068e4fa --- /dev/null +++ b/src/models/storefront-add-products-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontAddProductsData { +} diff --git a/src/models/storefront-create-body.ts b/src/models/storefront-create-body.ts new file mode 100644 index 0000000..c70d2da --- /dev/null +++ b/src/models/storefront-create-body.ts @@ -0,0 +1,11 @@ +export interface StorefrontCreateBody { + /** Name of the storefront */ + name: string; + /** A unique identifier to access your store. Once the storefront is created, it can be accessed from https://paystack.shop/your-slug + */ + slug: string; + /** Currency for prices of products in your storefront. */ + currency: "GHS" | "KES" | "NGN" | "USD" | "ZAR"; + /** The description of the storefront */ + description?: string; +} diff --git a/src/models/storefront-create-data.ts b/src/models/storefront-create-data.ts new file mode 100644 index 0000000..5a863d9 --- /dev/null +++ b/src/models/storefront-create-data.ts @@ -0,0 +1,46 @@ +export interface StorefrontCreateData { + /** */ + social_media: Array; + /** */ + contacts: Array<{ value: string; id: number; type_name: unknown; type: number }>; + /** */ + name: string; + /** */ + slug: string; + /** */ + currency: string; + /** */ + welcome_message: unknown; + /** */ + success_message: unknown; + /** */ + redirect_url: unknown; + /** */ + description: unknown; + /** */ + delivery_note: string; + /** */ + background_color: string; + /** */ + status: string; + /** */ + shippable: boolean; + /** */ + integration: number; + /** */ + domain: string; + /** */ + digital_product_expiry: unknown; + /** */ + metadata?: Record; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + products: Array; + /** */ + shipping_fees: Array; +} diff --git a/src/models/storefront-duplicate-data.ts b/src/models/storefront-duplicate-data.ts new file mode 100644 index 0000000..77ef984 --- /dev/null +++ b/src/models/storefront-duplicate-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontDuplicateData { +} diff --git a/src/models/storefront-fetch-data.ts b/src/models/storefront-fetch-data.ts new file mode 100644 index 0000000..ff481a7 --- /dev/null +++ b/src/models/storefront-fetch-data.ts @@ -0,0 +1,46 @@ +export interface StorefrontFetchData { + /** */ + social_media: Array; + /** */ + contacts: Array<{ value: string; id: number; type_name: unknown; type: number }>; + /** */ + name: string; + /** */ + slug: string; + /** */ + currency: string; + /** */ + welcome_message: unknown; + /** */ + success_message: unknown; + /** */ + redirect_url: unknown; + /** */ + description: unknown; + /** */ + delivery_note: string; + /** */ + background_color: string; + /** */ + status: string; + /** */ + shippable: boolean; + /** */ + integration: number; + /** */ + domain: string; + /** */ + digital_product_expiry: unknown; + /** */ + metadata?: Record; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + products: Array; + /** */ + shipping_fees: Array; +} diff --git a/src/models/storefront-fetch-orders-data.ts b/src/models/storefront-fetch-orders-data.ts new file mode 100644 index 0000000..aeb38fd --- /dev/null +++ b/src/models/storefront-fetch-orders-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontFetchOrdersData { +} diff --git a/src/models/storefront-list-data.ts b/src/models/storefront-list-data.ts new file mode 100644 index 0000000..aff948f --- /dev/null +++ b/src/models/storefront-list-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontListData { +} diff --git a/src/models/storefront-list-products-data.ts b/src/models/storefront-list-products-data.ts new file mode 100644 index 0000000..e4e0826 --- /dev/null +++ b/src/models/storefront-list-products-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontListProductsData { +} diff --git a/src/models/storefront-list-query.ts b/src/models/storefront-list-query.ts new file mode 100644 index 0000000..b6e56cb --- /dev/null +++ b/src/models/storefront-list-query.ts @@ -0,0 +1,8 @@ +export interface StorefrontListQuery { + /** Number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; + /** */ + status?: "active" | "inactive"; +} diff --git a/src/models/storefront-publish-data.ts b/src/models/storefront-publish-data.ts new file mode 100644 index 0000000..466b5ae --- /dev/null +++ b/src/models/storefront-publish-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontPublishData { +} diff --git a/src/models/storefront-update-body.ts b/src/models/storefront-update-body.ts new file mode 100644 index 0000000..f3ae7ce --- /dev/null +++ b/src/models/storefront-update-body.ts @@ -0,0 +1,10 @@ +export interface StorefrontUpdateBody { + /** Name of the storefront */ + name?: string; + /** A unique identifier to access your store. Once the storefront is created, it can be accessed from +https://paystack.shop/your-slug + */ + slug?: string; + /** The description of the storefront */ + description?: string; +} diff --git a/src/models/storefront-verify-slug-data.ts b/src/models/storefront-verify-slug-data.ts new file mode 100644 index 0000000..9d71a5e --- /dev/null +++ b/src/models/storefront-verify-slug-data.ts @@ -0,0 +1,2 @@ +export interface StorefrontVerifySlugData { +} diff --git a/src/models/subaccount-create-body.ts b/src/models/subaccount-create-body.ts new file mode 100644 index 0000000..97fdeb0 --- /dev/null +++ b/src/models/subaccount-create-body.ts @@ -0,0 +1,20 @@ +export interface SubaccountCreateBody { + /** Name of business for subaccount */ + business_name: string; + /** Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. */ + settlement_bank: string; + /** Bank account number */ + account_number: string; + /** Customer's phone number */ + percentage_charge: number; + /** A description for this subaccount */ + description?: string; + /** A contact email for the subaccount */ + primary_contact_email?: string; + /** The name of the contact person for this subaccount */ + primary_contact_name?: string; + /** A phone number to call for this subaccount */ + primary_contact_phone?: string; + /** Stringified JSON object of custom data */ + metadata?: string; +} diff --git a/src/models/subaccount-create-data.ts b/src/models/subaccount-create-data.ts new file mode 100644 index 0000000..934ae90 --- /dev/null +++ b/src/models/subaccount-create-data.ts @@ -0,0 +1,50 @@ +export interface SubaccountCreateData { + /** */ + business_name: string; + /** */ + account_name?: string; + /** */ + description: string; + /** */ + primary_contact_name: string; + /** */ + primary_contact_email: string; + /** */ + primary_contact_phone: string; + /** */ + metadata: string; + /** */ + account_number: string; + /** */ + percentage_charge: number; + /** */ + settlement_bank: string; + /** */ + currency: string; + /** */ + bank: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + product: string; + /** */ + managed_by_integration: number; + /** */ + subaccount_code: string; + /** */ + is_verified: boolean; + /** */ + settlement_schedule: string; + /** */ + active: boolean; + /** */ + migrate: boolean; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/subaccount-fetch-data.ts b/src/models/subaccount-fetch-data.ts new file mode 100644 index 0000000..b0bfcf5 --- /dev/null +++ b/src/models/subaccount-fetch-data.ts @@ -0,0 +1,50 @@ +export interface SubaccountFetchData { + /** */ + integration: number; + /** */ + account_name?: string; + /** */ + bank: number; + /** */ + managed_by_integration: number; + /** */ + domain: string; + /** */ + subaccount_code: string; + /** */ + business_name: string; + /** */ + description: string; + /** */ + primary_contact_name: string; + /** */ + primary_contact_email: string; + /** */ + primary_contact_phone: string; + /** */ + metadata: string; + /** */ + percentage_charge: number; + /** */ + is_verified: boolean; + /** */ + settlement_bank: string; + /** */ + account_number: string; + /** */ + settlement_schedule: string; + /** */ + active: boolean; + /** */ + migrate: boolean; + /** */ + currency: string; + /** */ + product: string; + /** */ + id: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/subaccount-list-data.ts b/src/models/subaccount-list-data.ts new file mode 100644 index 0000000..e5d31c7 --- /dev/null +++ b/src/models/subaccount-list-data.ts @@ -0,0 +1,2 @@ +export interface SubaccountListData { +} diff --git a/src/models/subaccount-list-query.ts b/src/models/subaccount-list-query.ts new file mode 100644 index 0000000..fe0d9ec --- /dev/null +++ b/src/models/subaccount-list-query.ts @@ -0,0 +1,8 @@ +export interface SubaccountListQuery { + /** Number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; + /** Filter by the state of the subaccounts */ + active?: boolean; +} diff --git a/src/models/subaccount-update-body.ts b/src/models/subaccount-update-body.ts new file mode 100644 index 0000000..bd9050a --- /dev/null +++ b/src/models/subaccount-update-body.ts @@ -0,0 +1,22 @@ +export interface SubaccountUpdateBody { + /** Name of business for subaccount */ + business_name?: string; + /** Bank code for the bank. You can get the list of Bank Codes by calling the List Banks endpoint. */ + settlement_bank?: string; + /** Bank account number */ + account_number?: string; + /** Activate or deactivate a subaccount */ + active?: boolean; + /** Customer's phone number */ + percentage_charge?: number; + /** A description for this subaccount */ + description?: string; + /** A contact email for the subaccount */ + primary_contact_email?: string; + /** The name of the contact person for this subaccount */ + primary_contact_name?: string; + /** A phone number to call for this subaccount */ + primary_contact_phone?: string; + /** Stringified JSON object of custom data */ + metadata?: string; +} diff --git a/src/models/subaccount-update-data.ts b/src/models/subaccount-update-data.ts new file mode 100644 index 0000000..0063903 --- /dev/null +++ b/src/models/subaccount-update-data.ts @@ -0,0 +1,50 @@ +export interface SubaccountUpdateData { + /** */ + domain: string; + /** */ + subaccount_code: string; + /** */ + account_name?: string; + /** */ + business_name: string; + /** */ + description: string; + /** */ + primary_contact_name: string; + /** */ + primary_contact_email: string; + /** */ + primary_contact_phone: string; + /** */ + metadata: string; + /** */ + percentage_charge: number; + /** */ + is_verified: boolean; + /** */ + settlement_bank: string; + /** */ + account_number: string; + /** */ + settlement_schedule: string; + /** */ + active: boolean; + /** */ + migrate: boolean; + /** */ + currency: string; + /** */ + product: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + bank: number; + /** */ + managed_by_integration: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/subscription-create-body.ts b/src/models/subscription-create-body.ts new file mode 100644 index 0000000..b719374 --- /dev/null +++ b/src/models/subscription-create-body.ts @@ -0,0 +1,11 @@ +export interface SubscriptionCreateBody { + /** Customer's email address or customer code */ + customer: string; + /** Plan code */ + plan: string; + /** If customer has multiple authorizations, you can set the desired authorization you wish to use for this subscription here. +If this is not supplied, the customer's most recent authorization would be used */ + authorization?: string; + /** Set the date for the first debit. (ISO 8601 format) e.g. 2017-05-16T00:30:13+01:00 */ + start_date?: string; +} diff --git a/src/models/subscription-create-data.ts b/src/models/subscription-create-data.ts new file mode 100644 index 0000000..a0e0855 --- /dev/null +++ b/src/models/subscription-create-data.ts @@ -0,0 +1,46 @@ +export interface SubscriptionCreateData { + /** */ + customer: number; + /** */ + plan: number; + /** */ + integration: number; + /** */ + domain: string; + /** */ + start: number; + /** */ + status: string; + /** */ + quantity: number; + /** */ + amount: number; + /** */ + authorization: number; + /** */ + invoice_limit: number; + /** */ + split_code: unknown; + /** */ + subscription_code: string; + /** */ + email_token: string; + /** */ + id: number; + /** */ + cancelledAt: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + cron_expression: string; + /** */ + next_payment_date: string; + /** */ + easy_cron_id: string; + /** */ + open_invoice: string; + /** */ + metadata: Record; +} diff --git a/src/models/subscription-disable-body.ts b/src/models/subscription-disable-body.ts new file mode 100644 index 0000000..de660e0 --- /dev/null +++ b/src/models/subscription-disable-body.ts @@ -0,0 +1,6 @@ +export interface SubscriptionDisableBody { + /** Subscription code */ + code: string; + /** Email token */ + token: string; +} diff --git a/src/models/subscription-enable-body.ts b/src/models/subscription-enable-body.ts new file mode 100644 index 0000000..ff92014 --- /dev/null +++ b/src/models/subscription-enable-body.ts @@ -0,0 +1,6 @@ +export interface SubscriptionEnableBody { + /** Subscription code */ + code: string; + /** Email token */ + token: string; +} diff --git a/src/models/subscription-enable-data.ts b/src/models/subscription-enable-data.ts new file mode 100644 index 0000000..12989f1 --- /dev/null +++ b/src/models/subscription-enable-data.ts @@ -0,0 +1,2 @@ +export interface SubscriptionEnableData { +} diff --git a/src/models/subscription-fetch-data.ts b/src/models/subscription-fetch-data.ts new file mode 100644 index 0000000..0a38586 --- /dev/null +++ b/src/models/subscription-fetch-data.ts @@ -0,0 +1,46 @@ +export interface SubscriptionFetchData { + /** */ + id: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + subscription_code: string; + /** */ + email_token: string; + /** */ + amount: number; + /** */ + cron_expression: string; + /** */ + next_payment_date: string; + /** */ + open_invoice: unknown; + /** */ + createdAt: string; + /** */ + cancelledAt: unknown; + /** */ + integration: number; + /** */ + plan: { id: number; name: string; plan_code: string; description: unknown; amount: number; interval: string; send_invoices: boolean; send_sms: boolean; currency: string }; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string; account_name: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + invoices: Array; + /** */ + invoices_history: Array; + /** */ + invoice_limit: number; + /** */ + split_code: unknown; + /** */ + most_recent_invoice: unknown; + /** */ + payments_count: number; + /** */ + metadata: Record; +} diff --git a/src/models/subscription-list-data.ts b/src/models/subscription-list-data.ts new file mode 100644 index 0000000..1214977 --- /dev/null +++ b/src/models/subscription-list-data.ts @@ -0,0 +1,2 @@ +export interface SubscriptionListData { +} diff --git a/src/models/subscription-list-query.ts b/src/models/subscription-list-query.ts new file mode 100644 index 0000000..9272340 --- /dev/null +++ b/src/models/subscription-list-query.ts @@ -0,0 +1,14 @@ +export interface SubscriptionListQuery { + /** Number of records to fetch per page */ + perPage?: number; + /** The section to retrieve */ + page?: number; + /** Plan ID */ + plan?: number; + /** Customer ID */ + customer?: string; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/subscription-manage-email-data.ts b/src/models/subscription-manage-email-data.ts new file mode 100644 index 0000000..fb81cbb --- /dev/null +++ b/src/models/subscription-manage-email-data.ts @@ -0,0 +1,2 @@ +export interface SubscriptionManageEmailData { +} diff --git a/src/models/subscription-manage-link-data.ts b/src/models/subscription-manage-link-data.ts new file mode 100644 index 0000000..7329e03 --- /dev/null +++ b/src/models/subscription-manage-link-data.ts @@ -0,0 +1,2 @@ +export interface SubscriptionManageLinkData { +} diff --git a/src/models/terminal-commission-body.ts b/src/models/terminal-commission-body.ts new file mode 100644 index 0000000..c9c8f0a --- /dev/null +++ b/src/models/terminal-commission-body.ts @@ -0,0 +1,4 @@ +export interface TerminalCommissionBody { + /** Device Serial Number */ + serial_number: string; +} diff --git a/src/models/terminal-decommission-body.ts b/src/models/terminal-decommission-body.ts new file mode 100644 index 0000000..bc6a02c --- /dev/null +++ b/src/models/terminal-decommission-body.ts @@ -0,0 +1,4 @@ +export interface TerminalDecommissionBody { + /** Device Serial Number */ + serial_number: string; +} diff --git a/src/models/terminal-fetch-data.ts b/src/models/terminal-fetch-data.ts new file mode 100644 index 0000000..062f11a --- /dev/null +++ b/src/models/terminal-fetch-data.ts @@ -0,0 +1,22 @@ +export interface TerminalFetchData { + /** */ + id: number; + /** */ + serial_number: string; + /** */ + device_make: string; + /** */ + terminal_id: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + name: string; + /** */ + address: string; + /** */ + status: string; + /** */ + split_code: string; +} diff --git a/src/models/terminal-fetch-event-status-data.ts b/src/models/terminal-fetch-event-status-data.ts new file mode 100644 index 0000000..dc8411e --- /dev/null +++ b/src/models/terminal-fetch-event-status-data.ts @@ -0,0 +1,2 @@ +export interface TerminalFetchEventStatusData { +} diff --git a/src/models/terminal-fetch-terminal-status-data.ts b/src/models/terminal-fetch-terminal-status-data.ts new file mode 100644 index 0000000..54c5c48 --- /dev/null +++ b/src/models/terminal-fetch-terminal-status-data.ts @@ -0,0 +1,6 @@ +export interface TerminalFetchTerminalStatusData { + /** */ + online: boolean; + /** */ + available: boolean; +} diff --git a/src/models/terminal-list-data.ts b/src/models/terminal-list-data.ts new file mode 100644 index 0000000..838ec0a --- /dev/null +++ b/src/models/terminal-list-data.ts @@ -0,0 +1,2 @@ +export interface TerminalListData { +} diff --git a/src/models/terminal-list-query.ts b/src/models/terminal-list-query.ts new file mode 100644 index 0000000..7f39521 --- /dev/null +++ b/src/models/terminal-list-query.ts @@ -0,0 +1,8 @@ +export interface TerminalListQuery { + /** A cursor that indicates your place in the list. It can be used to fetch the next page of the list */ + next?: string; + /** A cursor that indicates your place in the list. It should be used to fetch the previous page of the list after an intial next request */ + previous?: string; + /** Specify how many records you want to retrieve per page */ + per_page?: number; +} diff --git a/src/models/terminal-send-event-body.ts b/src/models/terminal-send-event-body.ts new file mode 100644 index 0000000..c7096cc --- /dev/null +++ b/src/models/terminal-send-event-body.ts @@ -0,0 +1,10 @@ +export interface TerminalSendEventBody { + /** The type of event to push */ + type?: "invoice" | "transaction"; + /** The action the Terminal needs to perform. For the invoice type, the action can either be process or view. +For the transaction type, the action can either be process or print. + */ + action?: "process" | "view" | "print"; + /** The parameters needed to perform the specified action */ + data?: { id?: number; reference?: string }; +} diff --git a/src/models/terminal-send-event-data.ts b/src/models/terminal-send-event-data.ts new file mode 100644 index 0000000..f2f816b --- /dev/null +++ b/src/models/terminal-send-event-data.ts @@ -0,0 +1,2 @@ +export interface TerminalSendEventData { +} diff --git a/src/models/terminal-update-body.ts b/src/models/terminal-update-body.ts new file mode 100644 index 0000000..4fd9a26 --- /dev/null +++ b/src/models/terminal-update-body.ts @@ -0,0 +1,6 @@ +export interface TerminalUpdateBody { + /** The new name for the Terminal */ + name?: string; + /** The new address for the Terminal */ + address?: string; +} diff --git a/src/models/transaction-charge-authorization-body.ts b/src/models/transaction-charge-authorization-body.ts new file mode 100644 index 0000000..2a62c25 --- /dev/null +++ b/src/models/transaction-charge-authorization-body.ts @@ -0,0 +1,28 @@ +export interface TransactionChargeAuthorizationBody { + /** Customer's email address */ + email: string; + /** Amount in the lower denomination of your currency */ + amount: number; + /** Valid authorization code to charge */ + authorization_code: string; + /** Unique transaction reference. Only -, ., = and alphanumeric characters allowed. */ + reference?: string; + /** List of all support currencies */ + currency?: "GHS" | "KES" | "NGN" | "ZAR" | "USD"; + /** The split code of the transaction split */ + split_code?: string; + /** Split configuration for transactions + */ + split?: { name: string; type: "percentage" | "flat"; subaccounts: Array<{ subaccount?: string; share?: number }>; currency: "NGN" | "GHS" | "ZAR" | "USD"; bearer_type?: "subaccount" | "account" | "all-proportional" | "all"; bearer_subaccount?: string }; + /** The code for the subaccount that owns the payment */ + subaccount?: string; + /** A flat fee to charge the subaccount for a transaction. +This overrides the split percentage set when the subaccount was created */ + transaction_charge?: string; + /** The bearer of the transaction charge */ + bearer?: "account" | "subaccount"; + /** Stringified JSON object of custom data */ + metadata?: string; + /** If you are making a scheduled charge call, it is a good idea to queue them so the processing system does not get overloaded causing transaction processing errors. */ + queue?: boolean; +} diff --git a/src/models/transaction-charge-authorization-data.ts b/src/models/transaction-charge-authorization-data.ts new file mode 100644 index 0000000..fe3f73b --- /dev/null +++ b/src/models/transaction-charge-authorization-data.ts @@ -0,0 +1,36 @@ +export interface TransactionChargeAuthorizationData { + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + status: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + metadata: string; + /** */ + gateway_response: string; + /** */ + message: string; + /** */ + channel: string; + /** */ + ip_address: unknown; + /** */ + log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string; account_name: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: { calling_code?: string }; risk_action: string; international_format_phone: string }; + /** */ + plan: unknown; + /** */ + id: number; +} diff --git a/src/models/transaction-export-data.ts b/src/models/transaction-export-data.ts new file mode 100644 index 0000000..0196e49 --- /dev/null +++ b/src/models/transaction-export-data.ts @@ -0,0 +1,6 @@ +export interface TransactionExportData { + /** */ + path: string; + /** */ + expiresAt: string; +} diff --git a/src/models/transaction-export-query.ts b/src/models/transaction-export-query.ts new file mode 100644 index 0000000..6c1839e --- /dev/null +++ b/src/models/transaction-export-query.ts @@ -0,0 +1,14 @@ +export interface TransactionExportQuery { + /** The start date */ + from?: string; + /** The end date */ + to?: string; + /** Filter by the status of the transaction */ + status?: "success" | "failed" | "abandoned" | "reversed" | "all"; + /** Filter by customer ID */ + customer?: number; + /** Filter by subaccount code */ + subaccount_code?: string; + /** Filter by the settlement ID */ + settlement?: number; +} diff --git a/src/models/transaction-fetch-data.ts b/src/models/transaction-fetch-data.ts new file mode 100644 index 0000000..245f92c --- /dev/null +++ b/src/models/transaction-fetch-data.ts @@ -0,0 +1,64 @@ +export interface TransactionFetchData { + /** */ + id: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + reference: string; + /** */ + receipt_number: unknown; + /** */ + amount: number; + /** */ + message: unknown; + /** */ + gateway_response: string; + /** */ + helpdesk_link: unknown; + /** */ + paid_at: string; + /** */ + created_at: string; + /** */ + channel: string; + /** */ + currency: string; + /** */ + ip_address: string; + /** */ + metadata: { custom_fields: Array<{ value: string; display_name: string; variable_name: string }> }; + /** */ + log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; + /** */ + fees: number; + /** */ + fees_split: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string; account_name: unknown; receiver_bank_account_number: unknown; receiver_bank: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + plan: Record; + /** */ + subaccount: Record; + /** */ + split: Record; + /** */ + order_id: unknown; + /** */ + paidAt: string; + /** */ + createdAt: string; + /** */ + requested_amount: number; + /** */ + pos_transaction_data: unknown; + /** */ + source: { type: string; source: string; identifier: unknown }; + /** */ + fees_breakdown: unknown; + /** */ + connect: unknown; +} diff --git a/src/models/transaction-initialize-body.ts b/src/models/transaction-initialize-body.ts new file mode 100644 index 0000000..54ec835 --- /dev/null +++ b/src/models/transaction-initialize-body.ts @@ -0,0 +1,39 @@ +export interface TransactionInitializeBody { + /** Customer's email address */ + email: string; + /** Amount should be in smallest denomination of the currency. + */ + amount: number; + /** List of all support currencies */ + currency?: "GHS" | "KES" | "NGN" | "ZAR" | "USD"; + /** Unique transaction reference. Only -, ., = and alphanumeric characters allowed. */ + reference?: string; + /** An array of payment channels to control what channels you want to make available to the user to make a payment with */ + channels?: Array<"apple_pay" | "bank" | "bank_transfer" | "capitec_pay" | "card" | "eft" | "mobile_money" | "payattitude" | "qr" | "ussd">; + /** Fully qualified url, e.g. https://example.com/ to redirect your customers to after a successful payment. Use this to override the callback url provided on the dashboard for this transaction + */ + callback_url?: string; + /** If transaction is to create a subscription to a predefined plan, provide plan code here. +This would invalidate the value provided in amount + */ + plan?: string; + /** Number of times to charge customer during subscription to plan */ + invoice_limit?: number; + /** The split code of the transaction split */ + split_code?: string; + /** Split configuration for transactions + */ + split?: { name: string; type: "percentage" | "flat"; subaccounts: Array<{ subaccount?: string; share?: number }>; currency: "NGN" | "GHS" | "ZAR" | "USD"; bearer_type?: "subaccount" | "account" | "all-proportional" | "all"; bearer_subaccount?: string }; + /** The code for the subaccount that owns the payment */ + subaccount?: string; + /** A flat fee to charge the subaccount for a transaction. +This overrides the split percentage set when the subaccount was created + */ + transaction_charge?: string; + /** The bearer of the transaction charge */ + bearer?: "account" | "subaccount"; + /** Used to replace the email address shown on the Checkout */ + label?: string; + /** JSON object of custom data */ + metadata?: Record; +} diff --git a/src/models/transaction-initialize-data.ts b/src/models/transaction-initialize-data.ts new file mode 100644 index 0000000..09aaef3 --- /dev/null +++ b/src/models/transaction-initialize-data.ts @@ -0,0 +1,8 @@ +export interface TransactionInitializeData { + /** */ + authorization_url: string; + /** */ + access_code: string; + /** */ + reference: string; +} diff --git a/src/models/transaction-list-data.ts b/src/models/transaction-list-data.ts new file mode 100644 index 0000000..1a7eb9d --- /dev/null +++ b/src/models/transaction-list-data.ts @@ -0,0 +1,2 @@ +export interface TransactionListData { +} diff --git a/src/models/transaction-list-query.ts b/src/models/transaction-list-query.ts new file mode 100644 index 0000000..33c483c --- /dev/null +++ b/src/models/transaction-list-query.ts @@ -0,0 +1,38 @@ +export interface TransactionListQuery { + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data + */ + previous?: string; + /** The number of records to fetch per request */ + per_page?: number; + /** The offset to retrieve data from */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; + /** Filter transaction by status */ + status?: "success" | "failed" | "abandoned" | "reversed"; + /** The origin of the payment */ + source?: "merchantApi" | "checkout" | "pos" | "virtualTerminal"; + /** Filter transactions by a terminal ID */ + terminal_id?: string; + /** Filter transactions by a virtual account number */ + virtual_account_number?: string; + /** Filter transactions by a customer code */ + customer_code?: string; + /** Filter transactions by a specific amount */ + amount?: number; + /** The settlement ID to filter for settled transactions */ + settlement?: number; + /** The payment method the customer used to complete the transaction */ + channel?: "card" | "pos" | "bank" | "dedicated_nuban" | "ussd" | "bank_transfer"; + /** Filter transaction by subaccount code */ + subaccount_code?: string; + /** Filter transaction by split code */ + split_code?: string; +} diff --git a/src/models/transaction-partial-debit-body.ts b/src/models/transaction-partial-debit-body.ts new file mode 100644 index 0000000..3493985 --- /dev/null +++ b/src/models/transaction-partial-debit-body.ts @@ -0,0 +1,14 @@ +export interface TransactionPartialDebitBody { + /** Customer's email address */ + email: string; + /** Specified in the lowest denomination of your currency */ + amount: number; + /** Valid authorization code to charge */ + authorization_code: string; + /** List of all support currencies */ + currency: "GHS" | "KES" | "NGN" | "ZAR" | "USD"; + /** Minimum amount to charge */ + at_least?: string; + /** Unique transaction reference. Only -, ., = and alphanumeric characters allowed. */ + reference?: string; +} diff --git a/src/models/transaction-partial-debit-data.ts b/src/models/transaction-partial-debit-data.ts new file mode 100644 index 0000000..b6267c6 --- /dev/null +++ b/src/models/transaction-partial-debit-data.ts @@ -0,0 +1,38 @@ +export interface TransactionPartialDebitData { + /** */ + amount: number; + /** */ + currency: string; + /** */ + transaction_date: string; + /** */ + status: string; + /** */ + reference: string; + /** */ + domain: string; + /** */ + metadata: string; + /** */ + gateway_response: string; + /** */ + message: unknown; + /** */ + channel: string; + /** */ + ip_address: unknown; + /** */ + log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; + /** */ + fees: number; + /** */ + authorization: { authorization_code: string; bin: string; last4: string; exp_month: string; exp_year: string; channel: string; card_type: string; bank: string; country_code: string; brand: string; reusable: boolean; signature: string; account_name: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: Record; risk_action: string; international_format_phone: string }; + /** */ + plan: number; + /** */ + requested_amount: number; + /** */ + id: number; +} diff --git a/src/models/transaction-timeline-data.ts b/src/models/transaction-timeline-data.ts new file mode 100644 index 0000000..2d2e439 --- /dev/null +++ b/src/models/transaction-timeline-data.ts @@ -0,0 +1,2 @@ +export interface TransactionTimelineData { +} diff --git a/src/models/transaction-totals-data.ts b/src/models/transaction-totals-data.ts new file mode 100644 index 0000000..784066b --- /dev/null +++ b/src/models/transaction-totals-data.ts @@ -0,0 +1,12 @@ +export interface TransactionTotalsData { + /** */ + total_transactions: number; + /** */ + total_volume: number; + /** */ + total_volume_by_currency: Array<{ currency: string; amount: number }>; + /** */ + pending_transfers: number; + /** */ + pending_transfers_by_currency: Array<{ currency: string; amount: number }>; +} diff --git a/src/models/transaction-totals-query.ts b/src/models/transaction-totals-query.ts new file mode 100644 index 0000000..01109dc --- /dev/null +++ b/src/models/transaction-totals-query.ts @@ -0,0 +1,6 @@ +export interface TransactionTotalsQuery { + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/transaction-verify-data.ts b/src/models/transaction-verify-data.ts new file mode 100644 index 0000000..7592d12 --- /dev/null +++ b/src/models/transaction-verify-data.ts @@ -0,0 +1,66 @@ +export interface TransactionVerifyData { + /** */ + id: number; + /** */ + domain: string; + /** */ + status: string; + /** */ + reference: string; + /** */ + receipt_number: string; + /** */ + amount: number; + /** */ + message: string; + /** */ + gateway_response: string; + /** */ + paid_at: string; + /** */ + created_at: string; + /** */ + channel: string; + /** */ + currency: string; + /** */ + ip_address: string; + /** */ + metadata: unknown; + /** */ + log: { start_time: number; time_spent: number; attempts: number; errors: number; success: boolean; mobile: boolean; input: Array; history: Array<{ type: string; message: string; time: number }> }; + /** */ + fees: number; + /** */ + fees_split: unknown; + /** */ + authorization: { authorization_code?: string; bin?: unknown; last4?: string; exp_month?: string; exp_year?: string; channel?: string; card_type?: string; bank?: string; country_code?: string; brand?: string; reusable?: boolean; signature?: string; account_name?: unknown; receiver_bank_account_number?: unknown; receiver_bank?: unknown }; + /** */ + customer: { id: number; first_name: string; last_name: string; email: string; customer_code: string; phone: string; metadata: unknown; risk_action: string; international_format_phone: string }; + /** */ + plan: string; + /** */ + split: Record; + /** */ + order_id: unknown; + /** */ + paidAt: string; + /** */ + createdAt: string; + /** */ + requested_amount: number; + /** */ + pos_transaction_data: unknown; + /** */ + source: unknown; + /** */ + fees_breakdown: unknown; + /** */ + connect: unknown; + /** */ + transaction_date: string; + /** */ + plan_object: { id?: number; name?: string; plan_code?: string; description?: unknown; amount?: number; interval?: string; send_invoices?: boolean; send_sms?: boolean; currency?: string }; + /** */ + subaccount: Record; +} diff --git a/src/models/transfer-bulk-body.ts b/src/models/transfer-bulk-body.ts new file mode 100644 index 0000000..fcb22ad --- /dev/null +++ b/src/models/transfer-bulk-body.ts @@ -0,0 +1,8 @@ +export interface TransferBulkBody { + /** The source of funds for the transfer. */ + source: string; + /** Specify the currency of the transfer. */ + currency?: "NGN" | "ZAR" | "KES" | "GHS"; + /** A list of transfer object */ + transfers: Array<{ amount: number; recipient: string; reference: string; reason?: string }>; +} diff --git a/src/models/transfer-bulk-data.ts b/src/models/transfer-bulk-data.ts new file mode 100644 index 0000000..d3d4981 --- /dev/null +++ b/src/models/transfer-bulk-data.ts @@ -0,0 +1,2 @@ +export interface TransferBulkData { +} diff --git a/src/models/transfer-disable-otp-finalize-body.ts b/src/models/transfer-disable-otp-finalize-body.ts new file mode 100644 index 0000000..fd56dbd --- /dev/null +++ b/src/models/transfer-disable-otp-finalize-body.ts @@ -0,0 +1,4 @@ +export interface TransferDisableOtpFinalizeBody { + /** OTP sent to business phone to verify disabling OTP requirement */ + otp: string; +} diff --git a/src/models/transfer-export-transfer-data.ts b/src/models/transfer-export-transfer-data.ts new file mode 100644 index 0000000..94ed1b4 --- /dev/null +++ b/src/models/transfer-export-transfer-data.ts @@ -0,0 +1,2 @@ +export interface TransferExportTransferData { +} diff --git a/src/models/transfer-export-transfer-query.ts b/src/models/transfer-export-transfer-query.ts new file mode 100644 index 0000000..1015886 --- /dev/null +++ b/src/models/transfer-export-transfer-query.ts @@ -0,0 +1,10 @@ +export interface TransferExportTransferQuery { + /** Export transfer by the recipient code */ + recipient?: string; + /** Export transfer by status */ + status?: "pending" | "success" | "failed" | "otp" | "abandoned" | "reversed" | "blocked" | "rejected" | "received"; + /** The start date */ + from?: string; + /** The end date */ + to?: string; +} diff --git a/src/models/transfer-fetch-data.ts b/src/models/transfer-fetch-data.ts new file mode 100644 index 0000000..efb2f1f --- /dev/null +++ b/src/models/transfer-fetch-data.ts @@ -0,0 +1,46 @@ +export interface TransferFetchData { + /** */ + amount: number; + /** */ + createdAt: string; + /** */ + currency: string; + /** */ + domain: string; + /** */ + failures: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + reason: string; + /** */ + reference: string; + /** */ + source: string; + /** */ + source_details: unknown; + /** */ + status: string; + /** */ + titan_code: unknown; + /** */ + transfer_code: string; + /** */ + request: number; + /** */ + transferred_at: unknown; + /** */ + updatedAt: string; + /** */ + recipient: { active: boolean; createdAt: string; currency: string; description: string; domain: string; email: string; id: number; integration: number; metadata?: Record; name: string; recipient_code: string; type: string; updatedAt: string; is_deleted: boolean; isDeleted: boolean; details: { authorization_code: unknown; account_number: string; account_name: string; bank_code: string; bank_name: string } }; + /** */ + session: { provider: unknown; id: unknown }; + /** */ + fee_charged: number; + /** */ + fees_breakdown: Array<{ amount: string; formula: unknown; type: string }>; + /** */ + gateway_response: string; +} diff --git a/src/models/transfer-finalize-body.ts b/src/models/transfer-finalize-body.ts new file mode 100644 index 0000000..af9d28e --- /dev/null +++ b/src/models/transfer-finalize-body.ts @@ -0,0 +1,6 @@ +export interface TransferFinalizeBody { + /** The transfer code you want to finalize */ + transfer_code: string; + /** OTP sent to business phone to verify transfer */ + otp: string; +} diff --git a/src/models/transfer-finalize-data.ts b/src/models/transfer-finalize-data.ts new file mode 100644 index 0000000..c293e38 --- /dev/null +++ b/src/models/transfer-finalize-data.ts @@ -0,0 +1,2 @@ +export interface TransferFinalizeData { +} diff --git a/src/models/transfer-initiate-body.ts b/src/models/transfer-initiate-body.ts new file mode 100644 index 0000000..0c5ea27 --- /dev/null +++ b/src/models/transfer-initiate-body.ts @@ -0,0 +1,15 @@ +export interface TransferInitiateBody { + /** Amount to transfer in kobo if currency is NGN and pesewas if currency is GHS. */ + amount: number; + /** The transfer recipient's code */ + recipient: string; + /** To ensure idempotency, you need to provide e a unique identifier for the request. The identifier should be a lowercase alphanumeric string with only -,_ symbols allowed. + */ + reference: string; + /** The reason or narration for the transfer. */ + reason?: string; + /** The source of funds to send from */ + source: string; + /** Specify the currency of the transfer. */ + currency?: "NGN" | "ZAR" | "KES" | "GHS"; +} diff --git a/src/models/transfer-initiate-data.ts b/src/models/transfer-initiate-data.ts new file mode 100644 index 0000000..2df7fb3 --- /dev/null +++ b/src/models/transfer-initiate-data.ts @@ -0,0 +1,42 @@ +export interface TransferInitiateData { + /** */ + transfersessionid: Array; + /** */ + transfertrials: Array; + /** */ + domain: string; + /** */ + amount: number; + /** */ + currency: string; + /** */ + reference: string; + /** */ + source: string; + /** */ + source_details: unknown; + /** */ + reason: string; + /** */ + status: string; + /** */ + failures: unknown; + /** */ + transfer_code: string; + /** */ + titan_code: unknown; + /** */ + transferred_at: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + request: number; + /** */ + recipient: number; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/transfer-list-data.ts b/src/models/transfer-list-data.ts new file mode 100644 index 0000000..ee87dc0 --- /dev/null +++ b/src/models/transfer-list-data.ts @@ -0,0 +1,2 @@ +export interface TransferListData { +} diff --git a/src/models/transfer-list-query.ts b/src/models/transfer-list-query.ts new file mode 100644 index 0000000..439af8f --- /dev/null +++ b/src/models/transfer-list-query.ts @@ -0,0 +1,22 @@ +export interface TransferListQuery { + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data + */ + previous?: string; + /** The number of records to fetch per request */ + per_page?: number; + /** The offset to retrieve data from */ + page?: number; + /** The start date */ + from?: string; + /** The end date */ + to?: string; + /** Filter transfer by the recipient code */ + recipient?: string; + /** Filter transfer by status */ + status?: "pending" | "success" | "failed" | "otp" | "abandoned" | "reversed" | "blocked" | "rejected" | "received"; +} diff --git a/src/models/transfer-recipient-transferrecipient-bulk-body.ts b/src/models/transfer-recipient-transferrecipient-bulk-body.ts new file mode 100644 index 0000000..46dc43a --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-bulk-body.ts @@ -0,0 +1,4 @@ +export interface TransferRecipientTransferrecipientBulkBody { + /** A list of transfer recipient object. */ + batch: Array<{ type: "nuban" | "ghipss" | "mobile_money" | "basa" | "authorization"; name: string; account_number: string; bank_code: string; description?: string; currency?: string; authorization_code?: string; metadata?: Record }>; +} diff --git a/src/models/transfer-recipient-transferrecipient-bulk-data.ts b/src/models/transfer-recipient-transferrecipient-bulk-data.ts new file mode 100644 index 0000000..5aa13b1 --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-bulk-data.ts @@ -0,0 +1,6 @@ +export interface TransferRecipientTransferrecipientBulkData { + /** */ + success: Array; + /** */ + errors: Array<{ message: string; records: Array<{ type: string; name: string; description: string; account_number: string; bank_code: string; currency: string; email: string }> }>; +} diff --git a/src/models/transfer-recipient-transferrecipient-create-body.ts b/src/models/transfer-recipient-transferrecipient-create-body.ts new file mode 100644 index 0000000..c0b1330 --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-create-body.ts @@ -0,0 +1,18 @@ +export interface TransferRecipientTransferrecipientCreateBody { + /** Recipient Type */ + type: "nuban" | "ghipss" | "mobile_money" | "basa" | "authorization"; + /** The recipient's name according to their account registration. */ + name: string; + /** Recipient's bank account number */ + account_number: string; + /** Recipient's bank code. You can get the list of Bank Codes by calling the List Banks endpoint */ + bank_code: string; + /** A description for this recipient */ + description?: string; + /** Currency for the account receiving the transfer */ + currency?: string; + /** An authorization code from a previous transaction */ + authorization_code?: string; + /** JSON object of custom data */ + metadata?: Record; +} diff --git a/src/models/transfer-recipient-transferrecipient-create-data.ts b/src/models/transfer-recipient-transferrecipient-create-data.ts new file mode 100644 index 0000000..3c944ab --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-create-data.ts @@ -0,0 +1,34 @@ +export interface TransferRecipientTransferrecipientCreateData { + /** */ + active: boolean; + /** */ + createdAt: string; + /** */ + currency: string; + /** */ + description: string; + /** */ + domain: string; + /** */ + email: string; + /** */ + id: number; + /** */ + integration: number; + /** */ + metadata?: Record; + /** */ + name: string; + /** */ + recipient_code: string; + /** */ + type: string; + /** */ + updatedAt: string; + /** */ + is_deleted: boolean; + /** */ + isDeleted: boolean; + /** */ + details: { authorization_code: string; account_number: string; account_name: string; bank_code: string; bank_name: string }; +} diff --git a/src/models/transfer-recipient-transferrecipient-fetch-data.ts b/src/models/transfer-recipient-transferrecipient-fetch-data.ts new file mode 100644 index 0000000..dbadb58 --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-fetch-data.ts @@ -0,0 +1,36 @@ +export interface TransferRecipientTransferrecipientFetchData { + /** */ + integration: number; + /** */ + domain: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + name: string; + /** */ + details: { account_number: string; account_name: string; bank_code: string; bank_name: string }; + /** */ + description: string; + /** */ + metadata?: Record; + /** */ + recipient_code: string; + /** */ + active: boolean; + /** */ + recipient_account: string; + /** */ + institution_code: string; + /** */ + email: string; + /** */ + id: number; + /** */ + isDeleted: boolean; + /** */ + createdAt: string; + /** */ + updatedAt: string; +} diff --git a/src/models/transfer-recipient-transferrecipient-list-data.ts b/src/models/transfer-recipient-transferrecipient-list-data.ts new file mode 100644 index 0000000..a20acc2 --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-list-data.ts @@ -0,0 +1,2 @@ +export interface TransferRecipientTransferrecipientListData { +} diff --git a/src/models/transfer-recipient-transferrecipient-list-query.ts b/src/models/transfer-recipient-transferrecipient-list-query.ts new file mode 100644 index 0000000..3d9d21e --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-list-query.ts @@ -0,0 +1,14 @@ +export interface TransferRecipientTransferrecipientListQuery { + /** A flag to indicate if cursor based pagination should be used */ + use_cursor?: boolean; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the next set of data + */ + next?: string; + /** An alphanumeric value returned for every cursor based retrieval, used to retrieve the previous set of data + */ + previous?: string; + /** The number of records to fetch per request */ + per_page?: number; + /** The offset to retrieve data from */ + page?: number; +} diff --git a/src/models/transfer-recipient-transferrecipient-update-body.ts b/src/models/transfer-recipient-transferrecipient-update-body.ts new file mode 100644 index 0000000..f50cf4c --- /dev/null +++ b/src/models/transfer-recipient-transferrecipient-update-body.ts @@ -0,0 +1,6 @@ +export interface TransferRecipientTransferrecipientUpdateBody { + /** Recipient's name */ + name?: string; + /** Recipient's email address */ + email?: string; +} diff --git a/src/models/transfer-resend-otp-body.ts b/src/models/transfer-resend-otp-body.ts new file mode 100644 index 0000000..55dfc32 --- /dev/null +++ b/src/models/transfer-resend-otp-body.ts @@ -0,0 +1,6 @@ +export interface TransferResendOtpBody { + /** The transfer code that requires an OTP validation */ + transfer_code: string; + /** Specify the flag to indicate the purpose of the OTP */ + reason: "disable_otp" | "resend_otp" | "transfer"; +} diff --git a/src/models/transfer-verify-data.ts b/src/models/transfer-verify-data.ts new file mode 100644 index 0000000..224fb47 --- /dev/null +++ b/src/models/transfer-verify-data.ts @@ -0,0 +1,40 @@ +export interface TransferVerifyData { + /** */ + amount: number; + /** */ + createdAt: string; + /** */ + currency: string; + /** */ + domain: string; + /** */ + failures: unknown; + /** */ + id: number; + /** */ + integration: number; + /** */ + reason: string; + /** */ + reference: string; + /** */ + source: string; + /** */ + source_details: unknown; + /** */ + status: string; + /** */ + titan_code: unknown; + /** */ + transfer_code: string; + /** */ + transferred_at: unknown; + /** */ + updatedAt: string; + /** */ + recipient: { active: boolean; createdAt: string; currency: string; description: string; domain: string; email: string; id: number; integration: number; metadata?: Record; name: string; recipient_code: string; type: string; updatedAt: string; is_deleted: boolean; details: { authorization_code: unknown; account_number: string; account_name: string; bank_code: string; bank_name: string } }; + /** */ + session: { provider: unknown; id: unknown }; + /** */ + gateway_response: string; +} diff --git a/src/models/virtual-terminal-add-split-code-body.ts b/src/models/virtual-terminal-add-split-code-body.ts new file mode 100644 index 0000000..7e5db61 --- /dev/null +++ b/src/models/virtual-terminal-add-split-code-body.ts @@ -0,0 +1,4 @@ +export interface VirtualTerminalAddSplitCodeBody { + /** The split code to assign to the virtual terminal */ + split_code: string; +} diff --git a/src/models/virtual-terminal-add-split-code-data.ts b/src/models/virtual-terminal-add-split-code-data.ts new file mode 100644 index 0000000..2871ef6 --- /dev/null +++ b/src/models/virtual-terminal-add-split-code-data.ts @@ -0,0 +1,32 @@ +export interface VirtualTerminalAddSplitCodeData { + /** */ + id: number; + /** */ + name: string; + /** */ + type: string; + /** */ + currency: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + split_code: string; + /** */ + active: boolean; + /** */ + bearer_type: string; + /** */ + bearer_subaccount: unknown; + /** */ + createdAt: string; + /** */ + updatedAt: string; + /** */ + is_dynamic: boolean; + /** */ + subaccounts: Array<{ subaccount: { id: number; subaccount_code: string; business_name: string; description: string; primary_contact_name: string; primary_contact_email: string; primary_contact_phone: string; metadata: string; settlement_bank: string; currency: string; account_number: string }; share: number }>; + /** */ + total_subaccounts: number; +} diff --git a/src/models/virtual-terminal-create-body.ts b/src/models/virtual-terminal-create-body.ts new file mode 100644 index 0000000..51cbf4e --- /dev/null +++ b/src/models/virtual-terminal-create-body.ts @@ -0,0 +1,10 @@ +export interface VirtualTerminalCreateBody { + /** The name of the virtual terminal */ + name: string; + /** Array of objects containing recipients for payment notifications for the Virtual Terminal. */ + destinations: Array<{ target?: string; name?: string }>; + /** Split code to associate with the virtual terminal */ + split_code?: string; + /** Additional custom data as key-value pairs */ + metadata?: Record; +} diff --git a/src/models/virtual-terminal-create-data.ts b/src/models/virtual-terminal-create-data.ts new file mode 100644 index 0000000..a1b92cc --- /dev/null +++ b/src/models/virtual-terminal-create-data.ts @@ -0,0 +1,22 @@ +export interface VirtualTerminalCreateData { + /** */ + id: number; + /** */ + name: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + code: string; + /** */ + paymentMethods: Array; + /** */ + active: boolean; + /** */ + metadata: unknown; + /** */ + destinations: Array<{ target?: string; type?: string; name?: string }>; + /** */ + currency: string; +} diff --git a/src/models/virtual-terminal-delete-split-code-body.ts b/src/models/virtual-terminal-delete-split-code-body.ts new file mode 100644 index 0000000..fa48a19 --- /dev/null +++ b/src/models/virtual-terminal-delete-split-code-body.ts @@ -0,0 +1,4 @@ +export interface VirtualTerminalDeleteSplitCodeBody { + /** The split code to assign to the virtual terminal */ + split_code: string; +} diff --git a/src/models/virtual-terminal-destination-assign-body.ts b/src/models/virtual-terminal-destination-assign-body.ts new file mode 100644 index 0000000..1c3a680 --- /dev/null +++ b/src/models/virtual-terminal-destination-assign-body.ts @@ -0,0 +1,4 @@ +export interface VirtualTerminalDestinationAssignBody { + /** Array of objects containing recipients for payment notifications for the Virtual Terminal. */ + destinations: Array<{ target?: string; name?: string }>; +} diff --git a/src/models/virtual-terminal-destination-assign-data.ts b/src/models/virtual-terminal-destination-assign-data.ts new file mode 100644 index 0000000..b609e5a --- /dev/null +++ b/src/models/virtual-terminal-destination-assign-data.ts @@ -0,0 +1,2 @@ +export interface VirtualTerminalDestinationAssignData { +} diff --git a/src/models/virtual-terminal-destination-unassign-body.ts b/src/models/virtual-terminal-destination-unassign-body.ts new file mode 100644 index 0000000..7d427da --- /dev/null +++ b/src/models/virtual-terminal-destination-unassign-body.ts @@ -0,0 +1,4 @@ +export interface VirtualTerminalDestinationUnassignBody { + /** Array of destination targets to unassign */ + targets: Array; +} diff --git a/src/models/virtual-terminal-fetch-data.ts b/src/models/virtual-terminal-fetch-data.ts new file mode 100644 index 0000000..68a1486 --- /dev/null +++ b/src/models/virtual-terminal-fetch-data.ts @@ -0,0 +1,24 @@ +export interface VirtualTerminalFetchData { + /** */ + id: number; + /** */ + code: string; + /** */ + name: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + paymentMethods: Array; + /** */ + active: boolean; + /** */ + created_at: string; + /** */ + connect_account_id: unknown; + /** */ + destinations: Array<{ target?: string; type?: string; name?: string; created_at?: string }>; + /** */ + currency: string; +} diff --git a/src/models/virtual-terminal-list-data.ts b/src/models/virtual-terminal-list-data.ts new file mode 100644 index 0000000..bc99a7a --- /dev/null +++ b/src/models/virtual-terminal-list-data.ts @@ -0,0 +1,2 @@ +export interface VirtualTerminalListData { +} diff --git a/src/models/virtual-terminal-list-query.ts b/src/models/virtual-terminal-list-query.ts new file mode 100644 index 0000000..4f7c4d2 --- /dev/null +++ b/src/models/virtual-terminal-list-query.ts @@ -0,0 +1,6 @@ +export interface VirtualTerminalListQuery { + /** The number of records to fetch per request */ + perPage?: number; + /** The offset to retrieve data from */ + page?: number; +} diff --git a/src/models/virtual-terminal-update-body.ts b/src/models/virtual-terminal-update-body.ts new file mode 100644 index 0000000..ad7a704 --- /dev/null +++ b/src/models/virtual-terminal-update-body.ts @@ -0,0 +1,4 @@ +export interface VirtualTerminalUpdateBody { + /** Name of the virtual terminal */ + name: string; +} diff --git a/src/models/virtual-terminal-update-data.ts b/src/models/virtual-terminal-update-data.ts new file mode 100644 index 0000000..22f05f5 --- /dev/null +++ b/src/models/virtual-terminal-update-data.ts @@ -0,0 +1,24 @@ +export interface VirtualTerminalUpdateData { + /** */ + id: number; + /** */ + code: string; + /** */ + name: string; + /** */ + integration: number; + /** */ + domain: string; + /** */ + paymentMethods: Array; + /** */ + active: boolean; + /** */ + created_at: string; + /** */ + connect_account_id: unknown; + /** */ + destinations: Array<{ target?: string; type?: string; name?: string; created_at?: string }>; + /** */ + currency: string; +} diff --git a/src/runtime.ts b/src/runtime.ts deleted file mode 100644 index 3f204fb..0000000 --- a/src/runtime.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Paystack - * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa. - * - * The version of the Paystack Node library: 1.0.0 - * Contact: techsupport@paystack.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import * as https from 'https'; - -const BASE_PATH = "https://api.paystack.co".replace(/\/+$/, ""); -type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; -type HTTPHeaders = { [key: string]: string }; -type HTTPBody = any -type HTTPQuery = { [key: string]: string | number | null | boolean | Array | HTTPQuery }; - -interface Request { - path: string; - method: HTTPMethod; - headers?: HTTPHeaders; - body?: HTTPBody; - query?: HTTPQuery -} - -/** - * This is the base class for all generated API classes. - */ -export class BaseAPI { - constructor(readonly apiKey: string) {} - - protected async request(params: Request): Promise { - // TODO: Do checks on params - const response = await this.makeRequest(params); - - // if (response.status >= 200 && response.status < 300) { - // return response; - // } - // throw response; - - return response - } - - private makeRequest(request: Request): Promise { - const query = this.parseQueryParams(request.query) - const tempPath = query.length === 0 ? request.path : `${request.path}?${query}` - const options = { - method: request.method, - path: tempPath, - headers: { - "authorization": `Bearer ${this.apiKey}`, - "user-agent": `@paystack/paystack-sdk - 1.2.1-beta.2` - } - } - - return new Promise((resolve, reject) => { - const req = https.request(BASE_PATH, options, (res) => { - - let data: any[] = []; - - res.on('data', (chunk) => { - data.push(chunk) - }); - - res.on('end', () => { - try { - resolve(JSON.parse(Buffer.concat(data).toString())); - } catch(e) { - reject(e); - } - }) - }); - - req.on('error', (e) => { - reject(e) - }); - - if(request.body && Object.keys(request.body).length > 0) { - req.write(JSON.stringify(request.body)) - } - - req.end(); - }) - } - - private parseQueryParams(queryParameters: any): string { - if(queryParameters && Object.keys(queryParameters).length === 0) { - return "" - } - - return new URLSearchParams(queryParameters).toString() - } -}; - -export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} - -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} diff --git a/tests/api-client.test.ts b/tests/api-client.test.ts new file mode 100644 index 0000000..a41a884 --- /dev/null +++ b/tests/api-client.test.ts @@ -0,0 +1,9 @@ +import { describe, it, expect } from "vitest"; +import { ApiClient } from "../src/core/api-client.js"; + +describe("ApiClient", () => { + it("can be constructed", () => { + const client = new ApiClient({ secretKey: "sk_test_xxx" }); + expect(client).toBeDefined(); + }); +}); diff --git a/tests/apple-pay.test.ts b/tests/apple-pay.test.ts new file mode 100644 index 0000000..c1c7bdf --- /dev/null +++ b/tests/apple-pay.test.ts @@ -0,0 +1,78 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { ApplePayApi } from "../src/apis/apple-pay.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("ApplePayApi", () => { + let resource: ApplePayApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new ApplePayApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("listDomain", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).listDomain(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).listDomain(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("registerDomain", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).registerDomain(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).registerDomain(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("unregisterDomain", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).unregisterDomain(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).unregisterDomain(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/balance.test.ts b/tests/balance.test.ts new file mode 100644 index 0000000..8f0c637 --- /dev/null +++ b/tests/balance.test.ts @@ -0,0 +1,58 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { BalanceApi } from "../src/apis/balance.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("BalanceApi", () => { + let resource: BalanceApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new BalanceApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("ledger", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).ledger(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).ledger(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/bank.test.ts b/tests/bank.test.ts new file mode 100644 index 0000000..5ff59b2 --- /dev/null +++ b/tests/bank.test.ts @@ -0,0 +1,78 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { BankApi } from "../src/apis/bank.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("BankApi", () => { + let resource: BankApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new BankApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("resolveAccountNumber", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).resolveAccountNumber(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).resolveAccountNumber(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("validateAccountNumber", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).validateAccountNumber(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).validateAccountNumber(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/bulk-charge.test.ts b/tests/bulk-charge.test.ts new file mode 100644 index 0000000..da0b9cf --- /dev/null +++ b/tests/bulk-charge.test.ts @@ -0,0 +1,132 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { BulkChargeApi } from "../src/apis/bulk-charge.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("BulkChargeApi", () => { + let resource: BulkChargeApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new BulkChargeApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("initiate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).initiate(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).initiate(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("charges", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).charges(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).charges(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("pause", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).pause(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).pause(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("resume", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).resume(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).resume(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/charge.test.ts b/tests/charge.test.ts new file mode 100644 index 0000000..be3c6a7 --- /dev/null +++ b/tests/charge.test.ts @@ -0,0 +1,153 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { ChargeApi } from "../src/apis/charge.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("ChargeApi", () => { + let resource: ChargeApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new ChargeApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("submitPin", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).submitPin(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).submitPin(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("submitOtp", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).submitOtp(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).submitOtp(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("submitPhone", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).submitPhone(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).submitPhone(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("submitBirthday", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).submitBirthday(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).submitBirthday(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("submitAddress", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).submitAddress(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).submitAddress(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("check", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).check(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).check(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/customer.test.ts b/tests/customer.test.ts new file mode 100644 index 0000000..f8d06c6 --- /dev/null +++ b/tests/customer.test.ts @@ -0,0 +1,246 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { CustomerApi } from "../src/apis/customer.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("CustomerApi", () => { + let resource: CustomerApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new CustomerApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("riskAction", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).riskAction(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).riskAction(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("validate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).validate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).validate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("initializeAuthorization", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).initializeAuthorization(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).initializeAuthorization(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("verifyAuthorization", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).verifyAuthorization(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).verifyAuthorization(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("deactivateAuthorization", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).deactivateAuthorization(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).deactivateAuthorization(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("initializeDirectDebit", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).initializeDirectDebit(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).initializeDirectDebit(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("directDebitActivationCharge", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).directDebitActivationCharge(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).directDebitActivationCharge(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetchMandateAuthorizations", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetchMandateAuthorizations(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetchMandateAuthorizations(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/dedicated-virtual-account.test.ts b/tests/dedicated-virtual-account.test.ts new file mode 100644 index 0000000..633dc48 --- /dev/null +++ b/tests/dedicated-virtual-account.test.ts @@ -0,0 +1,189 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { DedicatedVirtualAccountApi } from "../src/apis/dedicated-virtual-account.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("DedicatedVirtualAccountApi", () => { + let resource: DedicatedVirtualAccountApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new DedicatedVirtualAccountApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("dedicatedAccountList", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountList(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountList(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountCreate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountCreate(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountCreate(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountAssign", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountAssign(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountAssign(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountFetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountFetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountFetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountDeactivate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountDeactivate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountDeactivate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountRequery", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountRequery(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountRequery(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountAddSplit", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountAddSplit(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountAddSplit(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountRemoveSplit", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountRemoveSplit(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountRemoveSplit(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("dedicatedAccountAvailableProviders", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).dedicatedAccountAvailableProviders(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).dedicatedAccountAvailableProviders(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/direct-debit.test.ts b/tests/direct-debit.test.ts new file mode 100644 index 0000000..2ff50e6 --- /dev/null +++ b/tests/direct-debit.test.ts @@ -0,0 +1,59 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { DirectDebitApi } from "../src/apis/direct-debit.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("DirectDebitApi", () => { + let resource: DirectDebitApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new DirectDebitApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("directdebitTriggerActivationCharge", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).directdebitTriggerActivationCharge(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).directdebitTriggerActivationCharge(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("directdebitListMandateAuthorizations", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).directdebitListMandateAuthorizations(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).directdebitListMandateAuthorizations(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/dispute.test.ts b/tests/dispute.test.ts new file mode 100644 index 0000000..cdc6a28 --- /dev/null +++ b/tests/dispute.test.ts @@ -0,0 +1,170 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { DisputeApi } from "../src/apis/dispute.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("DisputeApi", () => { + let resource: DisputeApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new DisputeApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("uploadUrl", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).uploadUrl(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).uploadUrl(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("download", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).download(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).download(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transaction", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transaction(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transaction(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("resolve", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).resolve(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).resolve(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("evidence", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).evidence(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).evidence(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/integration.test.ts b/tests/integration.test.ts new file mode 100644 index 0000000..cce7151 --- /dev/null +++ b/tests/integration.test.ts @@ -0,0 +1,58 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { IntegrationApi } from "../src/apis/integration.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("IntegrationApi", () => { + let resource: IntegrationApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new IntegrationApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("fetchPaymentSessionTimeout", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetchPaymentSessionTimeout(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetchPaymentSessionTimeout(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("updatePaymentSessionTimeout", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).updatePaymentSessionTimeout(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).updatePaymentSessionTimeout(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/miscellaneous.test.ts b/tests/miscellaneous.test.ts new file mode 100644 index 0000000..f0ae1eb --- /dev/null +++ b/tests/miscellaneous.test.ts @@ -0,0 +1,76 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { MiscellaneousApi } from "../src/apis/miscellaneous.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("MiscellaneousApi", () => { + let resource: MiscellaneousApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new MiscellaneousApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("resolveCardBin", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).resolveCardBin(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).resolveCardBin(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("listCountries", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).listCountries(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).listCountries(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("avs", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).avs(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).avs(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/order.test.ts b/tests/order.test.ts new file mode 100644 index 0000000..9bbe485 --- /dev/null +++ b/tests/order.test.ts @@ -0,0 +1,113 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { OrderApi } from "../src/apis/order.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("OrderApi", () => { + let resource: OrderApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new OrderApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("product", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).product(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).product(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("validate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).validate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).validate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/page.test.ts b/tests/page.test.ts new file mode 100644 index 0000000..2378919 --- /dev/null +++ b/tests/page.test.ts @@ -0,0 +1,133 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { PageApi } from "../src/apis/page.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("PageApi", () => { + let resource: PageApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new PageApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("checkSlugAvailability", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).checkSlugAvailability(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).checkSlugAvailability(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("addProducts", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).addProducts(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).addProducts(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/payment-request.test.ts b/tests/payment-request.test.ts new file mode 100644 index 0000000..ab22e35 --- /dev/null +++ b/tests/payment-request.test.ts @@ -0,0 +1,186 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { PaymentRequestApi } from "../src/apis/payment-request.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("PaymentRequestApi", () => { + let resource: PaymentRequestApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new PaymentRequestApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("verify", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).verify(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).verify(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("notify", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).notify(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).notify(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("totals", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).totals(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).totals(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("finalize", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).finalize(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).finalize(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("archive", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).archive(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).archive(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/plan.test.ts b/tests/plan.test.ts new file mode 100644 index 0000000..106188a --- /dev/null +++ b/tests/plan.test.ts @@ -0,0 +1,96 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { PlanApi } from "../src/apis/plan.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("PlanApi", () => { + let resource: PlanApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new PlanApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/product.test.ts b/tests/product.test.ts new file mode 100644 index 0000000..afeafa1 --- /dev/null +++ b/tests/product.test.ts @@ -0,0 +1,114 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { ProductApi } from "../src/apis/product.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("ProductApi", () => { + let resource: ProductApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new ProductApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("delete_", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).delete_(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).delete_(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/refund.test.ts b/tests/refund.test.ts new file mode 100644 index 0000000..adf2141 --- /dev/null +++ b/tests/refund.test.ts @@ -0,0 +1,96 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { RefundApi } from "../src/apis/refund.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("RefundApi", () => { + let resource: RefundApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new RefundApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("retry", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).retry(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).retry(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/settlement.test.ts b/tests/settlement.test.ts new file mode 100644 index 0000000..8ff8d7b --- /dev/null +++ b/tests/settlement.test.ts @@ -0,0 +1,58 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { SettlementApi } from "../src/apis/settlement.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("SettlementApi", () => { + let resource: SettlementApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new SettlementApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("settlementsFetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).settlementsFetch(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).settlementsFetch(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("settlementsTransaction", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).settlementsTransaction(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).settlementsTransaction(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/split.test.ts b/tests/split.test.ts new file mode 100644 index 0000000..dd58e9c --- /dev/null +++ b/tests/split.test.ts @@ -0,0 +1,134 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { SplitApi } from "../src/apis/split.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("SplitApi", () => { + let resource: SplitApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new SplitApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("addSubaccount", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).addSubaccount(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).addSubaccount(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("removeSubaccount", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).removeSubaccount(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).removeSubaccount(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/storefront.test.ts b/tests/storefront.test.ts new file mode 100644 index 0000000..1e8b8dd --- /dev/null +++ b/tests/storefront.test.ts @@ -0,0 +1,223 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { StorefrontApi } from "../src/apis/storefront.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("StorefrontApi", () => { + let resource: StorefrontApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new StorefrontApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("delete_", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).delete_(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).delete_(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("verifySlug", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).verifySlug(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).verifySlug(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetchOrders", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetchOrders(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetchOrders(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("listProducts", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).listProducts(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).listProducts(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("addProducts", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).addProducts(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).addProducts(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("publish", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).publish(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).publish(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("duplicate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).duplicate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).duplicate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/subaccount.test.ts b/tests/subaccount.test.ts new file mode 100644 index 0000000..95f825f --- /dev/null +++ b/tests/subaccount.test.ts @@ -0,0 +1,96 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { SubaccountApi } from "../src/apis/subaccount.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("SubaccountApi", () => { + let resource: SubaccountApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new SubaccountApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/subscription.test.ts b/tests/subscription.test.ts new file mode 100644 index 0000000..e31d443 --- /dev/null +++ b/tests/subscription.test.ts @@ -0,0 +1,151 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { SubscriptionApi } from "../src/apis/subscription.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("SubscriptionApi", () => { + let resource: SubscriptionApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new SubscriptionApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("disable", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).disable(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).disable(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("enable", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).enable(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).enable(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("manageLink", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).manageLink(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).manageLink(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("manageEmail", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).manageEmail(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).manageEmail(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/terminal.test.ts b/tests/terminal.test.ts new file mode 100644 index 0000000..ebf9d4d --- /dev/null +++ b/tests/terminal.test.ts @@ -0,0 +1,170 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { TerminalApi } from "../src/apis/terminal.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("TerminalApi", () => { + let resource: TerminalApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new TerminalApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("sendEvent", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).sendEvent(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).sendEvent(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetchEventStatus", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetchEventStatus(...Array(3).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetchEventStatus(...Array(3).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetchTerminalStatus", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetchTerminalStatus(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetchTerminalStatus(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("commission", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).commission(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).commission(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("decommission", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).decommission(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).decommission(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/transaction.test.ts b/tests/transaction.test.ts new file mode 100644 index 0000000..fd60cc1 --- /dev/null +++ b/tests/transaction.test.ts @@ -0,0 +1,189 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { TransactionApi } from "../src/apis/transaction.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("TransactionApi", () => { + let resource: TransactionApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new TransactionApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("initialize", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).initialize(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).initialize(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("chargeAuthorization", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).chargeAuthorization(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).chargeAuthorization(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("partialDebit", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).partialDebit(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).partialDebit(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("verify", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).verify(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).verify(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("timeline", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).timeline(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).timeline(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("totals", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).totals(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).totals(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("export_", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).export_(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).export_(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/transfer-recipient.test.ts b/tests/transfer-recipient.test.ts new file mode 100644 index 0000000..63813e9 --- /dev/null +++ b/tests/transfer-recipient.test.ts @@ -0,0 +1,133 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { TransferRecipientApi } from "../src/apis/transfer-recipient.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("TransferRecipientApi", () => { + let resource: TransferRecipientApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new TransferRecipientApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("transferrecipientList", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientList(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientList(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transferrecipientCreate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientCreate(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientCreate(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transferrecipientBulk", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientBulk(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientBulk(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transferrecipientFetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientFetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientFetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transferrecipientUpdate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientUpdate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientUpdate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("transferrecipientDelete", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).transferrecipientDelete(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).transferrecipientDelete(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/transfer.test.ts b/tests/transfer.test.ts new file mode 100644 index 0000000..d674629 --- /dev/null +++ b/tests/transfer.test.ts @@ -0,0 +1,226 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { TransferApi } from "../src/apis/transfer.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("TransferApi", () => { + let resource: TransferApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new TransferApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("initiate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).initiate(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).initiate(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("finalize", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).finalize(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).finalize(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("bulk", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).bulk(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).bulk(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("verify", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).verify(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).verify(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("exportTransfer", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).exportTransfer(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).exportTransfer(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("resendOtp", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).resendOtp(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).resendOtp(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("disableOtp", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).disableOtp(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).disableOtp(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("disableOtpFinalize", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).disableOtpFinalize(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).disableOtpFinalize(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("enableOtp", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).enableOtp(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).enableOtp(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tests/virtual-terminal.test.ts b/tests/virtual-terminal.test.ts new file mode 100644 index 0000000..9d5af04 --- /dev/null +++ b/tests/virtual-terminal.test.ts @@ -0,0 +1,190 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { VirtualTerminalApi } from "../src/apis/virtual-terminal.js"; +import type { ApiClientConfig } from "../src/core/types.js"; + +const mockRequest = vi.fn(); + +vi.mock("../src/core/api-client.js", () => ({ + ApiClient: vi.fn(function ApiClientMock() { + return { request: mockRequest }; + }), +})); + +describe("VirtualTerminalApi", () => { + let resource: VirtualTerminalApi; + + beforeEach(async () => { + mockRequest.mockReset(); + const { ApiClient } = await import("../src/core/api-client.js"); + resource = new VirtualTerminalApi(new ApiClient({} as ApiClientConfig)); + }); + + describe("list", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).list(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).list(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("create", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).create(...Array(0).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).create(...Array(0).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("fetch", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).fetch(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("GET"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).fetch(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("update", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).update(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).update(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("deactivate", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).deactivate(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String) + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).deactivate(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("destinationAssign", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).destinationAssign(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).destinationAssign(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("destinationUnassign", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).destinationUnassign(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("POST"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).destinationUnassign(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("addSplitCode", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).addSplitCode(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("PUT"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).addSplitCode(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); + + describe("deleteSplitCode", () => { + it("calls the correct endpoint on success", async () => { + mockRequest.mockResolvedValue({ status: true, message: "ok", data: {} }); + await (resource as any).deleteSplitCode(...Array(2).fill("test")); + expect(mockRequest).toHaveBeenCalledWith( + expect.stringContaining("DELETE"), + expect.any(String), + expect.anything() + ); + }); + + it("propagates errors from the HTTP client", async () => { + mockRequest.mockRejectedValue(new Error("API Error")); + await expect( + (resource as any).deleteSplitCode(...Array(2).fill("test")) + ).rejects.toThrow(); + }); + }); +}); diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index 122805c..0000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS", - "outDir": "dist/cjs" - }, -} \ No newline at end of file diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index 903dd7f..0000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "target": "ES2015", - "module": "ES2020", - "outDir": "dist/esm", - }, -} diff --git a/tsconfig.json b/tsconfig.json index 4a71f90..f54fbb3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,12 @@ { "compilerOptions": { - "moduleResolution": "node", - "esModuleInterop": false, + "target": "ES2020", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "declaration": true, + "skipLibCheck": true, + "outDir": "dist" }, - "include": ["src"] + "include": ["src/**/*.ts"] } diff --git a/tsconfig.types.json b/tsconfig.types.json deleted file mode 100644 index 51b6138..0000000 --- a/tsconfig.types.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/types", - "declaration": true, - "emitDeclarationOnly": true - } -} \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..f224719 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: { + index: "src/index.ts", + "models/index": "src/models/index.ts", + }, + format: ["esm", "cjs"], + dts: true, + outDir: "dist", + clean: true, + splitting: false, + outExtension({ format }) { + return { js: format === "esm" ? ".mjs" : ".cjs" }; + }, +});