Skip to content

Commit 01ca16f

Browse files
AdyenAutomationBotAdyenAutomationBotwboereboom
authored
Update all services (#1328)
* [reformat][adyen-sdk-automation] automated change * style(fmt): code formatted * fix unit tests for management service fixes and manually remove faulty import from balancePlatform model --------- Co-authored-by: AdyenAutomationBot <Adyen Automation plugins_dev@adyen.com> Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
1 parent 234cef3 commit 01ca16f

File tree

151 files changed

+3193
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+3193
-224
lines changed

src/__tests__/management.spec.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ describe("Management", (): void => {
246246

247247
it("should support POST /merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins", async (): Promise<void> => {
248248
scope.post(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/allowedOrigins`)
249-
.reply(200, responses.allowedOriginsResponse);
249+
.reply(200, responses.allowedOrigin);
250250

251-
const response: management.AllowedOriginsResponse = await managementService.AllowedOriginsMerchantLevelApi.createAllowedOrigin(merchantId, apiCredentialId, requests.allowedOrigin);
251+
const response: management.AllowedOrigin = await managementService.AllowedOriginsMerchantLevelApi.createAllowedOrigin(merchantId, apiCredentialId, requests.allowedOrigin);
252252

253253
expect(response).toBeTruthy();
254254
});
@@ -706,24 +706,20 @@ describe("Management", (): void => {
706706
scope.post("/merchants/YOUR_MERCHANT_ACCOUNT/apiCredentials/YOUR_API_CREDENTIAL/allowedOrigins", requestBody)
707707
.reply(200, {
708708
"id": "YOUR_ALLOWED_ORIGIN",
709-
"data": [
710-
{
711-
"domain": "https://www.eu.mystore.com",
712-
}
713-
],
709+
"domain": "https://www.eu.mystore.com",
714710
"_links": {
715711
"self": {
716712
"href": "https://management-test.adyen.com/v1/merchants/YOUR_MERCHANT_ACCOUNT/apiCredentials/YOUR_API_CREDENTIAL/allowedOrigins/YOUR_ALLOWED_ORIGIN"
717713
}
718714
}
719715
});
720716

721-
const response: management.AllowedOriginsResponse = await managementService.AllowedOriginsMerchantLevelApi
717+
const response: management.AllowedOrigin = await managementService.AllowedOriginsMerchantLevelApi
722718
.createAllowedOrigin("YOUR_MERCHANT_ACCOUNT", "YOUR_API_CREDENTIAL", {
723719
domain: "https://www.eu.mystore.com",
724720
});
725721

726-
expect(response.data![0].domain).toEqual("https://www.eu.mystore.com");
722+
expect(response.domain).toEqual("https://www.eu.mystore.com");
727723
});
728724
});
729725
});

src/services/balancePlatform/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { BankAccountValidationApi } from "./bankAccountValidationApi";
1313
import { CardOrdersApi } from "./cardOrdersApi";
1414
import { GrantAccountsApi } from "./grantAccountsApi";
1515
import { GrantOffersApi } from "./grantOffersApi";
16+
import { ManageCardPINApi } from "./manageCardPINApi";
1617
import { NetworkTokensApi } from "./networkTokensApi";
17-
import { PINFunctionalityApi } from "./pINFunctionalityApi";
1818
import { PaymentInstrumentGroupsApi } from "./paymentInstrumentGroupsApi";
1919
import { PaymentInstrumentsApi } from "./paymentInstrumentsApi";
2020
import { PlatformApi } from "./platformApi";
@@ -54,12 +54,12 @@ export default class BalancePlatformAPI extends Service {
5454
return new GrantOffersApi(this.client);
5555
}
5656

57-
public get NetworkTokensApi() {
58-
return new NetworkTokensApi(this.client);
57+
public get ManageCardPINApi() {
58+
return new ManageCardPINApi(this.client);
5959
}
6060

61-
public get PINFunctionalityApi() {
62-
return new PINFunctionalityApi(this.client);
61+
public get NetworkTokensApi() {
62+
return new NetworkTokensApi(this.client);
6363
}
6464

6565
public get PaymentInstrumentGroupsApi() {

src/services/balancePlatform/pINFunctionalityApi.ts renamed to src/services/balancePlatform/manageCardPINApi.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import { IRequest } from "../../typings/requestOptions";
2222
import Resource from "../resource";
2323

24-
export class PINFunctionalityApi extends Service {
24+
export class ManageCardPINApi extends Service {
2525

2626
private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2";
2727
private baseUrl: string;
@@ -32,12 +32,12 @@ export class PINFunctionalityApi extends Service {
3232
}
3333

3434
/**
35-
* @summary Change Pin
35+
* @summary Change a card PIN
3636
* @param pinChangeRequest {@link PinChangeRequest }
3737
* @param requestOptions {@link IRequest.Options }
3838
* @return {@link PinChangeResponse }
3939
*/
40-
public async changePin(pinChangeRequest: PinChangeRequest, requestOptions?: IRequest.Options): Promise<PinChangeResponse> {
40+
public async changeCardPin(pinChangeRequest: PinChangeRequest, requestOptions?: IRequest.Options): Promise<PinChangeResponse> {
4141
const endpoint = `${this.baseUrl}/pins/change`;
4242
const resource = new Resource(this, endpoint);
4343
const request: PinChangeRequest = ObjectSerializer.serialize(pinChangeRequest, "PinChangeRequest");
@@ -50,14 +50,14 @@ export class PINFunctionalityApi extends Service {
5050
}
5151

5252
/**
53-
* @summary Get RSA publicKey
53+
* @summary Get an RSA public key
5454
* @param requestOptions {@link IRequest.Options }
55-
* @param purpose {@link string } Purpose of publicKey.
56-
* @param format {@link string } Format of publicKey.
55+
* @param purpose {@link string } The purpose of the public key. Possible values: **pinChange**, **pinReveal**, **panReveal**. Default value: **pinReveal**.
56+
* @param format {@link string } The encoding format of public key. Possible values: **jwk**, **pem**. Default value: **pem**.
5757
* @return {@link PublicKeyResponse }
5858
*/
59-
public async getRsaPublickey(purpose?: string, format?: string, requestOptions?: IRequest.Options): Promise<PublicKeyResponse> {
60-
const endpoint = `${this.baseUrl}/pins/publicKey`;
59+
public async publicKey(purpose?: string, format?: string, requestOptions?: IRequest.Options): Promise<PublicKeyResponse> {
60+
const endpoint = `${this.baseUrl}/publicKey`;
6161
const resource = new Resource(this, endpoint);
6262
const hasDefinedQueryParams = purpose ?? format;
6363
if(hasDefinedQueryParams) {
@@ -75,12 +75,12 @@ export class PINFunctionalityApi extends Service {
7575
}
7676

7777
/**
78-
* @summary Reveal Pin
78+
* @summary Reveal a card PIN
7979
* @param revealPinRequest {@link RevealPinRequest }
8080
* @param requestOptions {@link IRequest.Options }
8181
* @return {@link RevealPinResponse }
8282
*/
83-
public async revealPin(revealPinRequest: RevealPinRequest, requestOptions?: IRequest.Options): Promise<RevealPinResponse> {
83+
public async revealCardPin(revealPinRequest: RevealPinRequest, requestOptions?: IRequest.Options): Promise<RevealPinResponse> {
8484
const endpoint = `${this.baseUrl}/pins/reveal`;
8585
const resource = new Resource(this, endpoint);
8686
const request: RevealPinRequest = ObjectSerializer.serialize(revealPinRequest, "RevealPinRequest");

src/services/balancePlatform/paymentInstrumentsApi.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
PaymentInstrument,
1616
PaymentInstrumentInfo,
1717
PaymentInstrumentRevealInfo,
18+
PaymentInstrumentRevealRequest,
19+
PaymentInstrumentRevealResponse,
1820
PaymentInstrumentUpdateRequest,
1921
TransactionRulesResponse,
2022
UpdatePaymentInstrument,
@@ -123,6 +125,24 @@ export class PaymentInstrumentsApi extends Service {
123125
return ObjectSerializer.deserialize(response, "ListNetworkTokensResponse");
124126
}
125127

128+
/**
129+
* @summary Reveal the data of a payment instrument
130+
* @param paymentInstrumentRevealRequest {@link PaymentInstrumentRevealRequest }
131+
* @param requestOptions {@link IRequest.Options }
132+
* @return {@link PaymentInstrumentRevealResponse }
133+
*/
134+
public async revealDataOfPaymentInstrument(paymentInstrumentRevealRequest: PaymentInstrumentRevealRequest, requestOptions?: IRequest.Options): Promise<PaymentInstrumentRevealResponse> {
135+
const endpoint = `${this.baseUrl}/paymentInstruments/reveal`;
136+
const resource = new Resource(this, endpoint);
137+
const request: PaymentInstrumentRevealRequest = ObjectSerializer.serialize(paymentInstrumentRevealRequest, "PaymentInstrumentRevealRequest");
138+
const response = await getJsonResponse<PaymentInstrumentRevealRequest, PaymentInstrumentRevealResponse>(
139+
resource,
140+
request,
141+
{ ...requestOptions, method: "POST" }
142+
);
143+
return ObjectSerializer.deserialize(response, "PaymentInstrumentRevealResponse");
144+
}
145+
126146
/**
127147
* @summary Update a payment instrument
128148
* @param id {@link string } The unique identifier of the payment instrument.

src/services/legalEntityManagement/documentsApi.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,19 @@ export class DocumentsApi extends Service {
4747
* @summary Get a document
4848
* @param id {@link string } The unique identifier of the document.
4949
* @param requestOptions {@link IRequest.Options }
50+
* @param skipContent {@link boolean } Do not load document content while fetching the document.
5051
* @return {@link Document }
5152
*/
52-
public async getDocument(id: string, requestOptions?: IRequest.Options): Promise<Document> {
53+
public async getDocument(id: string, skipContent?: boolean, requestOptions?: IRequest.Options): Promise<Document> {
5354
const endpoint = `${this.baseUrl}/documents/{id}`
5455
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
5556
const resource = new Resource(this, endpoint);
57+
const hasDefinedQueryParams = skipContent;
58+
if(hasDefinedQueryParams) {
59+
if(!requestOptions) requestOptions = {};
60+
if(!requestOptions.params) requestOptions.params = {};
61+
if(skipContent) requestOptions.params["skipContent"] = skipContent;
62+
}
5663
const response = await getJsonResponse<string, Document>(
5764
resource,
5865
"",

src/services/management/allowedOriginsCompanyLevelApi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ export class AllowedOriginsCompanyLevelApi extends Service {
3434
* @param apiCredentialId {@link string } Unique identifier of the API credential.
3535
* @param allowedOrigin {@link AllowedOrigin }
3636
* @param requestOptions {@link IRequest.Options }
37-
* @return {@link AllowedOriginsResponse }
37+
* @return {@link AllowedOrigin }
3838
*/
39-
public async createAllowedOrigin(companyId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
39+
public async createAllowedOrigin(companyId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOrigin> {
4040
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins`
4141
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
4242
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
4343
const resource = new Resource(this, endpoint);
4444
const request: AllowedOrigin = ObjectSerializer.serialize(allowedOrigin, "AllowedOrigin");
45-
const response = await getJsonResponse<AllowedOrigin, AllowedOriginsResponse>(
45+
const response = await getJsonResponse<AllowedOrigin, AllowedOrigin>(
4646
resource,
4747
request,
4848
{ ...requestOptions, method: "POST" }
4949
);
50-
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
50+
return ObjectSerializer.deserialize(response, "AllowedOrigin");
5151
}
5252

5353
/**

src/services/management/allowedOriginsMerchantLevelApi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ export class AllowedOriginsMerchantLevelApi extends Service {
3434
* @param apiCredentialId {@link string } Unique identifier of the API credential.
3535
* @param allowedOrigin {@link AllowedOrigin }
3636
* @param requestOptions {@link IRequest.Options }
37-
* @return {@link AllowedOriginsResponse }
37+
* @return {@link AllowedOrigin }
3838
*/
39-
public async createAllowedOrigin(merchantId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
39+
public async createAllowedOrigin(merchantId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOrigin> {
4040
const endpoint = `${this.baseUrl}/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins`
4141
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)))
4242
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
4343
const resource = new Resource(this, endpoint);
4444
const request: AllowedOrigin = ObjectSerializer.serialize(allowedOrigin, "AllowedOrigin");
45-
const response = await getJsonResponse<AllowedOrigin, AllowedOriginsResponse>(
45+
const response = await getJsonResponse<AllowedOrigin, AllowedOrigin>(
4646
resource,
4747
request,
4848
{ ...requestOptions, method: "POST" }
4949
);
50-
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
50+
return ObjectSerializer.deserialize(response, "AllowedOrigin");
5151
}
5252

5353
/**

src/services/transfers/transfersApi.ts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import getJsonResponse from "../../helpers/getJsonResponse";
1111
import Service from "../../service";
1212
import Client from "../../client";
13-
import {
13+
import {
14+
FindTransfersResponse,
1415
ReturnTransferRequest,
1516
ReturnTransferResponse,
1617
Transfer,
18+
TransferData,
1719
TransferInfo,
1820
ObjectSerializer
1921
} from "../../typings/transfers/models";
@@ -30,6 +32,65 @@ export class TransfersApi extends Service {
3032
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
3133
}
3234

35+
/**
36+
* @summary Get all transfers
37+
* @param requestOptions {@link IRequest.Options }
38+
* @param balancePlatform {@link string } The unique identifier of the [balance platform](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balancePlatforms/{id}__queryParam_id). Required if you don\&#39;t provide a &#x60;balanceAccountId&#x60; or &#x60;accountHolderId&#x60;.
39+
* @param accountHolderId {@link string } The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/accountHolders/{id}__queryParam_id). Required if you don\&#39;t provide a &#x60;balanceAccountId&#x60; or &#x60;balancePlatform&#x60;. If you provide a &#x60;balanceAccountId&#x60;, the &#x60;accountHolderId&#x60; must be related to the &#x60;balanceAccountId&#x60;.
40+
* @param balanceAccountId {@link string } The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__queryParam_id). Required if you don\&#39;t provide an &#x60;accountHolderId&#x60; or &#x60;balancePlatform&#x60;. If you provide an &#x60;accountHolderId&#x60;, the &#x60;balanceAccountId&#x60; must be related to the &#x60;accountHolderId&#x60;.
41+
* @param paymentInstrumentId {@link string } The unique identifier of the [payment instrument](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/paymentInstruments/_id_). To use this parameter, you must also provide a &#x60;balanceAccountId&#x60;, &#x60;accountHolderId&#x60;, or &#x60;balancePlatform&#x60;. The &#x60;paymentInstrumentId&#x60; must be related to the &#x60;balanceAccountId&#x60; or &#x60;accountHolderId&#x60; that you provide.
42+
* @param reference {@link string } The reference you provided in the POST [/transfers](https://docs.adyen.com/api-explorer/transfers/latest/post/transfers) request
43+
* @param category {@link &#39;bank&#39; | &#39;card&#39; | &#39;grants&#39; | &#39;internal&#39; | &#39;issuedCard&#39; | &#39;migration&#39; | &#39;platformPayment&#39; | &#39;topUp&#39; | &#39;upgrade&#39; } The type of transfer. Possible values: - **bank**: Transfer to a [transfer instrument](https://docs.adyen.com/api-explorer/#/legalentity/latest/post/transferInstruments__resParam_id) or a bank account. - **internal**: Transfer to another [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/balanceAccounts__resParam_id) within your platform. - **issuedCard**: Transfer initiated by a Adyen-issued card. - **platformPayment**: Fund movements related to payments that are acquired for your users.
44+
* @param createdSince {@link Date } Only include transfers that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
45+
* @param createdUntil {@link Date } Only include transfers that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
46+
* @param cursor {@link string } The &#x60;cursor&#x60; returned in the links of the previous response.
47+
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
48+
* @return {@link FindTransfersResponse }
49+
*/
50+
public async getAllTransfers(balancePlatform?: string, accountHolderId?: string, balanceAccountId?: string, paymentInstrumentId?: string, reference?: string, category?: "bank" | "card" | "grants" | "internal" | "issuedCard" | "migration" | "platformPayment" | "topUp" | "upgrade", createdSince?: Date, createdUntil?: Date, cursor?: string, limit?: number, requestOptions?: IRequest.Options): Promise<FindTransfersResponse> {
51+
const endpoint = `${this.baseUrl}/transfers`;
52+
const resource = new Resource(this, endpoint);
53+
const hasDefinedQueryParams = balancePlatform ?? accountHolderId ?? balanceAccountId ?? paymentInstrumentId ?? reference ?? category ?? createdSince ?? createdUntil ?? cursor ?? limit;
54+
if(hasDefinedQueryParams) {
55+
if(!requestOptions) requestOptions = {};
56+
if(!requestOptions.params) requestOptions.params = {};
57+
if(balancePlatform) requestOptions.params["balancePlatform"] = balancePlatform;
58+
if(accountHolderId) requestOptions.params["accountHolderId"] = accountHolderId;
59+
if(balanceAccountId) requestOptions.params["balanceAccountId"] = balanceAccountId;
60+
if(paymentInstrumentId) requestOptions.params["paymentInstrumentId"] = paymentInstrumentId;
61+
if(reference) requestOptions.params["reference"] = reference;
62+
if(category) requestOptions.params["category"] = category;
63+
if(createdSince) requestOptions.params["createdSince"] = createdSince.toISOString();
64+
if(createdUntil) requestOptions.params["createdUntil"] = createdUntil.toISOString();
65+
if(cursor) requestOptions.params["cursor"] = cursor;
66+
if(limit) requestOptions.params["limit"] = limit;
67+
}
68+
const response = await getJsonResponse<string, FindTransfersResponse>(
69+
resource,
70+
"",
71+
{ ...requestOptions, method: "GET" }
72+
);
73+
return ObjectSerializer.deserialize(response, "FindTransfersResponse");
74+
}
75+
76+
/**
77+
* @summary Get a transfer
78+
* @param id {@link string } Unique identifier of the transfer.
79+
* @param requestOptions {@link IRequest.Options }
80+
* @return {@link TransferData }
81+
*/
82+
public async getTransfer(id: string, requestOptions?: IRequest.Options): Promise<TransferData> {
83+
const endpoint = `${this.baseUrl}/transfers/{id}`
84+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
85+
const resource = new Resource(this, endpoint);
86+
const response = await getJsonResponse<string, TransferData>(
87+
resource,
88+
"",
89+
{ ...requestOptions, method: "GET" }
90+
);
91+
return ObjectSerializer.deserialize(response, "TransferData");
92+
}
93+
3394
/**
3495
* @summary Return a transfer
3596
* @param transferId {@link string } The unique identifier of the transfer to be returned.

src/typings/balancePlatform/aULocalAccountIdentification.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export class AULocalAccountIdentification {
1818
*/
1919
'bsbCode': string;
2020
/**
21+
* The form factor of the account. Possible values: **physical**, **virtual**. Default value: **physical**.
22+
*/
23+
'formFactor'?: string | null;
24+
/**
2125
* **auLocal**
2226
*/
2327
'type': AULocalAccountIdentification.TypeEnum;
@@ -35,6 +39,11 @@ export class AULocalAccountIdentification {
3539
"baseName": "bsbCode",
3640
"type": "string"
3741
},
42+
{
43+
"name": "formFactor",
44+
"baseName": "formFactor",
45+
"type": "string | null"
46+
},
3847
{
3948
"name": "type",
4049
"baseName": "type",

0 commit comments

Comments
 (0)