mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
platforms.spec.ts
This commit is contained in:
2
.github/workflows/coveralls.yml
vendored
2
.github/workflows/coveralls.yml
vendored
@@ -32,6 +32,8 @@ jobs:
|
|||||||
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
||||||
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
||||||
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
||||||
|
ADYEN_MARKETPLACE_USER: ${{ secrets.ADYEN_MARKETPLACE_USER }}
|
||||||
|
ADYEN_MARKETPLACE_PASSWORD: ${{ secrets.ADYEN_MARKETPLACE_PASSWORD }}
|
||||||
|
|
||||||
- name: Coveralls Parallel
|
- name: Coveralls Parallel
|
||||||
uses: coverallsapp/github-action@master
|
uses: coverallsapp/github-action@master
|
||||||
|
|||||||
2
.github/workflows/nodejs.yml
vendored
2
.github/workflows/nodejs.yml
vendored
@@ -35,3 +35,5 @@ jobs:
|
|||||||
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
||||||
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
||||||
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
||||||
|
ADYEN_MARKETPLACE_USER: ${{ secrets.ADYEN_MARKETPLACE_USER }}
|
||||||
|
ADYEN_MARKETPLACE_PASSWORD: ${{ secrets.ADYEN_MARKETPLACE_PASSWORD }}
|
||||||
|
|||||||
2
.github/workflows/npmpublish.yml
vendored
2
.github/workflows/npmpublish.yml
vendored
@@ -25,6 +25,8 @@ jobs:
|
|||||||
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
ADYEN_STOREPAYOUT_PASSWORD: ${{ secrets.ADYEN_STOREPAYOUT_PASSWORD }}
|
||||||
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
ADYEN_STOREPAYOUT_USER: ${{ secrets.ADYEN_STOREPAYOUT_USER }}
|
||||||
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
ADYEN_USER: ${{ secrets.ADYEN_USER }}
|
||||||
|
ADYEN_MARKETPLACE_USER: ${{ secrets.ADYEN_MARKETPLACE_USER }}
|
||||||
|
ADYEN_MARKETPLACE_PASSWORD: ${{ secrets.ADYEN_MARKETPLACE_PASSWORD }}
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
|
|
||||||
publish-npm:
|
publish-npm:
|
||||||
|
|||||||
@@ -51,6 +51,17 @@ export const createClient = (apiKey = process.env.ADYEN_API_KEY): Client => {
|
|||||||
return client;
|
return client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const createBasicAuthClient = (): Client => {
|
||||||
|
const client: Client = new Client({
|
||||||
|
username: process.env.ADYEN_USER!,
|
||||||
|
password: process.env.ADYEN_PASSWORD!,
|
||||||
|
environment: "TEST",
|
||||||
|
applicationName: "adyen-node-api-library"
|
||||||
|
});
|
||||||
|
|
||||||
|
return client;
|
||||||
|
};
|
||||||
|
|
||||||
export const createTerminalAPIPaymentRequest = (): TerminalApiRequest => {
|
export const createTerminalAPIPaymentRequest = (): TerminalApiRequest => {
|
||||||
|
|
||||||
const messageHeader: MessageHeader = {
|
const messageHeader: MessageHeader = {
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ describe("Checkout", (): void => {
|
|||||||
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
|
const paymentsRequest: ICheckout.PaymentRequest = createPaymentsCheckoutRequest();
|
||||||
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments(paymentsRequest);
|
const paymentsResponse: ICheckout.PaymentResponse = await checkout.payments(paymentsRequest);
|
||||||
|
|
||||||
console.log(paymentsResponse);
|
|
||||||
expect(paymentsResponse.pspReference).toBeTruthy();
|
expect(paymentsResponse.pspReference).toBeTruthy();
|
||||||
expect(paymentsResponse.additionalData).toBeTruthy();
|
expect(paymentsResponse.additionalData).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import nock from "nock";
|
import nock from "nock";
|
||||||
import {createMock} from "ts-auto-mock";
|
import {createMock} from "ts-auto-mock";
|
||||||
import {createClient} from "../__mocks__/base";
|
import {createBasicAuthClient} from "../__mocks__/base";
|
||||||
import {Client, Platforms} from "../index";
|
import {Client, Platforms} from "../index";
|
||||||
|
|
||||||
import A = IPlatformsAccount
|
import A = IPlatformsAccount
|
||||||
@@ -13,11 +13,21 @@ let platforms: Platforms;
|
|||||||
let scope: nock.Scope;
|
let scope: nock.Scope;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
client = createClient();
|
if (!nock.isActive()) {
|
||||||
|
nock.activate();
|
||||||
|
}
|
||||||
|
client = createBasicAuthClient();
|
||||||
|
client.config.password = process.env.ADYEN_MARKETPLACE_PASSWORD;
|
||||||
|
client.config.username = process.env.ADYEN_MARKETPLACE_USER;
|
||||||
|
|
||||||
platforms = new Platforms(client);
|
platforms = new Platforms(client);
|
||||||
scope = nock(client.config.marketPayEndpoint!);
|
scope = nock(client.config.marketPayEndpoint!);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
nock.cleanAll();
|
||||||
|
});
|
||||||
|
|
||||||
describe("Platforms Test", function(): void {
|
describe("Platforms Test", function(): void {
|
||||||
describe("Account", function(): void {
|
describe("Account", function(): void {
|
||||||
describe("Accounts", function () {
|
describe("Accounts", function () {
|
||||||
@@ -48,6 +58,34 @@ describe("Platforms Test", function(): void {
|
|||||||
expect(result).toMatchObject(args[2]);
|
expect(result).toMatchObject(args[2]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it("should create account holder", async function() {
|
||||||
|
nock.restore();
|
||||||
|
try {
|
||||||
|
const result = await platforms.Account.accountHolders.createAccountHolder({
|
||||||
|
accountHolderCode: Date.now().toString(2),
|
||||||
|
accountHolderDetails: {
|
||||||
|
email: "random_email@example.com",
|
||||||
|
fullPhoneNumber: "312030291928",
|
||||||
|
webAddress: "http://example.com",
|
||||||
|
individualDetails: {
|
||||||
|
name: {
|
||||||
|
firstName: "John",
|
||||||
|
gender: "MALE",
|
||||||
|
lastName: "Smith"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
address: {
|
||||||
|
country: "NL"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legalEntity: "Individual",
|
||||||
|
});
|
||||||
|
expect(result.pspReference).toBeDefined();
|
||||||
|
} catch (e) {
|
||||||
|
fail(e.responseBody);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("Fund", function () {
|
describe("Fund", function () {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class Platforms extends Service {
|
|||||||
const deleteShareholders = this.createRequest<AccountsVerification, IPlatformsAccount.DeleteShareholderRequest, IPlatformsAccount.GenericResponse>(this._deleteShareholders);
|
const deleteShareholders = this.createRequest<AccountsVerification, IPlatformsAccount.DeleteShareholderRequest, IPlatformsAccount.GenericResponse>(this._deleteShareholders);
|
||||||
const checkAccountHolder = this.createRequest<AccountsVerification, IPlatformsAccount.PerformVerificationRequest, IPlatformsAccount.GenericResponse>(this._checkAccountHolder);
|
const checkAccountHolder = this.createRequest<AccountsVerification, IPlatformsAccount.PerformVerificationRequest, IPlatformsAccount.GenericResponse>(this._checkAccountHolder);
|
||||||
|
|
||||||
const createAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.CreateAccountRequest, IPlatformsAccount.CreateAccountHolderResponse>(this._createAccountHolder);
|
const createAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.CreateAccountHolderRequest, IPlatformsAccount.CreateAccountHolderResponse>(this._createAccountHolder);
|
||||||
const getAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.GetAccountHolderRequest, IPlatformsAccount.GetAccountHolderResponse>(this._getAccountHolder);
|
const getAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.GetAccountHolderRequest, IPlatformsAccount.GetAccountHolderResponse>(this._getAccountHolder);
|
||||||
const updateAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderRequest, IPlatformsAccount.UpdateAccountHolderResponse>(this._updateAccountHolder);
|
const updateAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.UpdateAccountHolderRequest, IPlatformsAccount.UpdateAccountHolderResponse>(this._updateAccountHolder);
|
||||||
const suspendAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.SuspendAccountHolderRequest, IPlatformsAccount.SuspendAccountHolderResponse>(this._suspendAccountHolder);
|
const suspendAccountHolder = this.createRequest<AccountsAccountHolders, IPlatformsAccount.SuspendAccountHolderRequest, IPlatformsAccount.SuspendAccountHolderResponse>(this._suspendAccountHolder);
|
||||||
|
|||||||
Reference in New Issue
Block a user