Skip to content

Commit 4b2ffc1

Browse files
authored
Merge pull request #1520 from Adyen/nullable-attributes
Make non-native attributes nullable
2 parents 1d6b9b7 + 95deab0 commit 4b2ffc1

File tree

224 files changed

+1413
-1240
lines changed

Some content is hidden

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

224 files changed

+1413
-1240
lines changed

src/__tests__/terminalCloudAPI.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,5 +452,5 @@ export const syncTerminalPaymentResponse = {
452452
"additionalAttribute": "somethingElse",
453453
}
454454
}
455-
}
455+
};
456456

src/__tests__/terminalSettings.spec.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,17 @@ describe("TerminalSettings properties", () => {
77
terminalSettings = new TerminalSettings();
88
});
99

10-
// TMP: commented out to decide if attributes should be nullable (even when OpenAPI spec does not allow it)
11-
// https://github.com/Adyen/adyen-node-api-library/issues/1351
12-
//
13-
// test("should allow properties to be null", () => {
14-
// terminalSettings.cardholderReceipt = null;
15-
// terminalSettings.connectivity = null;
16-
// terminalSettings.gratuities = null;
17-
// terminalSettings.hardware = null;
18-
19-
// expect(terminalSettings.cardholderReceipt).toBeNull();
20-
// expect(terminalSettings.connectivity).toBeNull();
21-
// expect(terminalSettings.gratuities).toBeNull();
22-
// expect(terminalSettings.hardware).toBeNull();
23-
// });
10+
test("should allow properties to be null", () => {
11+
terminalSettings.cardholderReceipt = null;
12+
terminalSettings.connectivity = null;
13+
terminalSettings.gratuities = null;
14+
terminalSettings.hardware = null;
15+
16+
expect(terminalSettings.cardholderReceipt).toBeNull();
17+
expect(terminalSettings.connectivity).toBeNull();
18+
expect(terminalSettings.gratuities).toBeNull();
19+
expect(terminalSettings.hardware).toBeNull();
20+
});
2421

2522
test("should allow properties to be undefined", () => {
2623
terminalSettings.cardholderReceipt = undefined;

src/__tests__/webhooks/transferWebhook.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { EstimationTrackingData } from "../../typings/transferWebhooks/estimatio
22
import { TransferWebhooksHandler } from "../../typings/transferWebhooks/transferWebhooksHandler";
33

44
describe("Transfer Webhook Serialization", (): void => {
5-
// disabling temporarily (must address oneOf deserialization issue)
6-
it.skip("should correctly deserialize union types in transfer webhooks", () => {
5+
test("should correctly deserialize union types in transfer webhooks", () => {
76
// Simplest possible webhook with just the fields we need to test
87
const webhookData = {
98
data: {

src/typings/acsWebhooks/authenticationInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class AuthenticationInfo {
1515
* Universally unique transaction identifier assigned by the Access Control Server (ACS) to identify a single transaction.
1616
*/
1717
"acsTransId": string;
18-
"challenge"?: ChallengeInfo;
18+
"challenge"?: ChallengeInfo | null;
1919
/**
2020
* Specifies a preference for receiving a challenge. Possible values: * **01**: No preference * **02**: No challenge requested * **03**: Challenge requested (preference) * **04**: Challenge requested (mandate) * **05**: No challenge requested (transactional risk analysis is already performed) * **07**: No challenge requested (SCA is already performed) * **08**: No challenge requested (trusted beneficiaries exemption of no challenge required) * **09**: Challenge requested (trusted beneficiaries prompt requested if challenge required) * **80**: No challenge requested (secure corporate payment with Mastercard) * **82**: No challenge requested (secure corporate payment with Visa)
2121
*/
@@ -83,7 +83,7 @@ export class AuthenticationInfo {
8383
{
8484
"name": "challenge",
8585
"baseName": "challenge",
86-
"type": "ChallengeInfo",
86+
"type": "ChallengeInfo | null",
8787
"format": ""
8888
},
8989
{

src/typings/binLookup/costEstimateRequest.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Recurring } from "./recurring";
1515

1616
export class CostEstimateRequest {
1717
"amount": Amount;
18-
"assumptions"?: CostEstimateAssumptions;
18+
"assumptions"?: CostEstimateAssumptions | null;
1919
/**
2020
* The card number (4-19 characters) for PCI compliant use cases. Do not use any separators. > Either the `cardNumber` or `encryptedCardNumber` field must be provided in a payment request.
2121
*/
@@ -28,8 +28,8 @@ export class CostEstimateRequest {
2828
* The merchant account identifier you want to process the (transaction) request with.
2929
*/
3030
"merchantAccount": string;
31-
"merchantDetails"?: MerchantDetails;
32-
"recurring"?: Recurring;
31+
"merchantDetails"?: MerchantDetails | null;
32+
"recurring"?: Recurring | null;
3333
/**
3434
* The `recurringDetailReference` you want to use for this cost estimate. The value `LATEST` can be used to select the most recently stored recurring detail.
3535
*/
@@ -57,7 +57,7 @@ export class CostEstimateRequest {
5757
{
5858
"name": "assumptions",
5959
"baseName": "assumptions",
60-
"type": "CostEstimateAssumptions",
60+
"type": "CostEstimateAssumptions | null",
6161
"format": ""
6262
},
6363
{
@@ -81,13 +81,13 @@ export class CostEstimateRequest {
8181
{
8282
"name": "merchantDetails",
8383
"baseName": "merchantDetails",
84-
"type": "MerchantDetails",
84+
"type": "MerchantDetails | null",
8585
"format": ""
8686
},
8787
{
8888
"name": "recurring",
8989
"baseName": "recurring",
90-
"type": "Recurring",
90+
"type": "Recurring | null",
9191
"format": ""
9292
},
9393
{

src/typings/binLookup/costEstimateResponse.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { CardBin } from "./cardBin";
1212

1313

1414
export class CostEstimateResponse {
15-
"cardBin"?: CardBin;
16-
"costEstimateAmount"?: Amount;
15+
"cardBin"?: CardBin | null;
16+
"costEstimateAmount"?: Amount | null;
1717
/**
1818
* Adyen\'s 16-character reference associated with the request.
1919
*/
@@ -31,13 +31,13 @@ export class CostEstimateResponse {
3131
{
3232
"name": "cardBin",
3333
"baseName": "cardBin",
34-
"type": "CardBin",
34+
"type": "CardBin | null",
3535
"format": ""
3636
},
3737
{
3838
"name": "costEstimateAmount",
3939
"baseName": "costEstimateAmount",
40-
"type": "Amount",
40+
"type": "Amount | null",
4141
"format": ""
4242
},
4343
{

src/typings/binLookup/threeDSAvailabilityResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ThreeDS2CardRangeDetail } from "./threeDS2CardRangeDetail";
1313

1414

1515
export class ThreeDSAvailabilityResponse {
16-
"binDetails"?: BinDetail;
16+
"binDetails"?: BinDetail | null;
1717
/**
1818
* List of Directory Server (DS) public keys.
1919
*/
@@ -39,7 +39,7 @@ export class ThreeDSAvailabilityResponse {
3939
{
4040
"name": "binDetails",
4141
"baseName": "binDetails",
42-
"type": "BinDetail",
42+
"type": "BinDetail | null",
4343
"format": ""
4444
},
4545
{

src/typings/checkout/additionalDataSubMerchant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class AdditionalDataSubMerchant {
3434
*/
3535
"subMerchant_subSeller_subSellerNr_mcc"?: string;
3636
/**
37-
* Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. * Format: Alphanumeric * Maximum length: 22 characters
37+
* Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. Exception: for acquirers in Brazil, this value does not overwrite the shopper statement. * Format: Alphanumeric * Maximum length: 22 characters
3838
*/
3939
"subMerchant_subSeller_subSellerNr_name"?: string;
4040
/**

src/typings/checkout/airline.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { TravelAgency } from "./travelAgency";
1515

1616

1717
export class Airline {
18-
"agency"?: Agency;
18+
"agency"?: Agency | null;
1919
/**
2020
* The amount charged for boarding the plane, in [minor units](https://docs.adyen.com/development-resources/currency-codes). * Encoding: Numeric * minLength: 1 character * maxLength: 11 characters
2121
*/
@@ -50,8 +50,8 @@ export class Airline {
5050
*/
5151
"passengerName": string;
5252
"passengers"?: Array<Passenger>;
53-
"ticket"?: Ticket;
54-
"travelAgency"?: TravelAgency;
53+
"ticket"?: Ticket | null;
54+
"travelAgency"?: TravelAgency | null;
5555

5656
static readonly discriminator: string | undefined = undefined;
5757

@@ -61,7 +61,7 @@ export class Airline {
6161
{
6262
"name": "agency",
6363
"baseName": "agency",
64-
"type": "Agency",
64+
"type": "Agency | null",
6565
"format": ""
6666
},
6767
{
@@ -127,13 +127,13 @@ export class Airline {
127127
{
128128
"name": "ticket",
129129
"baseName": "ticket",
130-
"type": "Ticket",
130+
"type": "Ticket | null",
131131
"format": ""
132132
},
133133
{
134134
"name": "travelAgency",
135135
"baseName": "travelAgency",
136-
"type": "TravelAgency",
136+
"type": "TravelAgency | null",
137137
"format": ""
138138
} ];
139139

src/typings/checkout/applicationInfo.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { ShopperInteractionDevice } from "./shopperInteractionDevice";
1414

1515

1616
export class ApplicationInfo {
17-
"adyenLibrary"?: CommonField;
18-
"adyenPaymentSource"?: CommonField;
19-
"externalPlatform"?: ExternalPlatform;
20-
"merchantApplication"?: CommonField;
21-
"merchantDevice"?: MerchantDevice;
22-
"shopperInteractionDevice"?: ShopperInteractionDevice;
17+
"adyenLibrary"?: CommonField | null;
18+
"adyenPaymentSource"?: CommonField | null;
19+
"externalPlatform"?: ExternalPlatform | null;
20+
"merchantApplication"?: CommonField | null;
21+
"merchantDevice"?: MerchantDevice | null;
22+
"shopperInteractionDevice"?: ShopperInteractionDevice | null;
2323

2424
static readonly discriminator: string | undefined = undefined;
2525

@@ -29,37 +29,37 @@ export class ApplicationInfo {
2929
{
3030
"name": "adyenLibrary",
3131
"baseName": "adyenLibrary",
32-
"type": "CommonField",
32+
"type": "CommonField | null",
3333
"format": ""
3434
},
3535
{
3636
"name": "adyenPaymentSource",
3737
"baseName": "adyenPaymentSource",
38-
"type": "CommonField",
38+
"type": "CommonField | null",
3939
"format": ""
4040
},
4141
{
4242
"name": "externalPlatform",
4343
"baseName": "externalPlatform",
44-
"type": "ExternalPlatform",
44+
"type": "ExternalPlatform | null",
4545
"format": ""
4646
},
4747
{
4848
"name": "merchantApplication",
4949
"baseName": "merchantApplication",
50-
"type": "CommonField",
50+
"type": "CommonField | null",
5151
"format": ""
5252
},
5353
{
5454
"name": "merchantDevice",
5555
"baseName": "merchantDevice",
56-
"type": "MerchantDevice",
56+
"type": "MerchantDevice | null",
5757
"format": ""
5858
},
5959
{
6060
"name": "shopperInteractionDevice",
6161
"baseName": "shopperInteractionDevice",
62-
"type": "ShopperInteractionDevice",
62+
"type": "ShopperInteractionDevice | null",
6363
"format": ""
6464
} ];
6565

0 commit comments

Comments
 (0)