Skip to content

Commit 351f72b

Browse files
committed
Generate BinLookup API
1 parent 4fc19bc commit 351f72b

19 files changed

+743
-302
lines changed

src/__tests__/binLookup.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nock from "nock";
22
import { createClient } from "../__mocks__/base";
3-
import BinLookup from "../services/binLookupApi";
3+
import BinLookup from "../services/binLookup";
44
import Client from "../client";
55
import HttpClientException from "../httpClient/httpClientException";
66
import { binlookup } from "../typings";
@@ -42,7 +42,7 @@ describe("Bin Lookup", function (): void {
4242
scope.post("/get3dsAvailability")
4343
.reply(200, threeDSAvailabilitySuccess);
4444

45-
const response = await binLookupService.get3dsAvailability(threeDSAvailabilityRequest);
45+
const response = await binLookupService.BinLookupApi.get3dsAvailability(threeDSAvailabilityRequest);
4646

4747
expect(response).toEqual< binlookup.ThreeDSAvailabilityResponse>(threeDSAvailabilitySuccess);
4848
});
@@ -58,7 +58,7 @@ describe("Bin Lookup", function (): void {
5858
.reply(403, JSON.stringify({status: 403, message: "Invalid Merchant Account", errorCode: "901", errorType: "security"}));
5959

6060
try {
61-
await binLookupService.get3dsAvailability(threeDSAvailabilityRequest as unknown as binlookup.ThreeDSAvailabilityRequest);
61+
await binLookupService.BinLookupApi.get3dsAvailability(threeDSAvailabilityRequest as unknown as binlookup.ThreeDSAvailabilityRequest);
6262
fail("Expected request to fail");
6363
} catch (e) {
6464
expect(e instanceof HttpClientException).toBeTruthy();
@@ -101,7 +101,7 @@ describe("Bin Lookup", function (): void {
101101
scope.post("/getCostEstimate")
102102
.reply(200, expected);
103103

104-
const response = await binLookupService.getCostEstimate(costEstimateRequest);
104+
const response = await binLookupService.BinLookupApi.getCostEstimate(costEstimateRequest);
105105

106106
expect(response).toEqual(expected);
107107
});
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* The version of the OpenAPI document: v54
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
11+
import getJsonResponse from "../../helpers/getJsonResponse";
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
import { IRequest } from "../../typings/requestOptions";
15+
import Resource from "../resource";
16+
17+
import { ObjectSerializer } from "../../typings/binLookup/objectSerializer";
18+
import { CostEstimateRequest } from "../../typings/binLookup/models";
19+
import { CostEstimateResponse } from "../../typings/binLookup/models";
20+
import { ThreeDSAvailabilityRequest } from "../../typings/binLookup/models";
21+
import { ThreeDSAvailabilityResponse } from "../../typings/binLookup/models";
22+
23+
/**
24+
* API handler for BinLookupApi
25+
*/
26+
export class BinLookupApi extends Service {
27+
28+
private readonly API_BASEPATH: string = "https://pal-test.adyen.com/pal/servlet/BinLookup/v54";
29+
private baseUrl: string;
30+
31+
public constructor(client: Client){
32+
super(client);
33+
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
34+
}
35+
36+
/**
37+
* @summary Check if 3D Secure is available
38+
* @param threeDSAvailabilityRequest {@link ThreeDSAvailabilityRequest }
39+
* @param requestOptions {@link IRequest.Options }
40+
* @return {@link ThreeDSAvailabilityResponse }
41+
*/
42+
public async get3dsAvailability(threeDSAvailabilityRequest: ThreeDSAvailabilityRequest, requestOptions?: IRequest.Options): Promise<ThreeDSAvailabilityResponse> {
43+
const endpoint = `${this.baseUrl}/get3dsAvailability`;
44+
const resource = new Resource(this, endpoint);
45+
const request: ThreeDSAvailabilityRequest = ObjectSerializer.serialize(threeDSAvailabilityRequest, "ThreeDSAvailabilityRequest", "");
46+
const response = await getJsonResponse<ThreeDSAvailabilityRequest, ThreeDSAvailabilityResponse>(
47+
resource,
48+
request,
49+
{ ...requestOptions, method: "POST" }
50+
);
51+
return ObjectSerializer.deserialize(response, "ThreeDSAvailabilityResponse", "");
52+
}
53+
54+
/**
55+
* @summary Get a fees cost estimate
56+
* @param costEstimateRequest {@link CostEstimateRequest }
57+
* @param requestOptions {@link IRequest.Options }
58+
* @return {@link CostEstimateResponse }
59+
*/
60+
public async getCostEstimate(costEstimateRequest: CostEstimateRequest, requestOptions?: IRequest.Options): Promise<CostEstimateResponse> {
61+
const endpoint = `${this.baseUrl}/getCostEstimate`;
62+
const resource = new Resource(this, endpoint);
63+
const request: CostEstimateRequest = ObjectSerializer.serialize(costEstimateRequest, "CostEstimateRequest", "");
64+
const response = await getJsonResponse<CostEstimateRequest, CostEstimateResponse>(
65+
resource,
66+
request,
67+
{ ...requestOptions, method: "POST" }
68+
);
69+
return ObjectSerializer.deserialize(response, "CostEstimateResponse", "");
70+
}
71+
72+
}

src/services/binLookup/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* The version of the OpenAPI document: v54
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
import { BinLookupApi } from "./binLookupApi";
11+
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
15+
export default class BinLookupAPI extends Service {
16+
17+
public constructor(client: Client) {
18+
super(client);
19+
}
20+
21+
public get BinLookupApi() {
22+
return new BinLookupApi(this.client);
23+
}
24+
}

src/services/binLookupApi.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import { IRequest } from "../typings/requestOptions";
1818
import Resource from "./resource";
1919
import { ObjectSerializer } from "../typings/binLookup/models";
2020

21+
/**
22+
* The service has been moved to a different package 'binLookup'
23+
* @deprecated Use services/binLookup/binLookup
24+
*/
2125
export class BinLookupAPI extends Service {
2226

2327
private readonly API_BASEPATH: string = "https://pal-test.adyen.com/pal/servlet/BinLookup/v54";
@@ -29,6 +33,8 @@ export class BinLookupAPI extends Service {
2933
}
3034

3135
/**
36+
* @deprecated Use services/binLookup/binLookup
37+
*
3238
* @summary Check if 3D Secure is available
3339
* @param threeDSAvailabilityRequest {@link ThreeDSAvailabilityRequest }
3440
* @param requestOptions {@link IRequest.Options }
@@ -37,16 +43,18 @@ export class BinLookupAPI extends Service {
3743
public async get3dsAvailability(threeDSAvailabilityRequest: ThreeDSAvailabilityRequest, requestOptions?: IRequest.Options): Promise<ThreeDSAvailabilityResponse> {
3844
const endpoint = `${this.baseUrl}/get3dsAvailability`;
3945
const resource = new Resource(this, endpoint);
40-
const request: ThreeDSAvailabilityRequest = ObjectSerializer.serialize(threeDSAvailabilityRequest, "ThreeDSAvailabilityRequest");
46+
const request: ThreeDSAvailabilityRequest = ObjectSerializer.serialize(threeDSAvailabilityRequest, "ThreeDSAvailabilityRequest", "");
4147
const response = await getJsonResponse<ThreeDSAvailabilityRequest, ThreeDSAvailabilityResponse>(
4248
resource,
4349
request,
4450
{ ...requestOptions, method: "POST" }
4551
);
46-
return ObjectSerializer.deserialize(response, "ThreeDSAvailabilityResponse");
52+
return ObjectSerializer.deserialize(response, "ThreeDSAvailabilityResponse", "");
4753
}
4854

4955
/**
56+
* @deprecated Use services/binLookup/binLookup
57+
*
5058
* @summary Get a fees cost estimate
5159
* @param costEstimateRequest {@link CostEstimateRequest }
5260
* @param requestOptions {@link IRequest.Options }
@@ -55,13 +63,13 @@ export class BinLookupAPI extends Service {
5563
public async getCostEstimate(costEstimateRequest: CostEstimateRequest, requestOptions?: IRequest.Options): Promise<CostEstimateResponse> {
5664
const endpoint = `${this.baseUrl}/getCostEstimate`;
5765
const resource = new Resource(this, endpoint);
58-
const request: CostEstimateRequest = ObjectSerializer.serialize(costEstimateRequest, "CostEstimateRequest");
66+
const request: CostEstimateRequest = ObjectSerializer.serialize(costEstimateRequest, "CostEstimateRequest", "");
5967
const response = await getJsonResponse<CostEstimateRequest, CostEstimateResponse>(
6068
resource,
6169
request,
6270
{ ...requestOptions, method: "POST" }
6371
);
64-
return ObjectSerializer.deserialize(response, "CostEstimateResponse");
72+
return ObjectSerializer.deserialize(response, "CostEstimateResponse", "");
6573
}
6674
}
6775

src/typings/binLookup/amount.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,29 @@ export class Amount {
1818
*/
1919
'value': number;
2020

21-
static discriminator: string | undefined = undefined;
21+
static readonly discriminator: string | undefined = undefined;
2222

23-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
23+
static readonly mapping: {[index: string]: string} | undefined = undefined;
24+
25+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2426
{
2527
"name": "currency",
2628
"baseName": "currency",
27-
"type": "string"
29+
"type": "string",
30+
"format": ""
2831
},
2932
{
3033
"name": "value",
3134
"baseName": "value",
32-
"type": "number"
35+
"type": "number",
36+
"format": "int64"
3337
} ];
3438

3539
static getAttributeTypeMap() {
3640
return Amount.attributeTypeMap;
3741
}
42+
43+
public constructor() {
44+
}
3845
}
3946

src/typings/binLookup/binDetail.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@ export class BinDetail {
1414
*/
1515
'issuerCountry'?: string;
1616

17-
static discriminator: string | undefined = undefined;
17+
static readonly discriminator: string | undefined = undefined;
1818

19-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
19+
static readonly mapping: {[index: string]: string} | undefined = undefined;
20+
21+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2022
{
2123
"name": "issuerCountry",
2224
"baseName": "issuerCountry",
23-
"type": "string"
25+
"type": "string",
26+
"format": ""
2427
} ];
2528

2629
static getAttributeTypeMap() {
2730
return BinDetail.attributeTypeMap;
2831
}
32+
33+
public constructor() {
34+
}
2935
}
3036

src/typings/binLookup/cardBin.ts

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,67 +54,83 @@ export class CardBin {
5454
*/
5555
'summary'?: string;
5656

57-
static discriminator: string | undefined = undefined;
57+
static readonly discriminator: string | undefined = undefined;
5858

59-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
59+
static readonly mapping: {[index: string]: string} | undefined = undefined;
60+
61+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
6062
{
6163
"name": "bin",
6264
"baseName": "bin",
63-
"type": "string"
65+
"type": "string",
66+
"format": ""
6467
},
6568
{
6669
"name": "commercial",
6770
"baseName": "commercial",
68-
"type": "boolean"
71+
"type": "boolean",
72+
"format": ""
6973
},
7074
{
7175
"name": "fundingSource",
7276
"baseName": "fundingSource",
73-
"type": "string"
77+
"type": "string",
78+
"format": ""
7479
},
7580
{
7681
"name": "fundsAvailability",
7782
"baseName": "fundsAvailability",
78-
"type": "string"
83+
"type": "string",
84+
"format": ""
7985
},
8086
{
8187
"name": "issuerBin",
8288
"baseName": "issuerBin",
83-
"type": "string"
89+
"type": "string",
90+
"format": ""
8491
},
8592
{
8693
"name": "issuingBank",
8794
"baseName": "issuingBank",
88-
"type": "string"
95+
"type": "string",
96+
"format": ""
8997
},
9098
{
9199
"name": "issuingCountry",
92100
"baseName": "issuingCountry",
93-
"type": "string"
101+
"type": "string",
102+
"format": ""
94103
},
95104
{
96105
"name": "issuingCurrency",
97106
"baseName": "issuingCurrency",
98-
"type": "string"
107+
"type": "string",
108+
"format": ""
99109
},
100110
{
101111
"name": "paymentMethod",
102112
"baseName": "paymentMethod",
103-
"type": "string"
113+
"type": "string",
114+
"format": ""
104115
},
105116
{
106117
"name": "payoutEligible",
107118
"baseName": "payoutEligible",
108-
"type": "string"
119+
"type": "string",
120+
"format": ""
109121
},
110122
{
111123
"name": "summary",
112124
"baseName": "summary",
113-
"type": "string"
125+
"type": "string",
126+
"format": ""
114127
} ];
115128

116129
static getAttributeTypeMap() {
117130
return CardBin.attributeTypeMap;
118131
}
132+
133+
public constructor() {
134+
}
119135
}
120136

src/typings/binLookup/costEstimateAssumptions.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,35 @@ export class CostEstimateAssumptions {
2222
*/
2323
'installments'?: number;
2424

25-
static discriminator: string | undefined = undefined;
25+
static readonly discriminator: string | undefined = undefined;
2626

27-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
27+
static readonly mapping: {[index: string]: string} | undefined = undefined;
28+
29+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2830
{
2931
"name": "assume3DSecureAuthenticated",
3032
"baseName": "assume3DSecureAuthenticated",
31-
"type": "boolean"
33+
"type": "boolean",
34+
"format": ""
3235
},
3336
{
3437
"name": "assumeLevel3Data",
3538
"baseName": "assumeLevel3Data",
36-
"type": "boolean"
39+
"type": "boolean",
40+
"format": ""
3741
},
3842
{
3943
"name": "installments",
4044
"baseName": "installments",
41-
"type": "number"
45+
"type": "number",
46+
"format": "int32"
4247
} ];
4348

4449
static getAttributeTypeMap() {
4550
return CostEstimateAssumptions.attributeTypeMap;
4651
}
52+
53+
public constructor() {
54+
}
4755
}
4856

0 commit comments

Comments
 (0)