Merge pull request #660 from Adyen/pw-4240/restore_develop

overwritten develop with current master source
This commit is contained in:
Wouter Boereboom
2021-04-21 15:05:00 +02:00
committed by GitHub
52 changed files with 607 additions and 676 deletions

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1

View File

@@ -60,7 +60,7 @@ describe("Bin Lookup", function (): void {
scope.post("/get3dsAvailability")
.reply(200, threeDSAvailabilitySuccess);
const response = await binLookup.get3dsAvailability.post(threeDSAvailabilityRequest);
const response = await binLookup.get3dsAvailability(threeDSAvailabilityRequest);
expect(response).toEqual<IBinLookup.ThreeDSAvailabilityResponse>(threeDSAvailabilitySuccess);
});
@@ -77,7 +77,7 @@ describe("Bin Lookup", function (): void {
.reply(403, JSON.stringify({status: 403, message: "fail", errorCode: "171"}));
try {
await binLookup.get3dsAvailability.post(threeDSAvailabilityRequest as unknown as IBinLookup.ThreeDSAvailabilityRequest);
await binLookup.get3dsAvailability(threeDSAvailabilityRequest as unknown as IBinLookup.ThreeDSAvailabilityRequest);
fail("Expected request to fail");
} catch (e) {
expect(e instanceof HttpClientException).toBeTruthy();
@@ -113,8 +113,8 @@ describe("Bin Lookup", function (): void {
scope.post("/getCostEstimate")
.reply(200, expected);
const response = await binLookup.getCostEstimate.post(costEstimateRequest);
const response = await binLookup.getCostEstimate(costEstimateRequest);
expect(response).toEqual(expected);
});
});
});

View File

@@ -148,7 +148,7 @@ describe("Checkout", (): void => {
.reply(200, paymentsSuccess);
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments.post(paymentsRequest);
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toBeTruthy();
});
@@ -159,7 +159,7 @@ describe("Checkout", (): void => {
.reply(401);
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
await checkout.payments.post(paymentsRequest);
await checkout.payments(paymentsRequest);
} catch (e) {
expect(e instanceof HttpClientException).toBeTruthy();
}
@@ -172,7 +172,7 @@ describe("Checkout", (): void => {
scope.post("/paymentMethods")
.reply(200, paymentMethodsSuccess);
const paymentMethodsResponse = await checkout.paymentMethods.post(paymentMethodsRequest);
const paymentMethodsResponse = await checkout.paymentMethods(paymentMethodsRequest);
if (paymentMethodsResponse && paymentMethodsResponse.paymentMethods) {
expect(paymentMethodsResponse.paymentMethods.length).toBeGreaterThan(0);
} else {
@@ -187,7 +187,7 @@ describe("Checkout", (): void => {
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks.post(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
expect(paymentSuccessLinkResponse).toBeTruthy();
});
@@ -198,10 +198,10 @@ describe("Checkout", (): void => {
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks.post(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
scope.get(`/paymentLinks/${paymentSuccessLinkResponse.id}`).reply(200, paymentLinkSuccess);
const paymentLink = await checkout.paymentLinks.get({ id: paymentSuccessLinkResponse.id });
const paymentLink = await checkout.getPaymentLinks(paymentSuccessLinkResponse.id);
expect(paymentLink).toBeTruthy();
});
@@ -212,10 +212,10 @@ describe("Checkout", (): void => {
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks.post(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
scope.patch(`/paymentLinks/${paymentSuccessLinkResponse.id}`).reply(200, { ...paymentLinkSuccess, status: "expired" });
const paymentLink = await checkout.paymentLinks.patch({ id: paymentSuccessLinkResponse.id, status: "expired" });
const paymentLink = await checkout.updatePaymentLinks(paymentSuccessLinkResponse.id, "expired");
expect(paymentLink.status).toEqual("expired");
});
@@ -224,7 +224,7 @@ describe("Checkout", (): void => {
scope.post("/payments/details")
.reply(200, paymentDetailsSuccess);
const paymentsResponse = await checkout.payments.details.post(createPaymentsDetailsRequest());
const paymentsResponse = await checkout.paymentsDetails(createPaymentsDetailsRequest());
expect(paymentsResponse.resultCode).toEqual("Authorised");
});
@@ -233,7 +233,7 @@ describe("Checkout", (): void => {
scope.post("/paymentSession")
.reply(200, paymentSessionSuccess);
const paymentSessionRequest: ICheckout.PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkout.paymentSession.post(paymentSessionRequest);
const paymentSessionResponse = await checkout.paymentSession(paymentSessionRequest);
expect(paymentSessionResponse.paymentSession).not.toBeUndefined();
});
@@ -244,7 +244,7 @@ describe("Checkout", (): void => {
const paymentResultRequest: ICheckout.PaymentVerificationRequest = {
payload: "This is a test payload",
};
const paymentResultResponse = await checkout.payments.result.post(paymentResultRequest);
const paymentResultResponse = await checkout.paymentResult(paymentResultRequest);
expect(paymentResultResponse.resultCode).toEqual("Authorised");
});
@@ -266,7 +266,7 @@ describe("Checkout", (): void => {
.reply(200, paymentsResultMultibancoSuccess);
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments.post(paymentsRequest);
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toBeTruthy();
expect(paymentsResponse.additionalData).toBeTruthy();
@@ -283,7 +283,7 @@ describe("Checkout", (): void => {
.post(`/${Client.CHECKOUT_API_VERSION}/originKeys`)
.reply(200, originKeysSuccess);
const originKeysResponse = await checkoutUtility.originKeys.post(originKeysRequest);
const originKeysResponse = await checkoutUtility.originKeys(originKeysRequest);
if (originKeysResponse.originKeys) {
return expect(originKeysResponse.originKeys["https://www.your-domain.com"].startsWith("pub.v2")).toBeTruthy();
}
@@ -304,7 +304,7 @@ describe("Checkout", (): void => {
scope.post("/paymentMethods/balance")
.reply(200, paymentMethodsBalanceResponse);
const paymentsResponse: ICheckout.CheckoutBalanceCheckResponse = await checkout.paymentMethods.balance.post(paymentMethodsRequest);
const paymentsResponse: ICheckout.CheckoutBalanceCheckResponse = await checkout.paymentMethodsBalance(paymentMethodsRequest);
expect(paymentsResponse.balance.value).toEqual(1000);
});
@@ -321,7 +321,7 @@ describe("Checkout", (): void => {
scope.post("/orders")
.reply(200, orderResponse);
const response: ICheckout.CheckoutCreateOrderResponse = await checkout.orders.post(orderRequest);
const response: ICheckout.CheckoutCreateOrderResponse = await checkout.orders(orderRequest);
expect(response).toBeTruthy();
});
@@ -338,7 +338,7 @@ describe("Checkout", (): void => {
scope.post("/orders")
.reply(200, orderResponse);
const createOrderResponse: ICheckout.CheckoutCreateOrderResponse = await checkout.orders.post(orderRequest);
const createOrderResponse: ICheckout.CheckoutCreateOrderResponse = await checkout.orders(orderRequest);
const orderCancelResponse: ICheckout.CheckoutCancelOrderResponse = {
pspReference: "mocked_psp_ref",
@@ -347,7 +347,7 @@ describe("Checkout", (): void => {
scope.post("/orders/cancel")
.reply(200, orderCancelResponse);
const response: ICheckout.CheckoutCancelOrderResponse = await checkout.orders.cancel.post({
const response: ICheckout.CheckoutCancelOrderResponse = await checkout.ordersCancel({
order: {
orderData: createOrderResponse.orderData,
pspReference: createOrderResponse.pspReference!

View File

@@ -41,7 +41,7 @@ const getResponse = async ({apiKey , environment }: { apiKey: string; environmen
const ErrorException = errorType === "ApiException" ? ApiException : HttpClientException;
try {
await checkout.payments.post(createPaymentsCheckoutRequest());
await checkout.payments(createPaymentsCheckoutRequest());
fail("request should fail");
} catch (e) {
expect(e instanceof ErrorException).toBeTruthy();

View File

@@ -19,7 +19,7 @@
import nock from "nock";
import { createClient } from "../__mocks__/base";
import Payouts from "../services/payouts";
import Payout from "../services/payout";
import Client from "../client";
import StoreDetailRequest = IPayouts.StoreDetailRequest;
import { ApiConstants } from "../constants/apiConstants";
@@ -102,7 +102,7 @@ const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!
let client: Client;
let clientStore: Client;
let clientReview: Client;
let payouts: Payouts;
let payout: Payout;
let scope: nock.Scope;
beforeEach((): void => {
@@ -113,7 +113,7 @@ beforeEach((): void => {
clientStore = createClient(process.env.ADYEN_STOREPAYOUT_APIKEY);
clientReview = createClient(process.env.ADYEN_REVIEWPAYOUT_APIKEY);
scope = nock(`${client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}`);
payouts = new Payouts(client);
payout = new Payout(client);
});
afterEach((): void => {
@@ -123,21 +123,21 @@ afterEach((): void => {
describe("PayoutTest", function (): void {
test.each([isCI, true])("should succeed on store detail and submit third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payouts = new Payouts(clientStore);
payout = new Payout(clientStore);
const request: IPayouts.StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest();
scope.post("/storeDetailAndSubmitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
const result = await payouts.storeDetailAndSubmitThirdParty.post(request);
const result = await payout.storeDetailAndSubmitThirdParty(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toBeTruthy();
});
test.each([false, true])("should succeed on store detail, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payouts = new Payouts(clientStore);
payout = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const request: StoreDetailRequest = mockStoreDetailRequest();
const result = await payouts.storeDetail.post(request);
const result = await payout.storeDetail(request);
expect("Success").toEqual(result.resultCode);
expect(result.pspReference).toBeTruthy();
@@ -146,12 +146,12 @@ describe("PayoutTest", function (): void {
test.each([isCI, true])("should succeed on confirm third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payouts = new Payouts(clientStore);
payout = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const storeRequest: StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payouts.storeDetail.post(storeRequest);
const storeResult = await payout.storeDetail(storeRequest);
payouts = new Payouts(clientReview);
payout = new Payout(clientReview);
scope.post("/confirmThirdParty")
.reply(200, {
pspReference: "8815131762537886",
@@ -162,7 +162,7 @@ describe("PayoutTest", function (): void {
merchantAccount: process.env.ADYEN_MERCHANT!,
originalReference: storeResult.pspReference
};
const result = await payouts.confirmThirdParty.post(request);
const result = await payout.confirmThirdParty(request);
expect(result.response).toEqual("[payout-confirm-received]");
expect(result.pspReference).toBeTruthy();
@@ -170,11 +170,11 @@ describe("PayoutTest", function (): void {
test.each([isCI, true])("should succeed on submit third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payouts = new Payouts(clientStore);
payout = new Payout(clientStore);
scope.post("/submitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
const request: IPayouts.SubmitRequest = mockSubmitRequest();
const result = await payouts.submitThirdParty.post(request);
const result = await payout.submitThirdparty(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toBeTruthy();
@@ -187,12 +187,12 @@ describe("PayoutTest", function (): void {
test.each([false, true])("should succeed on decline third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payouts = new Payouts(clientStore);
payout = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const storeRequest: StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payouts.storeDetail.post(storeRequest);
const storeResult = await payout.storeDetail(storeRequest);
payouts = new Payouts(clientReview);
payout = new Payout(clientReview);
const request: IPayouts.ModifyRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
originalReference: storeResult.pspReference
@@ -202,7 +202,7 @@ describe("PayoutTest", function (): void {
pspReference: "8815131762537886",
response: "[payout-decline-received]"
});
const result = await payouts.declineThirdParty.post(request);
const result = await payout.declineThirdParty(request);
expect(result.response).toEqual("[payout-decline-received]");
expect(result.pspReference).toBeTruthy();
@@ -216,9 +216,9 @@ describe("PayoutTest", function (): void {
});
const request = mockPayoutRequest();
const result = await payouts.payout.post(request);
const result = await payout.payout(request);
expect(result.resultCode).toEqual("Received");
expect(result.pspReference).toBeTruthy();
});
});
});

View File

@@ -121,7 +121,7 @@ describe("Platforms Test", function () {
async (...args) => {
const service = platforms.Account;
scope.post(`/Account/${Client.MARKETPAY_ACCOUNT_API_VERSION}//${args[0]}`).reply(200, args[2]);
const result = await service[args[0] as string].post(args[1] as never);
const result = await service[args[0] as string](args[1] as never);
expect(result).toMatchObject(args[2]);
}
);
@@ -144,7 +144,7 @@ describe("Platforms Test", function () {
const fund = platforms.Fund;
scope.post(`/Fund/${Client.MARKETPAY_FUND_API_VERSION}//${args[0]}`).reply(200, args[2]);
const result = await fund[args[0] as string].post(args[1] as never);
const result = await fund[args[0] as string](args[1] as never);
expect(result).toMatchObject(args[2]);
}
);
@@ -166,7 +166,7 @@ describe("Platforms Test", function () {
const notificationConfiguration = platforms.NotificationConfiguration;
scope.post(`/Notification/${Client.MARKETPAY_NOTIFICATION_CONFIGURATION_API_VERSION}//${args[0]}`).reply(200, args[2]);
const result = await notificationConfiguration[args[0] as string].post(args[1] as never);
const result = await notificationConfiguration[args[0] as string](args[1] as never);
expect(result).toMatchObject(args[2]);
}
);
@@ -182,7 +182,7 @@ describe("Platforms Test", function () {
const hostedOnboardingPage = platforms.HostedOnboardingPage;
scope.post(`/Hop/${Client.MARKETPAY_HOP_API_VERSION}//${args[0]}`).reply(200, args[2]);
const result = await hostedOnboardingPage[args[0] as string].post(args[1] as never);
const result = await hostedOnboardingPage[args[0] as string](args[1] as never);
expect(result).toMatchObject(args[2]);
}
);
@@ -191,46 +191,46 @@ describe("Platforms Test", function () {
describe.skip("Platforms Test E2E", function(): void {
beforeAll(async (done) => {
accountHolder = await platforms.Account.createAccountHolder.post({
accountHolder = await platforms.Account.createAccountHolder({
accountHolderCode: generateRandomCode(),
accountHolderDetails,
legalEntity: "Individual",
});
account = await platforms.Account.createAccount.post({
account = await platforms.Account.createAccount({
accountHolderCode: generateRandomCode(),
description: "This is a new account",
metadata: {meta: "data"},
payoutSchedule: "WEEKLY"
});
accountHolderToSuspend = await platforms.Account.createAccountHolder.post({
accountHolderToSuspend = await platforms.Account.createAccountHolder({
accountHolderCode: generateRandomCode(),
accountHolderDetails,
legalEntity: "Individual"
});
accountToClose = await platforms.Account.createAccount.post({
accountToClose = await platforms.Account.createAccount({
accountHolderCode: generateRandomCode(),
description: "This is a new account",
metadata: {meta: "data"},
payoutSchedule: "WEEKLY"
});
accountHolderToUnSuspend = await platforms.Account.createAccountHolder.post({
accountHolderToUnSuspend = await platforms.Account.createAccountHolder({
accountHolderCode: generateRandomCode(),
accountHolderDetails,
legalEntity: "Individual"
});
await platforms.Account.suspendAccountHolder.post({ accountHolderCode: accountHolderToUnSuspend.accountHolderCode});
await platforms.Account.suspendAccountHolder({ accountHolderCode: accountHolderToUnSuspend.accountHolderCode});
accountHolderToClose = await platforms.Account.createAccountHolder.post({
accountHolderToClose = await platforms.Account.createAccountHolder({
accountHolderCode: generateRandomCode(),
accountHolderDetails,
legalEntity: "Individual"
});
notificationConfigurationToRetrieve = await platforms.NotificationConfiguration.createNotificationConfiguration.post({
notificationConfigurationToRetrieve = await platforms.NotificationConfiguration.createNotificationConfiguration({
configurationDetails: {
...notificationConfigurationDetails,
description: `${generateRandomCode()}`
@@ -252,7 +252,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should get account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.getAccountHolder.post({
const result = await platforms.Account.getAccountHolder({
accountHolderCode: accountHolder.accountHolderCode,
});
expect(result.accountHolderDetails.email).toEqual("random_email@example.com");
@@ -264,7 +264,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should update account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.updateAccountHolder.post({
const result = await platforms.Account.updateAccountHolder({
accountHolderCode: accountHolder.accountHolderCode,
accountHolderDetails: {
...accountHolderDetails,
@@ -282,7 +282,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should check account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.checkAccountHolder.post({
const result = await platforms.Account.checkAccountHolder({
accountHolderCode: accountHolder.accountHolderCode,
accountStateType: "Processing",
tier: 2
@@ -305,7 +305,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should upload verification document", async function() {
nock.restore();
try {
const result = await platforms.Account.uploadDocument.post({
const result = await platforms.Account.uploadDocument({
documentContent,
documentDetail: {
accountHolderCode: account.accountHolderCode,
@@ -323,7 +323,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should get uploaded verification documents", async function() {
nock.restore();
try {
await platforms.Account.uploadDocument.post({
await platforms.Account.uploadDocument({
documentContent,
documentDetail: {
accountHolderCode: account.accountHolderCode,
@@ -332,7 +332,7 @@ describe.skip("Platforms Test E2E", function(): void {
filename: "IDCardFront.png"
}
});
const result = await platforms.Account.getUploadedDocuments.post({
const result = await platforms.Account.getUploadedDocuments({
accountHolderCode: account.accountHolderCode,
});
expect(result.documentDetails![0].filename).toEqual("IDCardFront.png");
@@ -344,7 +344,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should close account", async function() {
nock.restore();
try {
const result = await platforms.Account.closeAccount.post({
const result = await platforms.Account.closeAccount({
accountCode: accountToClose.accountCode
});
expect(result.status).toEqual("Closed");
@@ -356,7 +356,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should suspend account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.suspendAccountHolder.post({
const result = await platforms.Account.suspendAccountHolder({
accountHolderCode: accountHolderToSuspend.accountHolderCode,
});
expect(result.pspReference).toBeDefined();
@@ -368,7 +368,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should unsuspend account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.unSuspendAccountHolder.post({ accountHolderCode: accountHolderToUnSuspend.accountHolderCode });
const result = await platforms.Account.unSuspendAccountHolder({ accountHolderCode: accountHolderToUnSuspend.accountHolderCode });
expect(result.pspReference).toBeDefined();
} catch (e) {
assertError(e);
@@ -378,7 +378,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should update account holder state", async function() {
nock.restore();
try {
const result = await platforms.Account.updateAccountHolderState.post({
const result = await platforms.Account.updateAccountHolderState({
accountHolderCode: accountHolder.accountHolderCode,
disable: false,
stateType: "Payout"
@@ -392,7 +392,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should close account holder", async function() {
nock.restore();
try {
const result = await platforms.Account.closeAccountHolder.post({
const result = await platforms.Account.closeAccountHolder({
accountHolderCode: accountHolderToClose.accountHolderCode
});
expect(result.pspReference).toBeDefined();
@@ -408,7 +408,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should retrieve the balance of an account holder", async function() {
nock.restore();
try {
const result = await platforms.Fund.accountHolderBalance.post({
const result = await platforms.Fund.accountHolderBalance({
accountHolderCode: generateRandomCode()
});
expect(result.balancePerAccount![0].detailBalance).toBeDefined();
@@ -420,7 +420,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should retrieve a list of transaction for an account holder's accounts", async function() {
nock.restore();
try {
const result = await platforms.Fund.accountHolderTransactionList.post({
const result = await platforms.Fund.accountHolderTransactionList({
accountHolderCode: generateRandomCode()
});
expect(result.accountTransactionLists![0].transactions).toBeDefined();
@@ -432,7 +432,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should transfer funds between two accounts", async function() {
nock.restore();
try {
const result = await platforms.Fund.transferFunds.post({
const result = await platforms.Fund.transferFunds({
sourceAccountCode: "8515883280985939",
destinationAccountCode: "8815883278206345",
amount: {
@@ -454,7 +454,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should retrieve all Notification Configurations", async function() {
nock.restore();
try {
const result = await platforms.NotificationConfiguration.getNotificationConfigurationList.post({});
const result = await platforms.NotificationConfiguration.getNotificationConfigurationList({});
const resultStr = JSON.stringify(result);
expect(resultStr.includes("pspReference")).toBeTruthy();
} catch (e) {
@@ -465,7 +465,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should create a Notification Configuration", async function() {
nock.restore();
try {
const result = await platforms.NotificationConfiguration.createNotificationConfiguration.post({
const result = await platforms.NotificationConfiguration.createNotificationConfiguration({
configurationDetails: {
...notificationConfigurationDetails,
description: `${generateRandomCode()}`
@@ -481,7 +481,7 @@ describe.skip("Platforms Test E2E", function(): void {
nock.restore();
try {
configurationID = notificationConfigurationToRetrieve.configurationDetails.notificationId!;
const result = await platforms.NotificationConfiguration.getNotificationConfiguration.post({
const result = await platforms.NotificationConfiguration.getNotificationConfiguration({
notificationId: configurationID
});
expect(result.configurationDetails.notifyURL).toEqual("https://www.adyen.com/notification-handler");
@@ -493,7 +493,7 @@ describe.skip("Platforms Test E2E", function(): void {
it("should update a Notification Configuration", async function() {
nock.restore();
try {
const result = await platforms.NotificationConfiguration.updateNotificationConfiguration.post({
const result = await platforms.NotificationConfiguration.updateNotificationConfiguration({
configurationDetails: {
eventConfigs: [
{
@@ -521,7 +521,7 @@ describe.skip("Platforms Test E2E", function(): void {
const notificationIds = [];
notificationIds.push(configurationID);
try {
const result = await platforms.NotificationConfiguration.deleteNotificationConfigurations.post({notificationIds});
const result = await platforms.NotificationConfiguration.deleteNotificationConfigurations({notificationIds});
expect(result.pspReference).toBeDefined();
} catch (e) {
assertError(e);
@@ -529,4 +529,4 @@ describe.skip("Platforms Test E2E", function(): void {
});
});
});
});

View File

@@ -63,7 +63,7 @@ describe("Recurring", (): void => {
const request = createRecurringDetailsRequest();
try {
const result = await recurring.listRecurringDetails.post(request);
const result = await recurring.listRecurringDetails(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e.message);
@@ -76,7 +76,7 @@ describe("Recurring", (): void => {
.reply(200, paymentsSuccess);
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
const res = await checkout.payments.post(paymentsRequest);
const res = await checkout.payments(paymentsRequest);
scope.post("/disable")
.reply(200, disableSuccess);
@@ -88,7 +88,7 @@ describe("Recurring", (): void => {
};
try {
const result = await recurring.disable.post(request);
const result = await recurring.disable(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e.message);
@@ -119,7 +119,7 @@ describe("Recurring", (): void => {
};
try {
const result = await recurring.scheduleAccountUpdater.post(request);
const result = await recurring.scheduleAccountUpdater(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e.message);

View File

@@ -22,16 +22,16 @@ import HttpClientException from "../httpClient/httpClientException";
import ApiException from "../services/exception/apiException";
import { IRequest } from "../typings/requestOptions";
async function getJsonResponse<T>(this: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<string>;
async function getJsonResponse<T, R>(this: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<R>;
async function getJsonResponse<T>(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<string>;
async function getJsonResponse<T, R>(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<R>;
async function getJsonResponse<T, R> (
this: Resource,
async function getJsonResponse<T, R>(
resource: Resource,
jsonRequest: T | string,
requestOptions: IRequest.Options = {},
): Promise<R | string | HttpClientException | ApiException> {
const request = typeof jsonRequest === "string" ? jsonRequest : JSON.stringify(jsonRequest);
const response = await this.request(request, requestOptions);
const response = await resource.request(request, requestOptions);
try {
return typeof response === "string" ? JSON.parse(response) : response;
} catch (e) {

View File

@@ -26,6 +26,7 @@ interface ClientInterface {
request(
endpoint: string, json: string, config: Config, isApiKeyRequired: boolean, requestOptions?: IRequest.Options,
): Promise<string | HttpClientException | ApiException>;
post(endpoint: string, postParameters: [string, string][], config: Config): Promise<HttpClientException | string>;
proxy?: AgentOptions;
}

View File

@@ -70,18 +70,22 @@ class HttpURLConnectionClient implements ClientInterface {
return this.doPostRequest(httpConnection, json);
}
public post(endpoint: string, postParameters: [string, string][], config: Config): Promise<HttpClientException | string> {
const postQuery: string = this.getQuery(postParameters);
const connectionRequest: ClientRequest = this.createRequest(endpoint, {}, config.applicationName);
return this.doPostRequest(connectionRequest, postQuery);
}
private createRequest(endpoint: string, requestOptions: IRequest.Options, applicationName?: string): ClientRequest {
if (!requestOptions.headers) {
requestOptions.headers = {};
}
const url = new URL(endpoint);
const additionalPathname = requestOptions.id ? `/${requestOptions.id}` : "";
const pathname = `${url.pathname}${additionalPathname}`
requestOptions.hostname = url.hostname;
requestOptions.protocol = url.protocol;
requestOptions.port = url.port;
requestOptions.path = pathname;
requestOptions.path = url.pathname;
if (requestOptions && requestOptions.idempotencyKey) {
requestOptions.headers[ApiConstants.IDEMPOTENCY_KEY] = requestOptions.idempotencyKey;
@@ -107,6 +111,10 @@ class HttpURLConnectionClient implements ClientInterface {
return httpsRequest(requestOptions);
}
private getQuery(params: [string, string][]): string {
return params.map(([key, value]): string => `${key}=${value}`).join("&");
}
private doPostRequest(connectionRequest: ClientRequest, json: string): Promise<HttpClientException | string> {
return new Promise((resolve, reject): void => {
connectionRequest.flushHeaders();

View File

@@ -20,15 +20,30 @@ import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import GetCostEstimate from "./resource/binLookup/getCostEstimate";
import Get3dsAvailability from "./resource/binLookup/get3dsAvailability";
import getJsonResponse from "../helpers/getJsonResponse";
class BinLookup extends ApiKeyAuthenticatedService {
public readonly get3dsAvailability: Get3dsAvailability;
public readonly getCostEstimate: GetCostEstimate;
private readonly _get3dsAvailability: Get3dsAvailability;
private readonly _getCostEstimate: GetCostEstimate;
public constructor(client: Client) {
super(client);
this.get3dsAvailability = new Get3dsAvailability(this);
this.getCostEstimate = new GetCostEstimate(this);
this._get3dsAvailability = new Get3dsAvailability(this);
this._getCostEstimate = new GetCostEstimate(this);
}
public get3dsAvailability(request: IBinLookup.ThreeDSAvailabilityRequest): Promise<IBinLookup.ThreeDSAvailabilityResponse> {
return getJsonResponse<IBinLookup.ThreeDSAvailabilityRequest, IBinLookup.ThreeDSAvailabilityResponse>(
this._get3dsAvailability,
request
);
}
public getCostEstimate(request: IBinLookup.CostEstimateRequest): Promise<IBinLookup.CostEstimateResponse> {
return getJsonResponse<IBinLookup.CostEstimateRequest, IBinLookup.CostEstimateResponse>(
this._getCostEstimate,
request
);
}
}

View File

@@ -19,31 +19,142 @@
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import PaymentMethods from "./resource/checkout/paymentMethods";
import Payments from "./resource/checkout/payments";
import PaymentsDetails from "./resource/checkout/paymentsDetails";
import PaymentSession from "./resource/checkout/paymentSession";
import PaymentsResult from "./resource/checkout/paymentsResult";
import PaymentLinks from "./resource/checkout/paymentLinks";
import OriginKeys from "./resource/checkout/originKeys";
import setApplicationInfo from "../helpers/setApplicationInfo";
import { IRequest } from "../typings/requestOptions";
import PaymentLinksId from "./resource/checkout/paymentLinksId";
import PaymentMethodsBalance from "./resource/checkout/paymentMethodsBalance";
import Orders from "./resource/checkout/orders";
import OrdersCancel from "./resource/checkout/ordersCancel";
class Checkout extends ApiKeyAuthenticatedService {
public readonly payments: Payments;
public readonly paymentMethods: PaymentMethods;
public readonly paymentSession: PaymentSession;
public readonly paymentLinks: PaymentLinks;
public readonly originKeys: OriginKeys;
public readonly orders: Orders;
private readonly _payments: Payments;
private readonly _paymentMethods: PaymentMethods;
private readonly _paymentsDetails: PaymentsDetails;
private readonly _paymentSession: PaymentSession;
private readonly _paymentsResult: PaymentsResult;
private readonly _paymentLinks: PaymentLinks;
private readonly _paymentLinksId: PaymentLinksId;
private readonly _originKeys: OriginKeys;
private readonly _paymentMethodsBalance: PaymentMethodsBalance;
private readonly _orders: Orders;
private readonly _ordersCancel: OrdersCancel;
public constructor(client: Client) {
super(client);
this.payments = new Payments(this);
this.paymentMethods = new PaymentMethods(this);
this.paymentSession = new PaymentSession(this);
this.paymentLinks = new PaymentLinks(this);
this.originKeys = new OriginKeys(this);
this.orders = new Orders(this);
this._payments = new Payments(this);
this._paymentMethods = new PaymentMethods(this);
this._paymentsDetails = new PaymentsDetails(this);
this._paymentSession = new PaymentSession(this);
this._paymentsResult = new PaymentsResult(this);
this._paymentLinks = new PaymentLinks(this);
this._paymentLinksId = new PaymentLinksId(this);
this._originKeys = new OriginKeys(this);
this._paymentMethodsBalance = new PaymentMethodsBalance(this);
this._orders = new Orders(this);
this._ordersCancel = new OrdersCancel(this);
}
public payments(paymentsRequest: ICheckout.PaymentRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentResponse> {
return getJsonResponse<ICheckout.PaymentRequest, ICheckout.PaymentResponse>(
this._payments,
setApplicationInfo(paymentsRequest),
requestOptions,
);
}
public paymentMethods(paymentMethodsRequest: ICheckout.PaymentMethodsRequest): Promise<ICheckout.PaymentMethodsResponse> {
return getJsonResponse<ICheckout.PaymentMethodsRequest, ICheckout.PaymentMethodsResponse>(
this._paymentMethods,
paymentMethodsRequest,
);
}
public paymentLinks(paymentLinkRequest: ICheckout.CreatePaymentLinkRequest): Promise<ICheckout.PaymentLinkResource> {
return getJsonResponse<ICheckout.CreatePaymentLinkRequest, ICheckout.PaymentLinkResource>(
this._paymentLinks,
paymentLinkRequest
);
}
public getPaymentLinks(linkId: string): Promise<ICheckout.PaymentLinkResource> {
this._paymentLinksId.id = linkId;
return getJsonResponse<{}, ICheckout.PaymentLinkResource>(
this._paymentLinksId,
{},
{ method: "GET" }
);
}
public updatePaymentLinks(linkId: string, status: "expired"): Promise<ICheckout.PaymentLinkResource> {
this._paymentLinksId.id = linkId;
return getJsonResponse<{}, ICheckout.PaymentLinkResource>(
this._paymentLinksId,
{ status },
{ method: "PATCH" }
);
}
public paymentsDetails(paymentsDetailsRequest: ICheckout.DetailsRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentResponse> {
return getJsonResponse<ICheckout.DetailsRequest, ICheckout.PaymentResponse>(
this._paymentsDetails,
paymentsDetailsRequest,
requestOptions
);
}
public paymentSession(
paymentSessionRequest: ICheckout.PaymentSetupRequest,
requestOptions?: IRequest.Options,
): Promise<ICheckout.PaymentSetupResponse> {
return getJsonResponse<ICheckout.PaymentSetupRequest, ICheckout.PaymentSetupResponse>(
this._paymentSession,
paymentSessionRequest,
requestOptions,
);
}
public paymentResult(paymentResultRequest: ICheckout.PaymentVerificationRequest): Promise<ICheckout.PaymentVerificationResponse> {
return getJsonResponse<ICheckout.PaymentVerificationRequest, ICheckout.PaymentVerificationResponse>(
this._paymentsResult,
paymentResultRequest,
);
}
public originKeys(originKeysRequest: ICheckout.CheckoutUtilityRequest): Promise<ICheckout.CheckoutUtilityResponse> {
return getJsonResponse<ICheckout.CheckoutUtilityRequest, ICheckout.CheckoutUtilityResponse>(
this._originKeys,
originKeysRequest,
);
}
public paymentMethodsBalance(paymentMethodsBalanceRequest: ICheckout.CheckoutBalanceCheckRequest): Promise<ICheckout.CheckoutBalanceCheckResponse> {
return getJsonResponse<ICheckout.CheckoutBalanceCheckRequest, ICheckout.CheckoutBalanceCheckResponse>(
this._paymentMethodsBalance,
paymentMethodsBalanceRequest,
);
}
public orders(ordersRequest: ICheckout.CheckoutCreateOrderRequest): Promise<ICheckout.CheckoutCreateOrderResponse> {
return getJsonResponse<ICheckout.CheckoutCreateOrderRequest, ICheckout.CheckoutCreateOrderResponse>(
this._orders,
ordersRequest,
);
}
public ordersCancel(ordersCancelRequest: ICheckout.CheckoutCancelOrderRequest): Promise<ICheckout.CheckoutCancelOrderResponse> {
return getJsonResponse<ICheckout.CheckoutCancelOrderRequest, ICheckout.CheckoutCancelOrderResponse>(
this._ordersCancel,
ordersCancelRequest,
);
}
}
export default Checkout;

View File

@@ -23,5 +23,5 @@ export { default as CheckoutAPI } from "./checkout";
export { default as Recurring } from "./recurring";
export { default as Modification } from "./modification";
export { default as BinLookup } from "./binLookup";
export { default as Payouts } from "./payouts";
export { default as Payout } from "./payout";
export { default as Platforms } from "./platforms";

View File

@@ -17,6 +17,7 @@
* See the LICENSE file for more info.
*/
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import AdjustAuthorisation from "./resource/modification/adjustAuthorisation";
import Cancel from "./resource/modification/cancel";
@@ -24,25 +25,96 @@ import CancelOrRefund from "./resource/modification/cancelOrRefund";
import Capture from "./resource/modification/capture";
import Refund from "./resource/modification/refund";
import TechnicalCancel from "./resource/modification/technicalCancel";
import setApplicationInfo from "../helpers/setApplicationInfo";
import { ApplicationInfo } from "../typings/applicationInfo";
import { IRequest } from "../typings/requestOptions";
interface AppInfo { applicationInfo?: ApplicationInfo }
type GenericRequest<T> = T & AppInfo;
class Modification extends Service {
public readonly cancelOrRefund: CancelOrRefund;
public readonly cancel: Cancel;
public readonly capture: Capture;
public readonly refund: Refund;
public readonly adjustAuthorisation: AdjustAuthorisation;
public readonly technicalCancel: TechnicalCancel;
private readonly _cancelOrRefund: CancelOrRefund;
private readonly _cancel: Cancel;
private readonly _capture: Capture;
private readonly _refund: Refund;
private readonly _adjustAuthorisation: AdjustAuthorisation;
private readonly _technicalCancel: TechnicalCancel;
public constructor(client: Client) {
super(client);
this.capture = new Capture(this);
this.cancelOrRefund = new CancelOrRefund(this);
this.cancel = new Cancel(this);
this.refund = new Refund(this);
this.adjustAuthorisation = new AdjustAuthorisation(this);
this.technicalCancel = new TechnicalCancel(this);
this._capture = new Capture(this);
this._cancelOrRefund = new CancelOrRefund(this);
this._cancel = new Cancel(this);
this._refund = new Refund(this);
this._adjustAuthorisation = new AdjustAuthorisation(this);
this._technicalCancel = new TechnicalCancel(this);
}
public capture(
captureRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._capture,
setApplicationInfo(captureRequest),
requestOptions,
);
}
public cancelOrRefund(
cancelOrRefundRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._cancelOrRefund,
setApplicationInfo(cancelOrRefundRequest),
requestOptions,
);
}
public refund(
refundRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._refund,
setApplicationInfo(refundRequest),
requestOptions,
);
}
public cancel(
cancelRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._cancel,
setApplicationInfo(cancelRequest),
requestOptions,
);
}
public technicalCancel(
technicalCancelRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._technicalCancel,
setApplicationInfo(technicalCancelRequest),
requestOptions,
);
}
public adjustAuthorisation(
adjustAuthorisationRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse<IPayments.ModificationRequest, IPayments.ModificationResult>(
this._adjustAuthorisation,
setApplicationInfo(adjustAuthorisationRequest),
requestOptions,
);
}
}
export default Modification;

91
src/services/payout.ts Normal file
View File

@@ -0,0 +1,91 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../client";
import Service from "../service";
import DeclineThirdParty from "./resource/payout/declineThirdParty";
import StoreDetail from "./resource/payout/storeDetail";
import SubmitThirdParty from "./resource/payout/submitThirdParty";
import ConfirmThirdParty from "./resource/payout/confirmThirdParty";
import PayoutResource from "./resource/payout/payout";
import StoreDetailAndSubmitThirdParty from "./resource/payout/storeDetailAndSubmitThirdParty";
import getJsonResponse from "../helpers/getJsonResponse";
class Payout extends Service {
private readonly _storeDetailAndSubmitThirdParty: StoreDetailAndSubmitThirdParty;
private readonly _confirmThirdParty: ConfirmThirdParty;
private readonly _declineThirdParty: DeclineThirdParty;
private readonly _storeDetail: StoreDetail;
private readonly _submitThirdParty: SubmitThirdParty;
private readonly _payout: PayoutResource;
public constructor(client: Client) {
super(client);
this._storeDetailAndSubmitThirdParty = new StoreDetailAndSubmitThirdParty(this);
this._confirmThirdParty = new ConfirmThirdParty(this);
this._declineThirdParty = new DeclineThirdParty(this);
this._storeDetail = new StoreDetail(this);
this._submitThirdParty = new SubmitThirdParty(this);
this._payout = new PayoutResource(this);
}
public storeDetailAndSubmitThirdParty(request: IPayouts.StoreDetailAndSubmitRequest): Promise<IPayouts.StoreDetailAndSubmitResponse> {
return getJsonResponse<IPayouts.StoreDetailAndSubmitRequest, IPayouts.StoreDetailAndSubmitResponse>(
this._storeDetailAndSubmitThirdParty,
request
);
}
public confirmThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
return getJsonResponse<IPayouts.ModifyRequest, IPayouts.ModifyResponse>(
this._confirmThirdParty,
request
);
}
public declineThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
return getJsonResponse<IPayouts.ModifyRequest, IPayouts.ModifyResponse>(
this._declineThirdParty,
request
);
}
public storeDetail(request: IPayouts.StoreDetailRequest): Promise<IPayouts.StoreDetailResponse> {
return getJsonResponse<IPayouts.StoreDetailRequest, IPayouts.StoreDetailResponse>(
this._storeDetail,
request
);
}
public submitThirdparty(request: IPayouts.SubmitRequest): Promise<IPayouts.SubmitResponse> {
return getJsonResponse<IPayouts.SubmitRequest, IPayouts.SubmitResponse>(
this._submitThirdParty,
request
);
}
public payout(request: IPayouts.PayoutRequest): Promise<IPayouts.PayoutResponse> {
return getJsonResponse<IPayouts.PayoutRequest, IPayouts.PayoutResponse>(
this._payout,
request
);
}
}
export default Payout;

View File

@@ -1,48 +0,0 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../client";
import Service from "../service";
import DeclineThirdParty from "./resource/payout/declineThirdParty";
import StoreDetail from "./resource/payout/storeDetail";
import SubmitThirdParty from "./resource/payout/submitThirdParty";
import ConfirmThirdParty from "./resource/payout/confirmThirdParty";
import PayoutResource from "./resource/payout/payout";
import StoreDetailAndSubmitThirdParty from "./resource/payout/storeDetailAndSubmitThirdParty";
class Payouts extends Service {
public readonly storeDetailAndSubmitThirdParty: StoreDetailAndSubmitThirdParty;
public readonly confirmThirdParty: ConfirmThirdParty;
public readonly declineThirdParty: DeclineThirdParty;
public readonly storeDetail: StoreDetail;
public readonly submitThirdParty: SubmitThirdParty;
public readonly payout: PayoutResource;
public constructor(client: Client) {
super(client);
this.storeDetailAndSubmitThirdParty = new StoreDetailAndSubmitThirdParty(this);
this.confirmThirdParty = new ConfirmThirdParty(this);
this.declineThirdParty = new DeclineThirdParty(this);
this.storeDetail = new StoreDetail(this);
this.submitThirdParty = new SubmitThirdParty(this);
this.payout = new PayoutResource(this);
}
}
export default Payouts;

View File

@@ -34,133 +34,132 @@ type AccountsAccount = PlatformsAccount<AccountType>;
type AccountsVerification = PlatformsAccount<VerificationType>;
type AccountsAccountHolders = PlatformsAccount<AccountHoldersType>;
type PlatformsTypes = AccountsAccount | AccountsVerification | AccountsAccountHolders | PlatformsFund | PlatformsHostedOnboardingPage;
type PostRequest<T, U> = { post: (request: T) => Promise<U> };
class Platforms extends Service {
/* PlatformsAccount */
// Accounts
public readonly closeAccount: PlatformsAccount<AccountType>;
public readonly updateAccount: PlatformsAccount<AccountType>;
public readonly createAccount: PlatformsAccount<AccountType>;
private readonly _closeAccount: PlatformsAccount<AccountType>;
private readonly _updateAccount: PlatformsAccount<AccountType>;
private readonly _createAccount: PlatformsAccount<AccountType>;
// Verification
public readonly uploadDocument: PlatformsAccount<VerificationType>;
public readonly getUploadedDocuments: PlatformsAccount<VerificationType>;
public readonly deleteBankAccounts: PlatformsAccount<VerificationType>;
public readonly deletePayoutMethods: PlatformsAccount<VerificationType>;
public readonly deleteShareholders: PlatformsAccount<VerificationType>;
public readonly checkAccountHolder: PlatformsAccount<VerificationType>;
private readonly _uploadDocument: PlatformsAccount<VerificationType>;
private readonly _getUploadedDocuments: PlatformsAccount<VerificationType>;
private readonly _deleteBankAccounts: PlatformsAccount<VerificationType>;
private readonly _deletePayoutMethods: PlatformsAccount<VerificationType>;
private readonly _deleteShareholders: PlatformsAccount<VerificationType>;
private readonly _checkAccountHolder: PlatformsAccount<VerificationType>;
// Account Holders
public readonly createAccountHolder: PlatformsAccount<AccountHoldersType>;
public readonly getAccountHolder: PlatformsAccount<AccountHoldersType>;
public readonly updateAccountHolder: PlatformsAccount<AccountHoldersType>;
public readonly updateAccountHolderState: PlatformsAccount<AccountHoldersType>;
public readonly suspendAccountHolder: PlatformsAccount<AccountHoldersType>;
public readonly unSuspendAccountHolder: PlatformsAccount<AccountHoldersType>;
public readonly closeAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _createAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _getAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _updateAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _updateAccountHolderState: PlatformsAccount<AccountHoldersType>;
private readonly _suspendAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _unSuspendAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _closeAccountHolder: PlatformsAccount<AccountHoldersType>;
/* PlatformsFund */
public readonly accountHolderBalance: PlatformsFund;
public readonly accountHolderTransactionList: PlatformsFund;
public readonly payoutAccountHolder: PlatformsFund;
public readonly transferFunds: PlatformsFund;
public readonly refundFundsTransfer: PlatformsFund;
public readonly setupBeneficiary: PlatformsFund;
public readonly refundNotPaidOutTransfers: PlatformsFund;
private readonly _accountHolderBalance: PlatformsFund;
private readonly _accountHolderTransactionList: PlatformsFund;
private readonly _payoutAccountHolder: PlatformsFund;
private readonly _transferFunds: PlatformsFund;
private readonly _refundFundsTransfer: PlatformsFund;
private readonly _setupBeneficiary: PlatformsFund;
private readonly _refundNotPaidOutTransfers: PlatformsFund;
/* HOP */
public readonly getOnboardingUrl: PlatformsHostedOnboardingPage;
private readonly _getOnboardingUrl: PlatformsHostedOnboardingPage;
/* Notification Configuration */
public readonly createNotificationConfiguration: PlatformsNotificationConfiguration;
public readonly getNotificationConfiguration: PlatformsNotificationConfiguration;
public readonly getNotificationConfigurationList: PlatformsNotificationConfiguration;
public readonly testNotificationConfiguration: PlatformsNotificationConfiguration;
public readonly updateNotificationConfiguration: PlatformsNotificationConfiguration;
public readonly deleteNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _createNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _getNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _getNotificationConfigurationList: PlatformsNotificationConfiguration;
private readonly _testNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _updateNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _deleteNotificationConfiguration: PlatformsNotificationConfiguration;
public constructor(client: Client) {
super(client);
// Account
this.closeAccount = new PlatformsAccount<AccountType>(this, "/closeAccount");
this.updateAccount = new PlatformsAccount<AccountType>(this, "/updateAccount");
this.createAccount = new PlatformsAccount<AccountType>(this, "/createAccount");
this.uploadDocument = new PlatformsAccount<VerificationType>(this, "/uploadDocument");
this.getUploadedDocuments = new PlatformsAccount<VerificationType>(this, "/getUploadedDocuments");
this.deleteBankAccounts = new PlatformsAccount<VerificationType>(this, "/deleteBankAccounts");
this.deletePayoutMethods = new PlatformsAccount<VerificationType>(this, "/deletePayoutMethods");
this.deleteShareholders = new PlatformsAccount<VerificationType>(this, "/deleteShareholders");
this.checkAccountHolder = new PlatformsAccount<VerificationType>(this, "/checkAccountHolder");
this.createAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/createAccountHolder");
this.getAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/getAccountHolder");
this.updateAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolder");
this.updateAccountHolderState = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolderState");
this.suspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/suspendAccountHolder");
this.unSuspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/unSuspendAccountHolder");
this.closeAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/closeAccountHolder");
this._closeAccount = new PlatformsAccount<AccountType>(this, "/closeAccount");
this._updateAccount = new PlatformsAccount<AccountType>(this, "/updateAccount");
this._createAccount = new PlatformsAccount<AccountType>(this, "/createAccount");
this._uploadDocument = new PlatformsAccount<VerificationType>(this, "/uploadDocument");
this._getUploadedDocuments = new PlatformsAccount<VerificationType>(this, "/getUploadedDocuments");
this._deleteBankAccounts = new PlatformsAccount<VerificationType>(this, "/deleteBankAccounts");
this._deletePayoutMethods = new PlatformsAccount<VerificationType>(this, "/deletePayoutMethods");
this._deleteShareholders = new PlatformsAccount<VerificationType>(this, "/deleteShareholders");
this._checkAccountHolder = new PlatformsAccount<VerificationType>(this, "/checkAccountHolder");
this._createAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/createAccountHolder");
this._getAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/getAccountHolder");
this._updateAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolder");
this._updateAccountHolderState = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolderState");
this._suspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/suspendAccountHolder");
this._unSuspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/unSuspendAccountHolder");
this._closeAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/closeAccountHolder");
// Fund
this.accountHolderBalance = new PlatformsFund(this, "/accountHolderBalance");
this.accountHolderTransactionList = new PlatformsFund(this, "/accountHolderTransactionList");
this.payoutAccountHolder = new PlatformsFund(this, "/payoutAccountHolder");
this.transferFunds = new PlatformsFund(this, "/transferFunds");
this.refundFundsTransfer = new PlatformsFund(this, "/refundFundsTransfer");
this.setupBeneficiary = new PlatformsFund(this, "/setupBeneficiary");
this.refundNotPaidOutTransfers = new PlatformsFund(this, "/refundNotPaidOutTransfers");
this._accountHolderBalance = new PlatformsFund(this, "/accountHolderBalance");
this._accountHolderTransactionList = new PlatformsFund(this, "/accountHolderTransactionList");
this._payoutAccountHolder = new PlatformsFund(this, "/payoutAccountHolder");
this._transferFunds = new PlatformsFund(this, "/transferFunds");
this._refundFundsTransfer = new PlatformsFund(this, "/refundFundsTransfer");
this._setupBeneficiary = new PlatformsFund(this, "/setupBeneficiary");
this._refundNotPaidOutTransfers = new PlatformsFund(this, "/refundNotPaidOutTransfers");
// HOP
this.getOnboardingUrl = new PlatformsHostedOnboardingPage(this, "/getOnboardingUrl");
this._getOnboardingUrl = new PlatformsHostedOnboardingPage(this, "/getOnboardingUrl");
// Notification Configuration
this.createNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/createNotificationConfiguration");
this.getNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/getNotificationConfiguration");
this.getNotificationConfigurationList = new PlatformsNotificationConfiguration(this, "/getNotificationConfigurationList");
this.testNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/testNotificationConfiguration");
this.updateNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/updateNotificationConfiguration");
this.deleteNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/deleteNotificationConfigurations");
this._createNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/createNotificationConfiguration");
this._getNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/getNotificationConfiguration");
this._getNotificationConfigurationList = new PlatformsNotificationConfiguration(this, "/getNotificationConfigurationList");
this._testNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/testNotificationConfiguration");
this._updateNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/updateNotificationConfiguration");
this._deleteNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/deleteNotificationConfigurations");
}
createPostRequest = <T extends PlatformsTypes, U, V>(service: T): PostRequest<U, V> => {
return { post: (request: U): Promise<V> => getJsonResponse.call<T, [U], Promise<V>>(service, request) };
createRequest = <T extends PlatformsTypes, U, V>(service: T) => {
return (request: U): Promise<V> => getJsonResponse<U, V>(service, request);
}
public get Account(): {
getAccountHolder: PostRequest<IPlatformsAccount.GetAccountHolderRequest, IPlatformsAccount.GetAccountHolderResponse>;
getUploadedDocuments: PostRequest<IPlatformsAccount.GetUploadedDocumentsRequest, IPlatformsAccount.GetUploadedDocumentsResponse>;
createAccountHolder: PostRequest<IPlatformsAccount.CreateAccountHolderRequest, IPlatformsAccount.CreateAccountHolderResponse>;
closeAccountHolder: PostRequest<IPlatformsAccount.CloseAccountHolderRequest, IPlatformsAccount.CloseAccountHolderResponse>;
createAccount: PostRequest<IPlatformsAccount.CreateAccountRequest, IPlatformsAccount.CreateAccountResponse>;
deleteBankAccounts: PostRequest<IPlatformsAccount.DeleteBankAccountRequest, IPlatformsAccount.GenericResponse>;
deletePayoutMethods: PostRequest<IPlatformsAccount.DeletePayoutMethodRequest, IPlatformsAccount.GenericResponse>;
updateAccount: PostRequest<IPlatformsAccount.UpdateAccountRequest, IPlatformsAccount.UpdateAccountResponse>;
uploadDocument: PostRequest<IPlatformsAccount.UploadDocumentRequest, IPlatformsAccount.GetUploadedDocumentsResponse>;
unSuspendAccountHolder: PostRequest<IPlatformsAccount.UnSuspendAccountHolderRequest, IPlatformsAccount.UnSuspendAccountHolderResponse>;
closeAccount: PostRequest<IPlatformsAccount.CloseAccountRequest, IPlatformsAccount.CloseAccountResponse>;
suspendAccountHolder: PostRequest<IPlatformsAccount.SuspendAccountHolderRequest, IPlatformsAccount.SuspendAccountHolderResponse>;
updateAccountHolder: PostRequest<IPlatformsAccount.UpdateAccountHolderRequest, IPlatformsAccount.UpdateAccountHolderResponse>;
deleteShareholders: PostRequest<IPlatformsAccount.DeleteShareholderRequest, IPlatformsAccount.GenericResponse>;
checkAccountHolder: PostRequest<IPlatformsAccount.PerformVerificationRequest, IPlatformsAccount.GenericResponse>;
updateAccountHolderState: PostRequest<IPlatformsAccount.UpdateAccountHolderStateRequest, IPlatformsAccount.GetAccountHolderStatusResponse>;
getAccountHolder: (request: IPlatformsAccount.GetAccountHolderRequest) => Promise<IPlatformsAccount.GetAccountHolderResponse>;
getUploadedDocuments: (request: IPlatformsAccount.GetUploadedDocumentsRequest) => Promise<IPlatformsAccount.GetUploadedDocumentsResponse>;
createAccountHolder: (request: IPlatformsAccount.CreateAccountHolderRequest) => Promise<IPlatformsAccount.CreateAccountHolderResponse>;
closeAccountHolder: (request: IPlatformsAccount.CloseAccountHolderRequest) => Promise<IPlatformsAccount.CloseAccountHolderResponse>;
createAccount: (request: IPlatformsAccount.CreateAccountRequest) => Promise<IPlatformsAccount.CreateAccountResponse>;
deleteBankAccounts: (request: IPlatformsAccount.DeleteBankAccountRequest) => Promise<IPlatformsAccount.GenericResponse>;
deletePayoutMethods: (request: IPlatformsAccount.DeletePayoutMethodRequest) => Promise<IPlatformsAccount.GenericResponse>;
updateAccount: (request: IPlatformsAccount.UpdateAccountRequest) => Promise<IPlatformsAccount.UpdateAccountResponse>;
uploadDocument: (request: IPlatformsAccount.UploadDocumentRequest) => Promise<IPlatformsAccount.GetUploadedDocumentsResponse>;
unSuspendAccountHolder: (request: IPlatformsAccount.UnSuspendAccountHolderRequest) => Promise<IPlatformsAccount.UnSuspendAccountHolderResponse>;
closeAccount: (request: IPlatformsAccount.CloseAccountRequest) => Promise<IPlatformsAccount.CloseAccountResponse>;
suspendAccountHolder: (request: IPlatformsAccount.SuspendAccountHolderRequest) => Promise<IPlatformsAccount.SuspendAccountHolderResponse>;
updateAccountHolder: (request: IPlatformsAccount.UpdateAccountHolderRequest) => Promise<IPlatformsAccount.UpdateAccountHolderResponse>;
deleteShareholders: (request: IPlatformsAccount.DeleteShareholderRequest) => Promise<IPlatformsAccount.GenericResponse>;
checkAccountHolder: (request: IPlatformsAccount.PerformVerificationRequest) => Promise<IPlatformsAccount.GenericResponse>;
updateAccountHolderState: (request: IPlatformsAccount.UpdateAccountHolderStateRequest) => Promise<IPlatformsAccount.GetAccountHolderStatusResponse>;
} {
const closeAccount = this.createPostRequest<AccountsAccount, IPlatformsAccount.CloseAccountRequest, IPlatformsAccount.CloseAccountResponse>(this.closeAccount);
const updateAccount = this.createPostRequest<AccountsAccount, IPlatformsAccount.UpdateAccountRequest, IPlatformsAccount.UpdateAccountResponse>(this.updateAccount);
const createAccount = this.createPostRequest<AccountsAccount, IPlatformsAccount.CreateAccountRequest, IPlatformsAccount.CreateAccountResponse>(this.createAccount);
const closeAccount = this.createRequest<AccountsAccount, IPlatformsAccount.CloseAccountRequest, IPlatformsAccount.CloseAccountResponse>(this._closeAccount);
const updateAccount = this.createRequest<AccountsAccount, IPlatformsAccount.UpdateAccountRequest, IPlatformsAccount.UpdateAccountResponse>(this._updateAccount);
const createAccount = this.createRequest<AccountsAccount, IPlatformsAccount.CreateAccountRequest, IPlatformsAccount.CreateAccountResponse>(this._createAccount);
const uploadDocument = this.createPostRequest<AccountsVerification, IPlatformsAccount.UploadDocumentRequest, IPlatformsAccount.GetUploadedDocumentsResponse>(this.uploadDocument);
const getUploadedDocuments = this.createPostRequest<AccountsVerification, IPlatformsAccount.GetUploadedDocumentsRequest, IPlatformsAccount.GetUploadedDocumentsResponse>(this.getUploadedDocuments);
const deleteBankAccounts = this.createPostRequest<AccountsVerification, IPlatformsAccount.DeleteBankAccountRequest, IPlatformsAccount.GenericResponse>(this.deleteBankAccounts);
const deletePayoutMethods = this.createPostRequest<AccountsVerification, IPlatformsAccount.DeletePayoutMethodRequest, IPlatformsAccount.GenericResponse>(this.deletePayoutMethods);
const deleteShareholders = this.createPostRequest<AccountsVerification, IPlatformsAccount.DeleteShareholderRequest, IPlatformsAccount.GenericResponse>(this.deleteShareholders);
const uploadDocument = this.createRequest<AccountsVerification, IPlatformsAccount.UploadDocumentRequest, IPlatformsAccount.GetUploadedDocumentsResponse>(this._uploadDocument);
const getUploadedDocuments = this.createRequest<AccountsVerification, IPlatformsAccount.GetUploadedDocumentsRequest, IPlatformsAccount.GetUploadedDocumentsResponse>(this._getUploadedDocuments);
const deleteBankAccounts = this.createRequest<AccountsVerification, IPlatformsAccount.DeleteBankAccountRequest, IPlatformsAccount.GenericResponse>(this._deleteBankAccounts);
const deletePayoutMethods = this.createRequest<AccountsVerification, IPlatformsAccount.DeletePayoutMethodRequest, IPlatformsAccount.GenericResponse>(this._deletePayoutMethods);
const deleteShareholders = this.createRequest<AccountsVerification, IPlatformsAccount.DeleteShareholderRequest, IPlatformsAccount.GenericResponse>(this._deleteShareholders);
const createAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.CreateAccountHolderRequest, IPlatformsAccount.CreateAccountHolderResponse>(this.createAccountHolder);
const getAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.GetAccountHolderRequest, IPlatformsAccount.GetAccountHolderResponse>(this.getAccountHolder);
const updateAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderRequest, IPlatformsAccount.UpdateAccountHolderResponse>(this.updateAccountHolder);
const updateAccountHolderState = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderStateRequest, IPlatformsAccount.GetAccountHolderStatusResponse>(this.updateAccountHolderState);
const suspendAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.SuspendAccountHolderRequest, IPlatformsAccount.SuspendAccountHolderResponse>(this.suspendAccountHolder);
const unSuspendAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.UnSuspendAccountHolderRequest, IPlatformsAccount.UnSuspendAccountHolderResponse>(this.unSuspendAccountHolder);
const closeAccountHolder = this.createPostRequest<AccountsAccountHolders, IPlatformsAccount.CloseAccountHolderRequest, IPlatformsAccount.CloseAccountHolderResponse>(this.closeAccountHolder);
const checkAccountHolder = this.createPostRequest<AccountsVerification, IPlatformsAccount.PerformVerificationRequest, IPlatformsAccount.GenericResponse>(this.checkAccountHolder);
const createAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.CreateAccountHolderRequest, IPlatformsAccount.CreateAccountHolderResponse>(this._createAccountHolder);
const getAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.GetAccountHolderRequest, IPlatformsAccount.GetAccountHolderResponse>(this._getAccountHolder);
const updateAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderRequest, IPlatformsAccount.UpdateAccountHolderResponse>(this._updateAccountHolder);
const updateAccountHolderState = this.createRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderStateRequest, IPlatformsAccount.GetAccountHolderStatusResponse>(this._updateAccountHolderState);
const suspendAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.SuspendAccountHolderRequest, IPlatformsAccount.SuspendAccountHolderResponse>(this._suspendAccountHolder);
const unSuspendAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.UnSuspendAccountHolderRequest, IPlatformsAccount.UnSuspendAccountHolderResponse>(this._unSuspendAccountHolder);
const closeAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.CloseAccountHolderRequest, IPlatformsAccount.CloseAccountHolderResponse>(this._closeAccountHolder);
const checkAccountHolder = this.createRequest<AccountsVerification, IPlatformsAccount.PerformVerificationRequest, IPlatformsAccount.GenericResponse>(this._checkAccountHolder);
const accounts = { closeAccount, updateAccount, createAccount };
const verification = { uploadDocument, getUploadedDocuments, deleteBankAccounts, deletePayoutMethods, deleteShareholders, checkAccountHolder };
@@ -170,45 +169,45 @@ class Platforms extends Service {
}
public get Fund(): {
refundNotPaidOutTransfers: PostRequest<IPlatformsFund.RefundNotPaidOutTransfersRequest, IPlatformsFund.RefundNotPaidOutTransfersResponse>;
accountHolderTransactionList: PostRequest<IPlatformsFund.AccountHolderTransactionListRequest, IPlatformsFund.AccountHolderTransactionListResponse>;
setupBeneficiary: PostRequest<IPlatformsFund.SetupBeneficiaryRequest, IPlatformsFund.SetupBeneficiaryResponse>;
transferFunds: PostRequest<IPlatformsFund.TransferFundsRequest, IPlatformsFund.TransferFundsResponse>;
refundFundsTransfer: PostRequest<IPlatformsFund.RefundFundsTransferRequest, IPlatformsFund.RefundFundsTransferResponse>;
payoutAccountHolder: PostRequest<IPlatformsFund.PayoutAccountHolderRequest, IPlatformsFund.PayoutAccountHolderResponse>;
accountHolderBalance: PostRequest<IPlatformsFund.AccountHolderBalanceRequest, IPlatformsFund.AccountHolderBalanceResponse>;
refundNotPaidOutTransfers: (request: IPlatformsFund.RefundNotPaidOutTransfersRequest) => Promise<IPlatformsFund.RefundNotPaidOutTransfersResponse>;
accountHolderTransactionList: (request: IPlatformsFund.AccountHolderTransactionListRequest) => Promise<IPlatformsFund.AccountHolderTransactionListResponse>;
setupBeneficiary: (request: IPlatformsFund.SetupBeneficiaryRequest) => Promise<IPlatformsFund.SetupBeneficiaryResponse>;
transferFunds: (request: IPlatformsFund.TransferFundsRequest) => Promise<IPlatformsFund.TransferFundsResponse>;
refundFundsTransfer: (request: IPlatformsFund.RefundFundsTransferRequest) => Promise<IPlatformsFund.RefundFundsTransferResponse>;
payoutAccountHolder: (request: IPlatformsFund.PayoutAccountHolderRequest) => Promise<IPlatformsFund.PayoutAccountHolderResponse>;
accountHolderBalance: (request: IPlatformsFund.AccountHolderBalanceRequest) => Promise<IPlatformsFund.AccountHolderBalanceResponse>;
} {
const accountHolderBalance = this.createPostRequest<PlatformsFund, IPlatformsFund.AccountHolderBalanceRequest, IPlatformsFund.AccountHolderBalanceResponse>(this.accountHolderBalance);
const accountHolderTransactionList = this.createPostRequest<PlatformsFund, IPlatformsFund.AccountHolderTransactionListRequest, IPlatformsFund.AccountHolderTransactionListResponse>(this.accountHolderTransactionList);
const payoutAccountHolder = this.createPostRequest<PlatformsFund, IPlatformsFund.PayoutAccountHolderRequest, IPlatformsFund.PayoutAccountHolderResponse>(this.payoutAccountHolder);
const transferFunds = this.createPostRequest<PlatformsFund, IPlatformsFund.TransferFundsRequest, IPlatformsFund.TransferFundsResponse>(this.transferFunds);
const refundFundsTransfer = this.createPostRequest<PlatformsFund, IPlatformsFund.RefundFundsTransferRequest, IPlatformsFund.RefundFundsTransferResponse>(this.refundFundsTransfer);
const setupBeneficiary = this.createPostRequest<PlatformsFund, IPlatformsFund.SetupBeneficiaryRequest, IPlatformsFund.SetupBeneficiaryResponse>(this.setupBeneficiary);
const refundNotPaidOutTransfers = this.createPostRequest<PlatformsFund, IPlatformsFund.RefundNotPaidOutTransfersRequest, IPlatformsFund.RefundNotPaidOutTransfersResponse>(this.refundNotPaidOutTransfers);
const accountHolderBalance = this.createRequest<PlatformsFund, IPlatformsFund.AccountHolderBalanceRequest, IPlatformsFund.AccountHolderBalanceResponse>(this._accountHolderBalance);
const accountHolderTransactionList = this.createRequest<PlatformsFund, IPlatformsFund.AccountHolderTransactionListRequest, IPlatformsFund.AccountHolderTransactionListResponse>(this._accountHolderTransactionList);
const payoutAccountHolder = this.createRequest<PlatformsFund, IPlatformsFund.PayoutAccountHolderRequest, IPlatformsFund.PayoutAccountHolderResponse>(this._payoutAccountHolder);
const transferFunds = this.createRequest<PlatformsFund, IPlatformsFund.TransferFundsRequest, IPlatformsFund.TransferFundsResponse>(this._transferFunds);
const refundFundsTransfer = this.createRequest<PlatformsFund, IPlatformsFund.RefundFundsTransferRequest, IPlatformsFund.RefundFundsTransferResponse>(this._refundFundsTransfer);
const setupBeneficiary = this.createRequest<PlatformsFund, IPlatformsFund.SetupBeneficiaryRequest, IPlatformsFund.SetupBeneficiaryResponse>(this._setupBeneficiary);
const refundNotPaidOutTransfers = this.createRequest<PlatformsFund, IPlatformsFund.RefundNotPaidOutTransfersRequest, IPlatformsFund.RefundNotPaidOutTransfersResponse>(this._refundNotPaidOutTransfers);
return { accountHolderBalance, accountHolderTransactionList, payoutAccountHolder, refundFundsTransfer, transferFunds, setupBeneficiary, refundNotPaidOutTransfers };
}
public get HostedOnboardingPage(): { getOnboardingUrl: PostRequest<IPlatformsHostedOnboardingPage.GetOnboardingUrlRequest, IPlatformsHostedOnboardingPage.GetOnboardingUrlResponse> } {
const getOnboardingUrl = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsHostedOnboardingPage.GetOnboardingUrlRequest, IPlatformsHostedOnboardingPage.GetOnboardingUrlResponse>(this.getOnboardingUrl);
public get HostedOnboardingPage(): { getOnboardingUrl: (request: IPlatformsHostedOnboardingPage.GetOnboardingUrlRequest) => Promise<IPlatformsHostedOnboardingPage.GetOnboardingUrlResponse> } {
const getOnboardingUrl = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsHostedOnboardingPage.GetOnboardingUrlRequest, IPlatformsHostedOnboardingPage.GetOnboardingUrlResponse>(this._getOnboardingUrl);
return { getOnboardingUrl };
}
public get NotificationConfiguration(): {
createNotificationConfiguration: PostRequest<IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
updateNotificationConfiguration: PostRequest<IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
getNotificationConfiguration: PostRequest<IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
testNotificationConfiguration: PostRequest<IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest, IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>;
getNotificationConfigurationList: PostRequest<{}, IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>;
deleteNotificationConfigurations: PostRequest<IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GenericResponse>;
createNotificationConfiguration: (request: IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
updateNotificationConfiguration: (request: IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
getNotificationConfiguration: (request: IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
testNotificationConfiguration: (request: IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>;
getNotificationConfigurationList: (request: {}) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>;
deleteNotificationConfigurations: (request: IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GenericResponse>;
} {
const createNotificationConfiguration = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this.createNotificationConfiguration);
const getNotificationConfiguration = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this.getNotificationConfiguration);
const getNotificationConfigurationList = this.createPostRequest<PlatformsHostedOnboardingPage, {}, IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>(this.getNotificationConfigurationList);
const testNotificationConfiguration = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest, IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>(this.testNotificationConfiguration);
const updateNotificationConfiguration = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this.updateNotificationConfiguration);
const deleteNotificationConfigurations = this.createPostRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GenericResponse>(this.deleteNotificationConfiguration);
const createNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._createNotificationConfiguration);
const getNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._getNotificationConfiguration);
const getNotificationConfigurationList = this.createRequest<PlatformsHostedOnboardingPage, {}, IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>(this._getNotificationConfigurationList);
const testNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest, IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>(this._testNotificationConfiguration);
const updateNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._updateNotificationConfiguration);
const deleteNotificationConfigurations = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GenericResponse>(this._deleteNotificationConfiguration);
return { createNotificationConfiguration, getNotificationConfiguration, getNotificationConfigurationList, testNotificationConfiguration, updateNotificationConfiguration, deleteNotificationConfigurations };
}

View File

@@ -18,21 +18,43 @@
*/
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import Disable from "./resource/recurring/disable";
import ListRecurringDetails from "./resource/recurring/listRecurringDetails";
import ScheduleAccountUpdater from "./resource/recurring/scheduleAccountUpdater";
class Recurring extends Service {
public readonly listRecurringDetails: ListRecurringDetails;
public readonly disable: Disable;
public readonly scheduleAccountUpdater: ScheduleAccountUpdater;
private readonly _listRecurringDetails: ListRecurringDetails;
private readonly _disable: Disable;
private readonly _scheduleAccountUpdater: ScheduleAccountUpdater;
public constructor(client: Client) {
super(client);
this.listRecurringDetails = new ListRecurringDetails(this);
this.disable = new Disable(this);
this.scheduleAccountUpdater = new ScheduleAccountUpdater(this);
this._listRecurringDetails = new ListRecurringDetails(this);
this._disable = new Disable(this);
this._scheduleAccountUpdater = new ScheduleAccountUpdater(this);
}
public listRecurringDetails(request: IRecurring.RecurringDetailsRequest): Promise<IRecurring.RecurringDetailsResult> {
return getJsonResponse<IRecurring.RecurringDetailsRequest, IRecurring.RecurringDetailsResult>(
this._listRecurringDetails,
request,
);
}
public disable(request: IRecurring.DisableRequest): Promise<IRecurring.DisableResult> {
return getJsonResponse<IRecurring.DisableRequest, IRecurring.DisableResult>(
this._disable,
request,
);
}
public scheduleAccountUpdater(request: IRecurring.ScheduleAccountUpdaterRequest): Promise<IRecurring.ScheduleAccountUpdaterResult> {
return getJsonResponse<IRecurring.ScheduleAccountUpdaterRequest, IRecurring.ScheduleAccountUpdaterResult>(
this._scheduleAccountUpdater,
request,
);
}
}

View File

@@ -24,15 +24,8 @@ import ApiException from "./exception/apiException";
import ClientInterface from "../httpClient/clientInterface";
import { IRequest } from "../typings/requestOptions";
type Req = { [key: string]: any };
type ReqWithId = { id?: string } & Req;
abstract class Resource {
protected endpoint: string;
protected post?(req: Req, requestOptions?: IRequest.Options): Promise<{}>;
protected patch?(req?: ReqWithId, requestOptions?: IRequest.Options): Promise<{}>;
protected get?(req?: ReqWithId, requestOptions?: IRequest.Options): Promise<{}>;
protected delete?(req?: ReqWithId, requestOptions?: IRequest.Options): Promise<{}>;
private service: Service;
protected constructor(service: Service, endpoint: string) {
@@ -40,7 +33,7 @@ abstract class Resource {
this.endpoint = endpoint;
}
protected request(json: string, requestOptions?: IRequest.Options): Promise<string | HttpClientException | ApiException> {
public request(json: string, requestOptions?: IRequest.Options): Promise<string | HttpClientException | ApiException> {
const clientInterface: ClientInterface = this.service.client.httpClient;
const config: Config = this.service.client.config;

View File

@@ -20,7 +20,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class Get3dsAvailability extends Resource {
public constructor(service: Service) {
@@ -29,13 +28,6 @@ class Get3dsAvailability extends Resource {
`${service.client.config.endpoint}${Client.BIN_LOOKUP_PAL_SUFFIX}${Client.BIN_LOOKUP_API_VERSION}/get3dsAvailability`
);
}
public post(request: IBinLookup.ThreeDSAvailabilityRequest): Promise<IBinLookup.ThreeDSAvailabilityResponse> {
return getJsonResponse.call<Get3dsAvailability,[IBinLookup.ThreeDSAvailabilityRequest], Promise<IBinLookup.ThreeDSAvailabilityResponse>>(
this,
request
);
}
}
export default Get3dsAvailability;

View File

@@ -20,7 +20,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class GetCostEstimate extends Resource {
public constructor(service: Service) {
@@ -29,13 +28,6 @@ class GetCostEstimate extends Resource {
`${service.client.config.endpoint}${Client.BIN_LOOKUP_PAL_SUFFIX}${Client.BIN_LOOKUP_API_VERSION}/getCostEstimate`
);
}
public post(request: IBinLookup.CostEstimateRequest): Promise<IBinLookup.CostEstimateResponse> {
return getJsonResponse.call<GetCostEstimate, [IBinLookup.CostEstimateRequest], Promise<IBinLookup.CostEstimateResponse>>(
this,
request
);
}
}
export default GetCostEstimate;

View File

@@ -18,30 +18,16 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
import OrdersCancel from "./ordersCancel";
class Orders extends Resource {
public readonly cancel: OrdersCancel;
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/orders`,
);
this.cancel = new OrdersCancel(service);
}
public post(ordersRequest: ICheckout.CheckoutCreateOrderRequest): Promise<ICheckout.CheckoutCreateOrderResponse> {
return getJsonResponse.call<Orders, [ICheckout.CheckoutCreateOrderRequest], Promise<ICheckout.CheckoutCreateOrderResponse>>(
this,
ordersRequest,
);
}
}
export default Orders;

View File

@@ -18,7 +18,6 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
@@ -29,13 +28,6 @@ class OrdersCancel extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/orders/cancel`,
);
}
public post(ordersCancelRequest: ICheckout.CheckoutCancelOrderRequest): Promise<ICheckout.CheckoutCancelOrderResponse> {
return getJsonResponse.call<OrdersCancel, [ICheckout.CheckoutCancelOrderRequest], Promise<ICheckout.CheckoutCancelOrderResponse>>(
this,
ordersCancelRequest,
);
}
}
export default OrdersCancel;

View File

@@ -18,7 +18,6 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
@@ -29,14 +28,6 @@ class OriginKeys extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/originKeys`,
);
}
public post(originKeysRequest: ICheckout.CheckoutUtilityRequest): Promise<ICheckout.CheckoutUtilityResponse> {
return getJsonResponse.call<OriginKeys, [ICheckout.CheckoutUtilityRequest], Promise<ICheckout.CheckoutUtilityResponse>>(
this,
originKeysRequest,
);
}
}
export default OriginKeys;

View File

@@ -18,11 +18,8 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
import { HTTPMethod } from "../../../typings/HTTPMethod";
import { IRequest } from "../../../typings/requestOptions";
class PaymentLinks extends Resource {
public constructor(service: Service) {
@@ -31,29 +28,6 @@ class PaymentLinks extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentLinks`,
);
}
public post(paymentLinkRequest: ICheckout.CreatePaymentLinkRequest): Promise<ICheckout.PaymentLinkResource> {
return getJsonResponse.call<PaymentLinks, [ICheckout.CreatePaymentLinkRequest], Promise<ICheckout.PaymentLinkResource>>(
this,
paymentLinkRequest
);
}
public get({ id }: { id: string }): Promise<ICheckout.PaymentLinkResource> {
return getJsonResponse.call<PaymentLinks, [{}, IRequest.Options], Promise<ICheckout.PaymentLinkResource>>(
this,
{},
{ id, method: HTTPMethod.GET }
);
}
public patch({ id, status }: { id: string, status: "expired" }): Promise<ICheckout.PaymentLinkResource> {
return getJsonResponse.call<PaymentLinks, [{}, IRequest.Options], Promise<ICheckout.PaymentLinkResource>>(
this,
{ status },
{ id, method: HTTPMethod.PATCH }
);
}
}
export default PaymentLinks;

View File

@@ -0,0 +1,40 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
class PaymentLinksId extends Resource {
static _id: string;
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentLinks`,
);
}
public set id(id: string) {
PaymentLinksId._id = id;
this.endpoint = `${this.endpoint}/${PaymentLinksId._id}`;
}
}
export default PaymentLinksId;

View File

@@ -18,30 +18,16 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
import PaymentMethodsBalance from "./paymentMethodsBalance";
class PaymentMethods extends Resource {
public readonly balance: PaymentMethodsBalance;
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentMethods`,
);
this.balance = new PaymentMethodsBalance(service);
}
public post(paymentMethodsRequest: ICheckout.PaymentMethodsRequest): Promise<ICheckout.PaymentMethodsResponse> {
return getJsonResponse.call<PaymentMethods, [ICheckout.PaymentMethodsRequest], Promise<ICheckout.PaymentMethodsResponse>>(
this,
paymentMethodsRequest,
);
}
}
export default PaymentMethods;

View File

@@ -18,7 +18,6 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
@@ -29,14 +28,6 @@ class PaymentMethodsBalance extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentMethods/balance`,
);
}
public post(paymentMethodsBalanceRequest: ICheckout.CheckoutBalanceCheckRequest): Promise<ICheckout.CheckoutBalanceCheckResponse> {
return getJsonResponse.call<PaymentMethodsBalance, [ICheckout.CheckoutBalanceCheckRequest], Promise<ICheckout.CheckoutBalanceCheckResponse>>(
this,
paymentMethodsBalanceRequest,
);
}
}
export default PaymentMethodsBalance;

View File

@@ -18,9 +18,7 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import { IRequest } from "../../../typings/requestOptions";
import Resource from "../../resource";
class PaymentSession extends Resource {
@@ -30,17 +28,6 @@ class PaymentSession extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentSession`,
);
}
public post(
paymentSessionRequest: ICheckout.PaymentSetupRequest,
requestOptions?: IRequest.Options,
): Promise<ICheckout.PaymentSetupResponse> {
return getJsonResponse.call<PaymentSession, [ICheckout.PaymentSetupRequest, IRequest.Options | undefined], Promise<ICheckout.PaymentSetupResponse>>(
this,
paymentSessionRequest,
requestOptions,
);
}
}
export default PaymentSession;

View File

@@ -18,34 +18,15 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
import Service from "../../../service";
import { IRequest } from "../../../typings/requestOptions";
import Resource from "../../resource";
import PaymentsDetails from "./paymentsDetails";
import PaymentsResult from "./paymentsResult";
class Payments extends Resource {
public readonly details: PaymentsDetails;
public readonly result: PaymentsResult;
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments`,
);
this.details = new PaymentsDetails(service);
this.result = new PaymentsResult(service);
}
public post(paymentsRequest: ICheckout.PaymentRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentResponse> {
return getJsonResponse.call<Payments, [ICheckout.PaymentRequest, IRequest.Options | undefined], Promise<ICheckout.PaymentResponse>>(
this,
setApplicationInfo(paymentsRequest),
requestOptions,
);
}
}

View File

@@ -18,9 +18,7 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import { IRequest } from "../../../typings/requestOptions";
import Resource from "../../resource";
class PaymentsDetails extends Resource {
@@ -30,15 +28,6 @@ class PaymentsDetails extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments/details`,
);
}
public post(paymentsDetailsRequest: ICheckout.DetailsRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentResponse> {
return getJsonResponse.call<PaymentsDetails, [ICheckout.DetailsRequest, IRequest.Options | undefined], Promise<ICheckout.PaymentResponse>>(
this,
paymentsDetailsRequest,
requestOptions
);
}
}
export default PaymentsDetails;

View File

@@ -18,7 +18,6 @@
*/
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
import Service from "../../../service";
import Resource from "../../resource";
@@ -29,14 +28,6 @@ class PaymentsResult extends Resource {
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments/result`,
);
}
public post(paymentResultRequest: ICheckout.PaymentVerificationRequest): Promise<ICheckout.PaymentVerificationResponse> {
return getJsonResponse.call<PaymentsResult, [ICheckout.PaymentVerificationRequest], Promise<ICheckout.PaymentVerificationResponse>>(
this,
paymentResultRequest,
);
}
}
export default PaymentsResult;

View File

@@ -19,10 +19,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import { GenericRequest } from "../../../typings/genericRequest";
import { IRequest } from "../../../typings/requestOptions";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class AdjustAuthorisation extends Resource {
public constructor(service: Service) {
@@ -31,17 +27,6 @@ class AdjustAuthorisation extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/adjustAuthorisation`,
);
}
public post(
adjustAuthorisationRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<AdjustAuthorisation, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(adjustAuthorisationRequest),
requestOptions,
);
}
}
export default AdjustAuthorisation;

View File

@@ -19,10 +19,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import { GenericRequest } from "../../../typings/genericRequest";
import { IRequest } from "../../../typings/requestOptions";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class Cancel extends Resource {
public constructor(service: Service) {
@@ -31,17 +27,6 @@ class Cancel extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/cancel`,
);
}
public post(
cancelRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<Cancel, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(cancelRequest),
requestOptions,
);
}
}
export default Cancel;

View File

@@ -19,10 +19,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import getJsonResponse from "../../../helpers/getJsonResponse";
import { IRequest } from "../../../typings/requestOptions";
import { GenericRequest } from "../../../typings/genericRequest";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class CancelOrRefund extends Resource {
public constructor(service: Service) {
@@ -31,18 +27,6 @@ class CancelOrRefund extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/cancelOrRefund`,
);
}
public post(
cancelOrRefundRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<CancelOrRefund, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(cancelOrRefundRequest),
requestOptions,
);
}
}
export default CancelOrRefund;

View File

@@ -19,10 +19,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import { GenericRequest } from "../../../typings/genericRequest";
import { IRequest } from "../../../typings/requestOptions";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class Capture extends Resource {
public constructor(service: Service) {
@@ -31,17 +27,6 @@ class Capture extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/capture`,
);
}
public post(
captureRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<Capture, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(captureRequest),
requestOptions,
);
}
}
export default Capture;

View File

@@ -19,10 +19,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import { GenericRequest } from "../../../typings/genericRequest";
import { IRequest } from "../../../typings/requestOptions";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class Refund extends Resource {
public constructor(service: Service) {
@@ -31,17 +27,6 @@ class Refund extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/refund`,
);
}
public post(
refundRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<Refund, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(refundRequest),
requestOptions,
);
}
}
export default Refund;

View File

@@ -19,10 +19,6 @@
import Resource from "../../resource";
import Client from "../../../client";
import Service from "../../../service";
import { GenericRequest } from "../../../typings/genericRequest";
import { IRequest } from "../../../typings/requestOptions";
import getJsonResponse from "../../../helpers/getJsonResponse";
import setApplicationInfo from "../../../helpers/setApplicationInfo";
class TechnicalCancel extends Resource {
public constructor(service: Service) {
@@ -31,17 +27,6 @@ class TechnicalCancel extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/technicalCancel`,
);
}
public post(
technicalCancelRequest: GenericRequest<IPayments.ModificationRequest>,
requestOptions?: IRequest.Options,
): Promise<IPayments.ModificationResult> {
return getJsonResponse.call<TechnicalCancel, [IPayments.ModificationRequest, IRequest.Options | undefined], Promise<IPayments.ModificationResult>>(
this,
setApplicationInfo(technicalCancelRequest),
requestOptions,
);
}
}
export default TechnicalCancel;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class ConfirmThirdParty extends Resource {
public constructor(service: Service) {
@@ -28,13 +27,6 @@ class ConfirmThirdParty extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/confirmThirdParty`
);
}
public post(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
return getJsonResponse.call<ConfirmThirdParty, [IPayouts.ModifyRequest], Promise<IPayouts.ModifyResponse>>(
this,
request
);
}
}
export default ConfirmThirdParty;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class DeclineThirdParty extends Resource {
public constructor(service: Service) {
@@ -28,13 +27,6 @@ class DeclineThirdParty extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/declineThirdParty`
);
}
public post(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
return getJsonResponse.call<DeclineThirdParty, [IPayouts.ModifyRequest], Promise<IPayouts.ModifyResponse>>(
this,
request
);
}
}
export default DeclineThirdParty;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class Payout extends Resource {
public constructor(service: Service) {
@@ -28,13 +27,6 @@ class Payout extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/payout`
);
}
public post(request: IPayouts.PayoutRequest): Promise<IPayouts.PayoutResponse> {
return getJsonResponse.call<Payout, [IPayouts.PayoutRequest], Promise<IPayouts.PayoutResponse>>(
this,
request
);
}
}
export default Payout;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class StoreDetail extends Resource {
public constructor(service: Service) {
@@ -28,14 +27,6 @@ class StoreDetail extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/storeDetail`
);
}
public post(request: IPayouts.StoreDetailRequest): Promise<IPayouts.StoreDetailResponse> {
return getJsonResponse.call<StoreDetail, [IPayouts.StoreDetailRequest], Promise<IPayouts.StoreDetailResponse>>(
this,
request
);
}
}
export default StoreDetail;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class StoreDetailAndSubmitThirdParty extends Resource {
public constructor(service: Service) {
@@ -28,14 +27,6 @@ class StoreDetailAndSubmitThirdParty extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/storeDetailAndSubmitThirdParty`
);
}
public post(request: IPayouts.StoreDetailAndSubmitRequest): Promise<IPayouts.StoreDetailAndSubmitResponse> {
return getJsonResponse.call<StoreDetailAndSubmitThirdParty, [IPayouts.StoreDetailAndSubmitRequest], Promise<IPayouts.StoreDetailAndSubmitResponse>>(
this,
request
);
}
}
export default StoreDetailAndSubmitThirdParty;

View File

@@ -19,7 +19,6 @@
import Resource from "../../resource";
import Service from "../../../service";
import Client from "../../../client";
import getJsonResponse from "../../../helpers/getJsonResponse";
class SubmitThirdParty extends Resource {
public constructor(service: Service) {
@@ -28,13 +27,6 @@ class SubmitThirdParty extends Resource {
`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/submitThirdParty`
);
}
public post(request: IPayouts.SubmitRequest): Promise<IPayouts.SubmitResponse> {
return getJsonResponse.call<SubmitThirdParty, [IPayouts.SubmitRequest], Promise<IPayouts.SubmitResponse>>(
this,
request
);
}
}
export default SubmitThirdParty;

View File

@@ -20,7 +20,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import getJsonResponse from "../../../helpers/getJsonResponse";
class Disable extends Resource {
public constructor(service: Service) {
@@ -29,14 +28,6 @@ class Disable extends Resource {
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/disable`,
);
}
public post(request: IRecurring.DisableRequest): Promise<IRecurring.DisableResult> {
return getJsonResponse.call<Disable, [IRecurring.DisableRequest], Promise<IRecurring.DisableResult>>(
this,
request,
);
}
}
export default Disable;

View File

@@ -20,7 +20,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import getJsonResponse from "../../../helpers/getJsonResponse";
class ListRecurringDetails extends Resource {
public constructor(service: Service) {
@@ -29,14 +28,6 @@ class ListRecurringDetails extends Resource {
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/listRecurringDetails`,
);
}
public post(request: IRecurring.RecurringDetailsRequest): Promise<IRecurring.RecurringDetailsResult> {
return getJsonResponse.call<ListRecurringDetails, [IRecurring.RecurringDetailsRequest], Promise<IRecurring.RecurringDetailsResult>>(
this,
request,
);
}
}
export default ListRecurringDetails;

View File

@@ -20,7 +20,6 @@
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
import getJsonResponse from "../../../helpers/getJsonResponse";
class ScheduleAccountUpdater extends Resource {
public constructor(service: Service) {
@@ -29,13 +28,6 @@ class ScheduleAccountUpdater extends Resource {
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/scheduleAccountUpdater`,
);
}
public post(request: IRecurring.ScheduleAccountUpdaterRequest): Promise<IRecurring.ScheduleAccountUpdaterResult> {
return getJsonResponse.call<ScheduleAccountUpdater, [IRecurring.ScheduleAccountUpdaterRequest], Promise<IRecurring.ScheduleAccountUpdaterResult>>(
this,
request,
);
}
}
export default ScheduleAccountUpdater;

View File

@@ -61,12 +61,12 @@ class TerminalCloudAPI extends ApiKeyAuthenticatedService {
public async(terminalApiRequest: TerminalApiRequest): Promise<string> {
const request = TerminalCloudAPI.setApplicationInfo(terminalApiRequest);
return getJsonResponse.call<Async, [TerminalApiRequest], Promise<string>>(this.terminalApiAsync, request);
return getJsonResponse<TerminalApiRequest>(this.terminalApiAsync, request);
}
public async sync(terminalApiRequest: TerminalApiRequest): Promise<TerminalApiResponse> {
const request = TerminalCloudAPI.setApplicationInfo(terminalApiRequest);
const response = await getJsonResponse.call<Sync, [TerminalApiRequest], Promise<TerminalApiResponse>>(
const response = await getJsonResponse<TerminalApiRequest, TerminalApiResponse>(
this.terminalApiSync,
request,
);

View File

@@ -63,7 +63,7 @@ class TerminalLocalAPI extends ApiKeyAuthenticatedService {
saleToPOIRequest: saleToPoiSecuredMessage,
}, "TerminalApiSecuredRequest");
const jsonResponse = await getJsonResponse.call<LocalRequest, [TerminalApiSecuredRequest], Promise<TerminalApiResponse>>(
const jsonResponse = await getJsonResponse<TerminalApiSecuredRequest, TerminalApiResponse>(
this.localRequest,
securedPaymentRequest
);

View File

@@ -1,53 +0,0 @@
export enum HTTPMethod {
/**
* The `CONNECT` method establishes a tunnel to the server identified by the
* target resource.
*/
CONNECT = 'CONNECT',
/**
* The `DELETE` method deletes the specified resource.
*/
DELETE = 'DELETE',
/**
* The `GET` method requests a representation of the specified resource.
* Requests using GET should only retrieve data.
*/
GET = 'GET',
/**
* The `HEAD` method asks for a response identical to that of a GET request,
* but without the response body.
*/
HEAD = 'HEAD',
/**
* The `OPTIONS` method is used to describe the communication options for the
* target resource.
*/
OPTIONS = 'OPTIONS',
/**
* The PATCH method is used to apply partial modifications to a resource.
*/
PATCH = 'PATCH',
/**
* The `POST` method is used to submit an entity to the specified resource,
* often causing a change in state or side effects on the server.
*/
POST = 'POST',
/**
* The `PUT` method replaces all current representations of the target
* resource with the request payload.
*/
PUT = 'PUT',
/**
* The `TRACE` method performs a message loop-back test along the path to the
* target resource.
*/
TRACE = 'TRACE'
}

View File

@@ -1,4 +0,0 @@
import { ApplicationInfo } from "./applicationInfo";
interface AppInfo { applicationInfo?: ApplicationInfo }
export type GenericRequest<T> = T & AppInfo;

View File

@@ -25,7 +25,6 @@ import * as https from "https";
export namespace IRequest {
export type Options = https.RequestOptions & {
id?: string;
idempotencyKey?: string;
};
}