Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITT-556]Regenerated binlookup and fix tests #1176

Merged
merged 9 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:=balanceControl balancePlatform binlookup checkout dataProtection legal
models: $(services)

balanceControl: spec=BalanceControlService-v1
binlookup: spec=BinLookupService-v52 # we should bump this to 54
binLookup: spec=BinLookupService-v54
checkout: spec=CheckoutService-v70
dataProtection: spec=DataProtectionService-v1
storedValue: spec=StoredValueService-v46
Expand Down Expand Up @@ -40,7 +40,7 @@ $(services): build/spec $(openapi-generator-jar)

# Service + Models automation
services:=checkout management legalEntityManagement
singleFileServices:=balanceControl recurring terminalManagement
singleFileServices:=balanceControl recurring payout binLookup terminalManagement

$(services): build/spec $(openapi-generator-jar)
rm -rf $(models)/$@ build/model
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This library supports the following:

| API name | API version | Description | API object |
|----------|:-----------:|-------------|------------|
| [BIN lookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v52/overview) | v52 | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [BinLookup](https://github.com/Adyen/adyen-node-api-library/blob/develop/src/services/binLookup.ts) |
| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | v54 | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [BinLookup](https://github.com/Adyen/adyen-node-api-library/blob/develop/src/services/binLookup.ts) |
| [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v70/overview) | v70 | Our latest integration for accepting online payments. | [CheckoutAPI](https://github.com/Adyen/adyen-node-api-library/blob/develop/src/services/checkout.ts) |
| [Configuration API](https://docs.adyen.com/api-explorer/#/balanceplatform/v2/overview) | v2 | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | [BalancePlatform](https://github.com/Adyen/adyen-node-api-library/blob/develop/src/services/balancePlatform.ts) |
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | v1 | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | [DataProtection](https://github.com/Adyen/adyen-node-api-library/blob/develop/src/services/dataProtection.ts) |
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/binLookup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nock from "nock";
import { createClient } from "../__mocks__/base";
import BinLookup from "../services/binLookup";
import BinLookup from "../services/binLookupApi";
import Client from "../client";
import HttpClientException from "../httpClient/httpClientException";
import { binlookup } from "../typings";
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/httpClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nock, { Interceptor } from "nock";
import Client from "../client";
import { BinLookup } from "../services";
import { BinLookupAPI } from "../services";
import ApiException from "../services/exception/apiException";
import HttpClientException from "../httpClient/httpClientException";

Expand All @@ -23,7 +23,7 @@ type testOptions = { errorType: errorType; errorMessageContains?: string; errorM

const getResponse = async ({apiKey , environment }: { apiKey: string; environment: Environment}, cb: (scope: Interceptor) => testOptions): Promise<void> => {
const client = new Client({ apiKey, environment });
const binLookup = new BinLookup(client);
const binLookup = new BinLookupAPI(client);

const scope = nock(`${client.config.endpoint}${Client.BIN_LOOKUP_PAL_SUFFIX}${Client.BIN_LOOKUP_API_VERSION}`)
.post("/get3dsAvailability");
Expand All @@ -47,7 +47,7 @@ const getResponse = async ({apiKey , environment }: { apiKey: string; environmen
describe("HTTP Client", function (): void {
it.each`
apiKey | environment | withError | args | errorType | contains | equals
${""} | ${"TEST"} | ${true} | ${["mocked_error_response"]} | ${"ApiException"} | ${"x-api-key"} | ${""}
${""} | ${"TEST"} | ${true} | ${["mocked_error_response"]} | ${"ApiException"} | ${"mocked_error_response"} | ${""}
${"MOCKED_API_KEY"} | ${"TEST"} | ${true} | ${["some_error"]} | ${"ApiException"} | ${""} | ${"some_error"}
${"API_KEY"} | ${"TEST"} | ${false} | ${[401, { status: 401, message: "Invalid Request", errorCode: "171", errorType: "validationError"}]} | ${"HttpClientException"} | ${""} | ${"HTTP Exception: 401. null: Invalid Request"}
${"API_KEY"} | ${"TEST"} | ${false} | ${[401, {}]} | ${"HttpClientException"} | ${""} | ${"HTTP Exception: 401. null"}
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Client {
public static CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
public static CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
public static BIN_LOOKUP_PAL_SUFFIX = "/pal/servlet/BinLookup/";
public static BIN_LOOKUP_API_VERSION = "v50";
public static BIN_LOOKUP_API_VERSION = "v54";
public static TERMINAL_API_ENDPOINT_TEST = "https://terminal-api-test.adyen.com";
public static TERMINAL_API_ENDPOINT_LIVE = "https://terminal-api-live.adyen.com";
public static ENDPOINT_PROTOCOL = "https://";
Expand Down
38 changes: 0 additions & 38 deletions src/services/binLookup.ts

This file was deleted.

63 changes: 63 additions & 0 deletions src/services/binLookupApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { CostEstimateRequest } from "../typings/binLookup/models";
import { CostEstimateResponse } from "../typings/binLookup/models";
import { ThreeDSAvailabilityRequest } from "../typings/binLookup/models";
import { ThreeDSAvailabilityResponse } from "../typings/binLookup/models";
import { IRequest } from "../typings/requestOptions";
import BinLookupResource from "./resource/binLookupResource";
import { ObjectSerializer } from "../typings/binLookup/models";

export class BinLookupAPI extends Service {
public constructor(client: Client) {
super(client);
}

/**
* @summary Check if 3D Secure is available
* @param threeDSAvailabilityRequest {@link ThreeDSAvailabilityRequest }
* @param requestOptions {@link IRequest.Options}
* @return {@link ThreeDSAvailabilityResponse }
*/
public async get3dsAvailability(threeDSAvailabilityRequest: ThreeDSAvailabilityRequest, requestOptions?: IRequest.Options): Promise<ThreeDSAvailabilityResponse> {
const localVarPath = "/get3dsAvailability";
const resource = new BinLookupResource(this, localVarPath);
const request: ThreeDSAvailabilityRequest = ObjectSerializer.serialize(threeDSAvailabilityRequest, "ThreeDSAvailabilityRequest");
const response = await getJsonResponse<ThreeDSAvailabilityRequest, ThreeDSAvailabilityResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "ThreeDSAvailabilityResponse");
}

/**
* @summary Get a fees cost estimate
* @param costEstimateRequest {@link CostEstimateRequest }
* @param requestOptions {@link IRequest.Options}
* @return {@link CostEstimateResponse }
*/
public async getCostEstimate(costEstimateRequest: CostEstimateRequest, requestOptions?: IRequest.Options): Promise<CostEstimateResponse> {
const localVarPath = "/getCostEstimate";
const resource = new BinLookupResource(this, localVarPath);
const request: CostEstimateRequest = ObjectSerializer.serialize(costEstimateRequest, "CostEstimateRequest");
const response = await getJsonResponse<CostEstimateRequest, CostEstimateResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CostEstimateResponse");
}
}

export default BinLookupAPI;
2 changes: 1 addition & 1 deletion src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export { default as TerminalCloudAPI } from "./terminalCloudAPI";
export { default as CheckoutAPI } from "./checkout";
export { default as ClassicIntegrationAPI } from "./classicIntegration";
export { default as RecurringAPI } from "./recurringApi";
export { default as BinLookup } from "./binLookup";
export { default as BinLookupAPI } from "./binLookupApi";
export { default as Payout } from "./payout";
export { default as Platforms } from "./platforms";
export { default as StoredValue} from "./storedValue";
Expand Down
33 changes: 0 additions & 33 deletions src/services/resource/binLookup/get3dsAvailability.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/services/resource/binLookup/getCostEstimate.ts

This file was deleted.

14 changes: 14 additions & 0 deletions src/services/resource/binLookupResource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Resource from "./../resource";
import Service from "./../../service";
import Client from "./../../client";

class BinLookupResource extends Resource {
public constructor(service: Service, endpoint: String) {
super(
service,
`${service.client.config.endpoint}${Client.BIN_LOOKUP_PAL_SUFFIX}${Client.BIN_LOOKUP_API_VERSION}${endpoint}`
);
}
}

export default BinLookupResource;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -26,6 +26,10 @@ export class CardBin {
*/
'fundsAvailability'?: string;
/**
* The first 8 digit of the card number. Enable this field via merchant account settings.
*/
'issuerBin'?: string;
/**
* The issuing bank of the card.
*/
'issuingBank'?: string;
Expand Down Expand Up @@ -73,6 +77,11 @@ export class CardBin {
"baseName": "fundsAvailability",
"type": "string"
},
{
"name": "issuerBin",
"baseName": "issuerBin",
"type": "string"
},
{
"name": "issuingBank",
"baseName": "issuingBank",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v52
* The version of the OpenAPI document: v54
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -26,9 +26,9 @@ export class ThreeDS2CardRangeDetail {
*/
'startRange'?: string;
/**
* 3D Secure protocol version.
* Supported 3D Secure protocol versions
*/
'threeDS2Version'?: string;
'threeDS2Versions'?: Array<string>;
/**
* In a 3D Secure 2 browser-based flow, this is the URL where you should send the device fingerprint to.
*/
Expand Down Expand Up @@ -58,9 +58,9 @@ export class ThreeDS2CardRangeDetail {
"type": "string"
},
{
"name": "threeDS2Version",
"baseName": "threeDS2Version",
"type": "string"
"name": "threeDS2Versions",
"baseName": "threeDS2Versions",
"type": "Array<string>"
},
{
"name": "threeDSMethodURL",
Expand Down
Loading