Giter Club home page Giter Club logo

adyen-node-api-library's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adyen-node-api-library's Issues

[BUG] FS Module not found

Describe the bug
Hello, after installing @adyen/api-library via yarn I get the following error:

ERROR  Failed to compile with 1 error                                                                                                                                                                    

This dependency was not found:                                                                                                                                                                             
* fs in ./node_modules/@adyen/api-library/lib/src/httpClient/httpURLConnectionClient.js  

To Reproduce
Install @adyen/api-library version ^6.0.1 via yarn
yarn add @adyen/api-library
And try to run the code.

Expected behavior
Run perfectly.

Screenshot of typescript file
image

Desktop (please complete the following information):

  • OS: Ubuntu 20.10
  • Node Version: 12.18.2
  • NPM Version: 6.14.8
  • Yarn Version: 1.22.5

[BUG] Missing merchantReference on PaymentResponse

Describe the bug
When calling CheckoutAPI.payments, the PaymentResponse should contain a merchantReference according to the api documentation https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v50/payments.

However this is currently missing from the type.

To Reproduce
Make a call to CheckoutAPI.payments

Expected behavior
Should contain merchantReference in the PaymentResponse

Screenshots
N/A

Desktop (please complete the following information):
N/A

Additional context
N/A

[FEATURE] Highlight the supported API version in the library version

Is your feature request related to a problem? Please describe.
We are sometimes relying on specific API versions to make sure that some bugs or other previously unavailable functionality can be used. It's however not specified anywhere within the node library (at least I can't find) what is the API version that each of the new releases support.

For example, now we would need to use the latest v66 Checkout API, since it fixed a critical issue for us, but I do not know if this library uses it yet or not.

Describe the solution you'd like
For each new release, describe the corresponding API versions that it uses/supports

[BUG]TypeError: WEBPACK_IMPORTED_MODULE_3_url.URL is not a constructor

Describe the bug
I has an issue "TypeError: WEBPACK_IMPORTED_MODULE_3_url.URL is not a constructor
at HttpURLConnectionClient../node_modules/@adyen/api-library/dist/lib-esm/src/httpClient/httpURLConnectionClient.js.HttpURLConnectionClient.createRequest (httpURLConnectionClient.js:66)"

image
To Reproduce
I'm using TerminalCloudAPI on NPM Version: 6.9 to integrate pos with adyen terminal v400m.

I wonder if somebody has the same this issue?

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • NPM Version: 6.9

Additional context
Add any other context about the problem here.

[BUG] ICheckout types are not exported

When working with Typescript, I'd like to use pre-built types from ICheckout (and other) namespace (AccountInfo, ...).
Because they have no export prefix, tsc compiler does not recognize and process them.

To Reproduce

  1. Declare a function as this:
export function getPaymentMethods(): Promise<ICheckout.PaymentResponse> {
  return return checkout.paymentMethods({...})
}

Where you CANNOT import the specific interface as

import { PaymentResponse /*, ICheckout */ } from "@adyen/api-library"

nor

import { PaymentResponse /*, ICheckout */ } from "@adyen/api-library/dist/lib/src/typings/checkout";
  1. Build your code using tsc --build (this code is part of a composite project).

Expected behavior
Successful build.

Actual behaviour

$ tsc --build
../composite-project/dist/src/adyen.d.ts:73:13 - error TS2503: Cannot find namespace 'ICheckout'.

73 }): Promise<ICheckout.PaymentMethodsResponse>;

Desktop (please complete the following information):

  • OS: Mac | Linux
  • Node Version: 12.14
  • NPM Version: 6.13
  • Adyen version: 3.1.3

Improve typings for client/config objects creation

Hello,

After using the SDK for some time, I noticed there is an opportunity to improve currently exposed API so that it better reflects use cases.

Because this is structured similarly in multiple places, let's maybe focus on (defined on Client class):
https://github.com/Adyen/adyen-node-api-library/blob/develop/src/client.ts#L103

public setEnvironment(environment: Environment, liveEndpointUrlPrefix?: string): void {
where
type Environment = "LIVE" | "TEST";

Assuming we have an instance of Client class client already instantiated, there are two (allowed by documentation) ways to set it, namely:

client.setEnvironement("TEST");
and
client.setEnvironement("LIVE", "your-endpoint-prefix");

unfortunately, current typings also make
client.setEnvironment("TEST", "your-endpoint-prefix");
and
client.setEnvironment("LIVE"); valid.

While the first one is not only unlikely but also of minor importance (nothing more than small technical glitch here), the second one compiles and suggests that nothing is wrong until the project is run in live environment - and it fails there with error "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.". Error is informative and actionable, that's very good! But it's only available on runtime on live environment.

My suggestion would be to change current invocations to something along the lines of:
public setEnvironment(option: { environment: "TEST"; } | { environment: "LIVE"; liveEndpointUrlPrefix: string }): void {

It's only slightly less convenient to write it this way but it makes it obvious on compile-time that liveEndpointUrlPrefix needs to be passed or it won't work.

I prepared a small self-contained example here: https://www.typescriptlang.org/play?#code/C4TwDgpgBAKhDOwCiA7AbgSwE4HsUFsIVgoBeKAIhiQGUYKAoUSKAGQzQlU1wKJPIVWASQBqSRk3DRu2PIWJlYCZOjl9FAHzYcua3guAMpLAMIAbDPwAKAQyy3CwCFngB5TlnM5bAEyUA3gxQIVBEPPL8AFxQsgb8waFEvmA4GMQA-DGIWOkA5gwAvsbM0BZWxHYOTi7unt5+AEyBiSHh6oYxcIhxkcRFUNpBoWH6fcAx7Jy9GkYjyanpE1A5+QDcRcYMAMZ4iFC7KABmGHkA+pacMeU29o4Qzq4eLg3+5MNJY7MxQmISmzs9iRDidzs5ENdLLdqg9as8vD43lAPm0vp1KNQ6IxigwAPS4qCmHD4MAYczQFy4LBQAAWLmgAFooHkcDhfABCQEofYg06NC66SEVYBVe6POovRHNd6tUYRb6UETibHGQ48vCg-ng5Y3Sp3GpPepSlrzNHRDG0ehFIA

I'm happy to hear what are your views on the matter.

Cheers,
Michał

[BUG] Version 3.1.2 missing typings file

Describe the bug
A clear and concise description of what the bug is.

When installing latest version 3.1.2, only index.js is found from dist folder, so the typings are not bundled. Version 3.1.1 bundles the typings correctly.

To Reproduce
Steps to reproduce the behavior

  • Install latest version yarn add @adyen/[email protected]
  • Check dist folder, missing typings declaration file

Expected behavior

A clear and concise description of what you expected to happen.

  • Typings declarations should be included in the dist folder

Desktop (please complete the following information):

  • OS: Mac
  • Yarn Version: 1.22.4

[BUG] notification types notificationItem and additionalData are incorrect in v5.0.1

Describe the bug

  • notificationItem.d.ts has field 'notificationRequestItem', in reality comes back with 'NotificationRequestItem'
  • additionalData.d.ts missing a number of fields such as cardBin, paymentMethodVariant, etc that can actually be included in notifications

To Reproduce
Types as they are present in v5.0.1 library:

export declare class AdditionalData {
    'shopperReference'?: string;
    'shopperEmail'?: string;
    'authCode'?: string;
    'cardSummary'?: string;
    'expiryDate'?: string;
    'authorisedAmountValue'?: string;
    'authorisedAmountCurrency'?: string;
    'hmacSignature'?: string;
    static discriminator: string | undefined;
    static attributeTypeMap: Array<{
        name: string;
        baseName: string;
        type: string;
    }>;
    static getAttributeTypeMap(): {
        name: string;
        baseName: string;
        type: string;
    }[];
}

import { NotificationItem } from './notificationItem';
export declare class Notification {
    'live': string;
    'notificationItems': Array<NotificationItem>;
    static discriminator: string | undefined;
    static attributeTypeMap: Array<{
        name: string;
        baseName: string;
        type: string;
    }>;
    static getAttributeTypeMap(): {
        name: string;
        baseName: string;
        type: string;
    }[];
}

Expected behavior

  • expect notification.d.ts to have key 'NotificationRequestItem' (in upper case)
  • expect additionalData.d.ts to have all keys that actually come back in notification

Additional context
We import these types into out project and validate against them. This fact that these types are incorrect in v5.0.1 is making it difficult for us to upgrade (we are currently on 3.1.3).
Finally, notification type amount now has optional currency and value - when would notification not actually return amount currency and value? we have to make changes to our code following this change, and it would be good to know if this is actually a planned change??

[BUG] TerminalCloudApi sending paymentRequest even when it's not payment

Describe the bug
When I try to use the TerminalCloudApi to perform a refund, the library is adding a paymentRequest object, causing an error

To Reproduce
Try to place a refund through the package with this payload:

{
    "saleToPoiRequest": {
        "messageHeader": {
            "protocolVersion": "3.0",
            "messageClass": "Service",
            "messageCategory": "Reversal",
            "messageType": "Request",
            "saleId": "Supersonic",
            "serviceId": "63291636",
            "poiid": "P400Plus-275051867"
        },
        "reversalRequest": {
            "originalPoiTransaction": {
                "poiTransactionId": {
                    "transactionId": "4uPz001587655334008.853587655338027B",
                    "timeStamp": "2020-04-23T14:34:51-03:00"
                }
            },
            "reversalReason": "MerchantCancel"
        }
    }
}

Error returned was this:

Error: Invalid value {
    "messageHeader": {
        "messageCategory": "Reversal",
        "messageClass": "Service",
        "messageType": "Request",
        "poiid": "P400Plus-275051867",
        "protocolVersion": "3.0",
        "saleId": "Supersonic",
        "serviceId": "63318806"
    },
    "reversalRequest": {
        "originalPoiTransaction": {
            "poiTransactionId": {
                "transactionId": "4uPz001587655334008.853587655338027B",
                "timeStamp": "2020-04-23T14:35:18-03:00"
            }
        },
        "reversalReason": "MerchantCancel",
        "reversedAmount": 16.88,
        "saleData": {
            "saleToAcquirerData": "currency=NZD",
            "saleTransactionId": {
                "timeStamp": "2020-04-23T14:35:18-03:00",
                "transactionId": "4uPz001587655334008.853587655338027B"
            }
        }
    },
    "paymentRequest": {
        "saleData": {
            "saleToAcquirerData": {
                "applicationInfo": {
                    "adyenLibrary": {
                        "name": "adyen-node-api-library",
                        "version": "3.1.1"
                    }
                }
            }
        }
    }
} for type [
    null,
    {
        "ref": "SaleToPoiRequest"
    }
]

Expected behavior
It shouldn't add the paymentRequest object into a refund request

Desktop (please complete the following information):

  • OS: Linux
  • Node Version: 13.13.0
  • NPM Version: 6.14.4

Additional context
From my search into the code, I found that the TerminalCloudApi merges a paymentRequest into the request in the method setApplicationInfo. This

[BUG] Missing typescript types

Describe the bug
using version 2.2.0, I cannot start a typescript project including the library.

Using the previous version 2.1.8 everything works fine.

To Reproduce
npm install --save @adyen/[email protected]

Expected behavior
project runs

Screenshots
Not screenshots but logs of the errors:

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:11:18 - error TS2304: Cannot find name 'Environment'.

11     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:16:18 - error TS2304: Cannot find name 'Environment'.

16     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:22:18 - error TS2304: Cannot find name 'Environment'.

22     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:28:18 - error TS2304: Cannot find name 'Environment'.

28     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:34:18 - error TS2304: Cannot find name 'Environment'.

34     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:37:18 - error TS2304: Cannot find name 'Environment'.

37     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:41:18 - error TS2304: Cannot find name 'Environment'.

41     environment: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/client.d.ts:72:33 - error TS2304: Cannot find name 'Environment'.

72     setEnvironment(environment: Environment, liveEndpointUrlPrefix?: string): void;
                                   ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/config.d.ts:5:19 - error TS2304: Cannot find name 'Environment'.

5     environment?: Environment;
                    ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/config.d.ts:24:19 - error TS2304: Cannot find name 'Environment'.

24     environment?: Environment;
                     ~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/httpClient/clientInterface.d.ts:7:105 - error TS2503: Cannot find namespace 'IRequest'.

7     request(endpoint: string, json: string, config: Config, isApiKeyRequired: boolean, requestOptions?: IRequest.Options): Promise<string | HttpClientException | ApiException>;
                                                                                                          ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/httpClient/httpURLConnectionClient.d.ts:11:101 - error TS2503: Cannot find namespace 'IRequest'.

11     request(endpoint: string, json: string, config: Config, isApiRequired: boolean, requestOptions: IRequest.Options): Promise<string | HttpClientException | ApiException>;
                                                                                                       ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/binLookup.d.ts:7:33 - error TS2503: Cannot find namespace 'IBinLookup'.

7     get3dsAvailability(request: IBinLookup.ThreeDSAvailabilityRequest): Promise<IBinLookup.ThreeDSAvailabilityResponse>;
                                  ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/binLookup.d.ts:7:81 - error TS2503: Cannot find namespace 'IBinLookup'.

7     get3dsAvailability(request: IBinLookup.ThreeDSAvailabilityRequest): Promise<IBinLookup.ThreeDSAvailabilityResponse>;
                                                                                  ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/binLookup.d.ts:8:30 - error TS2503: Cannot find namespace 'IBinLookup'.

8     getCostEstimate(request: IBinLookup.CostEstimateRequest): Promise<IBinLookup.CostEstimateResponse>;
                               ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/binLookup.d.ts:8:71 - error TS2503: Cannot find namespace 'IBinLookup'.

8     getCostEstimate(request: IBinLookup.CostEstimateRequest): Promise<IBinLookup.CostEstimateResponse>;
                                                                        ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/checkout.d.ts:11:74 - error TS2503: Cannot find namespace 'IRequest'.

11     payments(paymentsRequest: ICheckout.PaymentRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentResponse>;
                                                                            ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/checkout.d.ts:15:91 - error TS2503: Cannot find namespace 'IRequest'.

15     paymentSession(paymentSessionRequest: ICheckout.PaymentSetupRequest, requestOptions?: IRequest.Options): Promise<ICheckout.PaymentSetupResponse>;
                                                                                             ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/checkoutUtility.d.ts:6:35 - error TS2503: Cannot find namespace 'ICheckoutUtility'.

6     originKeys(originKeysRequest: ICheckoutUtility.CheckoutUtilityRequest): Promise<ICheckoutUtility.CheckoutUtilityResponse>;
                                    ~~~~~~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/checkoutUtility.d.ts:6:85 - error TS2503: Cannot find namespace 'ICheckoutUtility'.

6     originKeys(originKeysRequest: ICheckoutUtility.CheckoutUtilityRequest): Promise<ICheckoutUtility.CheckoutUtilityResponse>;
                                                                                      ~~~~~~~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:16:44 - error TS2503: Cannot find namespace 'IPayments'.

16     capture(captureRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                              ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:16:93 - error TS2503: Cannot find namespace 'IRequest'.

16     capture(captureRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                               ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:16:120 - error TS2503: Cannot find namespace 'IPayments'.

16     capture(captureRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                          ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:17:58 - error TS2503: Cannot find namespace 'IPayments'.

17     cancelOrRefund(cancelOrRefundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                            ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:17:107 - error TS2503: Cannot find namespace 'IRequest'.

17     cancelOrRefund(cancelOrRefundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                             ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:17:134 - error TS2503: Cannot find namespace 'IPayments'.

17     cancelOrRefund(cancelOrRefundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                                        ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:18:42 - error TS2503: Cannot find namespace 'IPayments'.

18     refund(refundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                            ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:18:91 - error TS2503: Cannot find namespace 'IRequest'.

18     refund(refundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                             ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:18:118 - error TS2503: Cannot find namespace 'IPayments'.

18     refund(refundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                        ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:19:42 - error TS2503: Cannot find namespace 'IPayments'.

19     cancel(cancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                            ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:19:91 - error TS2503: Cannot find namespace 'IRequest'.

19     cancel(cancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                             ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:19:118 - error TS2503: Cannot find namespace 'IPayments'.

19     cancel(cancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                        ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:20:60 - error TS2503: Cannot find namespace 'IPayments'.

20     technicalCancel(technicalCancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                              ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:20:109 - error TS2503: Cannot find namespace 'IRequest'.

20     technicalCancel(technicalCancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                               ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:20:136 - error TS2503: Cannot find namespace 'IPayments'.

20     technicalCancel(technicalCancelRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                                          ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:21:68 - error TS2503: Cannot find namespace 'IPayments'.

21     adjustAuthorisation(adjustAuthorisationRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                      ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:21:117 - error TS2503: Cannot find namespace 'IRequest'.

21     adjustAuthorisation(adjustAuthorisationRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                       ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/modification.d.ts:21:144 - error TS2503: Cannot find namespace 'IPayments'.

21     adjustAuthorisation(adjustAuthorisationRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;
                                                                                                                                                  ~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:11:45 - error TS2503: Cannot find namespace 'IPayouts'.

11     storeDetailAndSubmitThirdParty(request: IPayouts.StoreDetailAndSubmitRequest): Promise<IPayouts.StoreDetailAndSubmitResponse>;
                                               ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:11:92 - error TS2503: Cannot find namespace 'IPayouts'.

11     storeDetailAndSubmitThirdParty(request: IPayouts.StoreDetailAndSubmitRequest): Promise<IPayouts.StoreDetailAndSubmitResponse>;
                                                                                              ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:12:32 - error TS2503: Cannot find namespace 'IPayouts'.

12     confirmThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse>;
                                  ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:12:65 - error TS2503: Cannot find namespace 'IPayouts'.

12     confirmThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse>;
                                                                   ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:13:32 - error TS2503: Cannot find namespace 'IPayouts'.

13     declineThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse>;
                                  ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:13:65 - error TS2503: Cannot find namespace 'IPayouts'.

13     declineThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse>;
                                                                   ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:14:26 - error TS2503: Cannot find namespace 'IPayouts'.

14     storeDetail(request: IPayouts.StoreDetailRequest): Promise<IPayouts.StoreDetailResponse>;
                            ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:14:64 - error TS2503: Cannot find namespace 'IPayouts'.

14     storeDetail(request: IPayouts.StoreDetailRequest): Promise<IPayouts.StoreDetailResponse>;
                                                                  ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:15:31 - error TS2503: Cannot find namespace 'IPayouts'.

15     submitThirdparty(request: IPayouts.SubmitRequest): Promise<IPayouts.SubmitResponse>;
                                 ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:15:64 - error TS2503: Cannot find namespace 'IPayouts'.

15     submitThirdparty(request: IPayouts.SubmitRequest): Promise<IPayouts.SubmitResponse>;
                                                                  ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:16:21 - error TS2503: Cannot find namespace 'IPayouts'.

16     payout(request: IPayouts.PayoutRequest): Promise<IPayouts.PayoutResponse>;
                       ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/payout.d.ts:16:54 - error TS2503: Cannot find namespace 'IPayouts'.

16     payout(request: IPayouts.PayoutRequest): Promise<IPayouts.PayoutResponse>;
                                                        ~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/recurring.d.ts:7:35 - error TS2503: Cannot find namespace 'IRecurring'.

7     listRecurringDetails(request: IRecurring.RecurringDetailsRequest): Promise<IRecurring.RecurringDetailsResult>;
                                    ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/recurring.d.ts:7:80 - error TS2503: Cannot find namespace 'IRecurring'.

7     listRecurringDetails(request: IRecurring.RecurringDetailsRequest): Promise<IRecurring.RecurringDetailsResult>;
                                                                                 ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/recurring.d.ts:8:22 - error TS2503: Cannot find namespace 'IRecurring'.

8     disable(request: IRecurring.DisableRequest): Promise<IRecurring.DisableResult>;
                       ~~~~~~~~~~

node_modules/@adyen/api-library/dist/lib/src/services/recurring.d.ts:8:58 - error TS2503: Cannot find namespace 'IRecurring'.

8     disable(request: IRecurring.DisableRequest): Promise<IRecurring.DisableResult>;
                                                           ~~~~~~~~~~

server/payment/payment.service.ts:5:39 - error TS2306: File '/Users/alexandru.aldulea/workspace/frontend-post-login/node_modules/@adyen/api-library/dist/lib/src/typings/checkout.d.ts' is not a module.

5 import { PaymentMethodsRequest } from '@adyen/api-library/dist/lib/src/typings/checkout'
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: v12.13.0
  • NPM Version: 6.12.0

Additional context
tsconfig:

  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "esModuleInterop": true,
    "lib": [
      "es2019",
      "esnext.array"
    ]
  },
  "exclude": ["node_modules", "dist", "src"]
}

[FEATURE] Support for account, fund and hop services

Great to see this library existing and being actively developed. Especially happy for the typings support, thank you!

Describe the solution you'd like

In addition to the payment services, we also use Adyen MarketPay. Any timeline when MarketPay services support could be coming? I see the config supporting the credentials in the typings at least :)

From the MarketPay API endpoints we are using Account, Fund and Hop services.

[FEATURE] Why do I need to specify merchantAccount twice?

When making a /paymentMethods request using your NodeJS library I have to specify my merchantAccount twice. Once when specifying my Config object, and once in the request body. Why can't you just use the value I passed into the config? Whats the point of this value in the config object if it isn't being used?

I followed your example when writing my code (https://docs.adyen.com/checkout/drop-in-web).

I would like to only specify this value in one place.

[BUG] Could not call Terminal API LIVE

I guess you forget to set the LIVE Terminal API URL, you only do it for TEST

Describe the bug
Could not call Terminal API LIVE

To Reproduce
Activate LIVE

Expected behavior

Screenshots

Desktop (please complete the following information):

Additional context

[BUG] Terminal API print request returns Bad JSON if Text contains non-ascii

Describe the bug
The terminal API does not correctly serialize the JSON for sending a PrintRequest to the printer. Sending the example below throws ["Bad JSON:1: Unexpected character"]

To Reproduce

function printText() {
    let req = makeReq(MessageClassType.Device, MessageCategoryType.Print, poi2); //a helper function that generates a header

    req.saleToPOIRequest.printRequest = ObjectSerializer.deserialize({
        "PrintOutput": {
            "DocumentQualifier": "Document",
            "ResponseMode": "PrintEnd",
            "OutputContent": {
              "OutputFormat": "Text",
              "OutputText": [
                {
                  "CharacterStyle": "Bold",
                  "Alignment": "Centred",
                  "EndOfLineFlag": true,
                  "Text": "THIS IS THE TITLE"
                },
                {
                  "Alignment": "Centred",
                  "EndOfLineFlag": true,
                  "Text": ""
                },
                {
                  "Alignment": "Left",
                  "EndOfLineFlag": false,
                  "Text": "This is key-1"
                },
                {
                  "Alignment": "Right",
                  "EndOfLineFlag": true,
                  "Text": "value-1"
                },
                {
                  "Alignment": "Left",
                  "EndOfLineFlag": false,
                  "Text": "This is key-2"
                },
                {
                  "Alignment": "Right",
                  "EndOfLineFlag": true,
                  "Text": "value-2"
                },
                {
                  "Alignment": "Left",
                  "EndOfLineFlag": false,
                  "Text": "This is key-3"
                },
                {
                  "Alignment": "Right",
                  "EndOfLineFlag": true,
                  "Text": "value-3"
                },
                {
                  "Alignment": "Left",
                  "EndOfLineFlag": true,
                  "Text": "Some explanation about the receipt (# %^& @/: $ £ €)"
                },
                {
                  "Alignment": "Centred",
                  "EndOfLineFlag": true,
                  "Text": ""
                },
                {
                  "CharacterStyle": "Bold",
                  "Alignment": "Centred",
                  "EndOfLineFlag": true,
                  "Text": "This is the footer"
                }
              ]
            }
          }}
      , 'PrintRequest')
    return local2.request(req, key) //local2 is an instance of Local Terminal API
}

Here is the serialized JSON:

{"SaleToPOIRequest":{"MessageHeader":{"MessageCategory":"Print","MessageClass":"Device","MessageType":"Request","POIID":"V400m-346987962","ProtocolVersion":"3.0","SaleID":"ANZE-PC","ServiceID":"vgnk8hyOGq"},"PrintRequest":{"PrintOutput":{"DocumentQualifier":"Document","OutputContent":{"OutputFormat":"Text","OutputText":[{"Alignment":"Centred","CharacterStyle":"Bold","EndOfLineFlag":true,"Text":"THIS IS THE TITLE"},{"Alignment":"Centred","EndOfLineFlag":true,"Text":""},{"Alignment":"Left","EndOfLineFlag":false,"Text":"This is key-1"},{"Alignment":"Right","EndOfLineFlag":true,"Text":"value-1"},{"Alignment":"Left","EndOfLineFlag":false,"Text":"This is key-2"},{"Alignment":"Right","EndOfLineFlag":true,"Text":"value-2"},{"Alignment":"Left","EndOfLineFlag":false,"Text":"This is key-3"},{"Alignment":"Right","EndOfLineFlag":true,"Text":"value-3"},{"Alignment":"Left","EndOfLineFlag":true,"Text":"Some explanation about the receipt (# %^& @/: $ £ €)"},{"Alignment":"Centred","EndOfLineFlag":true,"Text":""},{"Alignment":"Centred","CharacterStyle":"Bold","EndOfLineFlag":true,"Text":"This is the 
footer"}]},"ResponseMode":"PrintEnd"}}}}

Expected behavior
Successful execution and printing of receipt

[FEATURE] Pre-authorisation without using TerminalAPI

We would like to perform pre-authorisation check on a specific amount for a payment method (storedPaymentMethodId in our case)

Describe the solution you'd like

An implementation of the authorise API (https://pal-test.adyen.com/pal/servlet/Payment/V52/authorise)

Describe alternatives you've considered

I have no idea how to perform this action (except calling API url). I maybe misread/misunderstood something. I had a look at the TerminalAPI that exposes a pre-authorisation flow but haven't got anything so far.

Additional context

  • "@adyen/api-library": "^3.1.3"

[BUG] Required field 'cvc' is not provided when users pay without CVC on stored card

Describe the bug
After 3.8.1 update of adyen-ios, drop in support hide the CVC field when users pay using stored card, users are able to pay when using new card but if the card is stored card, it will pop up the "Required field cvc is not provided" error

To Reproduce
Steps to reproduce the behavior

  1. enable hide cvc on Adyen drop in
  2. pay using stored card (no need to key in cvc as it's hidden)
  3. the "required field cvc is not provided" error will shown up

Expected behavior
customers should be able to pay using stored card without CVC as iOS drop in support hide cvc field

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04.4
  • Node Version: 12.18.0
  • NPM Version: 7.8.0

Additional context
users are able to pay if key in new card and pay, it only didn't work when pay using stored card

[BUG] Snakecase vs. Camelcase naming of NotificationRequestItem in API response

Describe the bug
In typings for Notification are NotificationRequestItem referred to as notificationRequestItem. Breaking the typings to be used.

To Reproduce
Test notification

{"live":"false","notificationItems":[{"NotificationRequestItem":{"additionalData":{"expiryDate":"12\/2012"," NAME1 ":"VALUE1","authCode":"1234","cardSummary":"7777","shopperIP":"127.0.0.1","totalFraudScore":"10","hmacSignature":"U371N1MoYzlBv\/tg1bzKVLOqcEMCg95FlVFj7guNMls=","NAME2":"  VALUE2  ","fraudCheck-6-ShopperIpUsage":"10"},"amount":{"currency":"EUR","value":10100},"eventCode":"AUTHORISATION","eventDate":"2019-10-28T13:34:09+01:00","merchantAccountCode":"VaesslaABSE","merchantReference":"8313842560770001","operations":["CANCEL","CAPTURE","REFUND"],"paymentMethod":"visa","pspReference":"test_AUTHORISATION_1","reason":"1234:7777:12\/2012","success":"true"}}]}

Expected behavior
Make typings refer to NotificationRequestItem as per sent in API.

Desktop (please complete the following information):

  • Node Version: 10.x.x

[BUG] Checkout interfaces are not aligned with received PaymentResponse

Describe the bug
When sending a POST request to /payments the PaymentResponse contains an action object that is not represented correctly by the union type of interfaces specified in code. The trimmed retrieved response looks the following:

{
  "resultCode": "IdentifyShopper",
  "action": {
    "paymentData": "Ab02b4c0!...",
    "paymentMethodType": "scheme",
    "token": "eyJ0aH...",
    **"type": "threeDS2Fingerprint"**
  },
  "authentication": {
    "threeds2.fingerprintToken": "eyJ0aH..."
  },
  "details": [
    {
      "key": "threeds2.fingerprint",
      "type": "text"
    }
  ],
  "paymentData": "Ab02b4c0!..."
}

Unfortunately, the type property is not specified in any of the relevant interfaces: CheckoutDonationAction | CheckoutQrCodeAction | CheckoutRedirectAction | CheckoutSDKAction | CheckoutThreeDS2ChallengeAction | CheckoutThreeDS2FingerPrintAction | CheckoutAwaitAction | CheckoutVoucherAction | CheckoutOneTimePasscodeAction.
This makes the type property not accessible without a cast enforcing this property.

To Reproduce

  • The actual response can be viewed here.
  • The defined shapes can be found here

Expected behavior
The provided types reflect the actual response.

Additional context
Also, the (documentation)[https://docs.adyen.com/checkout/3d-secure/native-3ds2/web-drop-in#make-a-payment] relies on the shape of the actual response.

[BUG] Invalid HMAC signature error when upgraded to the v4.0.0

Describe the bug
After upgrading from the v3.1.2 to the v4.0.0 when calling validateHMAC is returing false.

To Reproduce
Install de v4.0.0 of the library and try to validate an HMAC signature.

Expected behavior
When calling validateHMAC it should return false.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: 12.x
  • NPM Version: 6.13.4

Additional context
The HMAC validation works fine with the v3.1.2 of the library.

[BUG] Terminal SaleToAcquirerData needs to be Base64 encoded

Describe the bug
The saleToAcquirerData propery of saleData needs to be Base64 encoded into a string before being sent to the terminal

To Reproduce
create a payment request with the following saleData:

saleToAcquirerData: {
                tenderOption: 'MOTO'
            }

Expected behavior
Transaction proceeds

[BUG] Platforms ENDPOINT does not work

Description
There is a problem with the end point of platforms. Can't find any function

To Reproduce

...
const endPoints = require('@adyen/api-library')
export const platform = new endPoints.Platforms(client)
...
const response = await platform.createAccountHolder({
...req.body
})

Error: index_1.platform.createAccountHolder is not a function, error code: undefined
(node:43372) UnhandledPromiseRejectionWarning: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined
...
(Use node --trace-warnings ... to show where the warning was created)
(node:43372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:43372) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:43372) UnhandledPromiseRejectionWarning: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined
...

Expected behavior
The correct callback

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: v14.15.4
  • NPM Version: 6.14.10

[BUG] paymentsResponse property action not defined in typings

Describe the bug
Documentation for the 'drop-in' and 'components' iframe payments tools detail an actions object that can be available on the payments response, https://docs.adyen.com/checkout/drop-in-web#response.

The response from CheckoutApi payments request does (when applicable) contain this actions object but it is not defined in the type definitions for this object https://github.com/Adyen/adyen-node-api-library/blob/develop/src/typings/checkout/paymentResponse.ts.

To Reproduce
Make a call to the CheckoutAPI payments service

public payments(paymentsRequest: PaymentRequest, requestOptions?: RequestOptions): Promise<PaymentResponse> {
using a test card configured to return an action response (such as 3DS) e.g. 4212345678901237.

An actions object is present on the paymentsResponse object.

Expected behavior
action should be defined in the paymentResponse type definitions.

Additional context
This was mentioned in #130 but as a secondary issue so didn't seem to get addressed when the main issue of the ticket was resolved.

[BUG] Cannot use 'in' operator to search for 'applicationInfo' in undefined

Describe the bug
error when invoking basic adyen configuration

`
import {Client, Config, CheckoutAPI} from '@adyen/api-library';
const axios = require("axios");

class Adyen {

constructor() {
const config = new Config();

config.apiKey = '';
config.merchantAccount = 'TileFiveLLC731';

const client = new Client({ config });
client.setEnvironment("TEST");
this.client=client;

if (new.target === Adyen) {
  throw new TypeError('Cannot construct PaymentCardService instances directly');
}

}
}

export default Adyen;

`


TypeError: Cannot use 'in' operator to search for 'applicationInfo' in undefined
    at Object.setApplicationInfo [as default] (/Users/Shared/nodeWorkspace/approach-api-payments/node_modules/@adyen/api-library/src/helpers/setApplicationInfo.ts:25:49)
    at Checkout.payments (/Users/Shared/nodeWorkspace/approach-api-payments/node_modules/@adyen/api-library/src/services/checkout.ts:68:31)
    at Checkout.savetoken (webpack:///./api/_lib/common-orders/merchants/adyen/services/Checkout.js?:53:32)
    at AdyenPaymentCard.syncCardWithMerchant (webpack:///./api/_lib/common-orders/merchants/adyen/card.js?:68:34)
    at AdyenPaymentCard.save (webpack:///./api/_lib/common-orders/merchants/MerchantCardService.js?:67:45)
    at PaymentCardService.savePaymentCard (webpack:///./api/_lib/PaymentCard/index.js?:68:45)

To Reproduce
Steps to reproduce the behavior

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows, Mac, Linux]
  • Node Version: [e.g. 8.1.2]
  • NPM Version: [e.g. 6.7]

Additional context
Add any other context about the problem here.

[PW-2436] Invalid value undefined for type "" when eventCode is CAPTURE_FAILED

Describe the bug
When handling notifications I'm getting an error of Invalid value undefined for type "". This error only occurs when the eventCode is CAPTURE_FAILED.

To Reproduce
Send a CAPTURE_FAILED notification and then do
new NotificationRequest(JSON.parse(event.body))

Expected behavior
It should throw a Invalid value undefined for type "" error.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: 12.x
  • NPM Version: 6.13.4

"TypeError: Object.keys: argument is not an Object \ n at Go

** Describe the bug **
I am using the library https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js to encrypt the card number and
when I use Chrome it is working normally but in Internet explorer it presents an error. The system is in classic ASP and runs on Microsoft-IIS / 6.0

Reproduce
"TypeError: Object.keys: argument is not an Object \ n
at Go (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:306537)\n
at r (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:307068)\n
at x (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:53663)\n
at Anonymous function (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:3580)\n
at j (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:4346)\n
at j (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:4329)\n
at w (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:3320)\n
at x (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:7070)\n
at Anonymous function (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:3580)\n
at j (https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.5.0/adyen.js:4:4346) "

Expected behavior
my expectation is that the library will behave in the same way regardless of browse.

** Screenshots **
Working normally in Chrome
image

Occurs in Internet Explorer
image

** Desktop (fill in the following information): **

  • OS: Windows
  • Internet Explore 11 - v.11.0.9600.19596

** Additional context **
Add any other context about th

Changelog

Where I can view correct changelog? As example if I need upgrade from v2 to v3, where deprecation list?

[BUG] wrong case in NotificationItem.notificationRequestItem

Describe the bug
The class NotificationItem has the property notificationRequestItem but the actual payload from a JSON notification has NotificationRequestItem (first letter uppercase). In a Typescript project

To Reproduce

import { hmacValidator } from '@adyen/api-library';
import { Notification } from '@adyen/api-library/lib/src/typings/notification/notification';

const notification: Notification = JSON.parse(JSON_STRING_FROM_THE_BODY);
const notificationItem = notification.notificationItems[0]

const validator = new hmacValidator();
validator.validateHMAC(notificationItem.notificationRequestItem, HMAC)

This code will fail with TypeError: Cannot read property 'additionalData' of undefined. Changing the first letter to uppercase will result in the compiler complaining Property 'NotificationRequestItem' does not exist on type 'NotificationItem'. Did you mean 'notificationRequestItem'?. As a workaround, the array notation can be used:

notificationItem['NotificationRequestItem']

Expected behavior
The type Notification should reflect the API result

Desktop (please complete the following information):

  • OS: Linux
  • Node Version: 16.0.0
  • NPM Version: 7.11.22

[BUG] Unexpected undefined return value for a refund

Describe the bug
When performing a refund using modification API, call should return a promise as define in type:

refund(refundRequest: GenericRequest<IPayments.ModificationRequest>, requestOptions?: IRequest.Options): Promise<IPayments.ModificationResult>;

But I got a Promise resolved with undefined instead of an exception or a result.

TypeError: Cannot destructure property 'pspReference' of 'undefined' as it is undefined. 

To Reproduce

const modification = new Modification(client);

 const { response, pspReference } = await modification.refund({
    merchantAccount: "mymerchant",
    originalReference: "mytransaction",
    modificationAmount: {
      currency: "EUR",
      value: 324
    }
  });

Expected behavior
An exception to be raised or response to have an error value.

Desktop (please complete the following information):

  • Node Version: 15.1
  • NPM Version: 7.0.8
  • Adyen: 5.0.1 & 6.0.3

[BUG] Recurring: RecurringDetailsResult type mismatch

Describe the bug
The IRecurring.RecurringDetailsResult doesn't match the actual JSON structure returned by the API.

To Reproduce

import { Client, Recurring } from '@adyen/api-library'; // v3.1.1

(async () => {
	const recurring = new Recurring(
		new Client({
			apiKey: '****',
			environment: 'TEST',
		})
	);

	const request: IRecurring.RecurringDetailsRequest = {
		merchantAccount: '****',
		shopperReference: '****',
	};

	const result = await recurring.listRecurringDetails(request);

	if (result.details && result.details.length > 0) {
		const x = result.details[0].recurringDetailReference; // undefined
		const y = result.details[0].RecurringDetail.recurringDetailReference; // TS2339: Property 'RecurringDetail' does not exist on type 'RecurringDetail'
	}
})();

Expected behavior
In the example above, either

  • result.details[0].recurringDetailReference is defined, or
  • result.details[0].RecurringDetails doesn't yield a transpilation error.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: 12.13.1
  • NPM Version: 6.13.2

Additional context
The API response has an extra object in between IRecurring.RecurringDetailsResult['details'] and IRecurring.RecurringDetail, as you can see in the excerpt below extracted from the API Explorer:

{
  "creationDate": "2020-03-31T12:23:14+02:00",
  "details": [
    {
      "RecurringDetail": { // <= extra JSON object not included in the types
        "bank": {
          "bankName": "Wirecard",
          "countryCode": "DE",
          "iban": "*****",
          "ownerName": "*******"
        },
        // [...] omitted for brevity
      }
    }
  ],
  // [...] omitted for brevity
 }

Honestly, this extra RecurringDetails property looks like some issue related to XML to JSON transformation, and it probably should fixed in the API level instead.

[PW-4426] Support for Checkout API v67

Is your feature request related to a problem? Please describe.

Hi, there are many new Web component and 3D Secure 2 updates that requires Checkout API v67 for them to work. It's currently blocking our development, since we cannot use those if using this package. Any timeline when v67 would be supported by this library?

Thanks!

[BUG] Exporter enum types incorrect

Describe the bug
The enum types that are exported in notificationRequestItem.d.ts (and probably other files that I do not use yet) are not correct. They only provide a enum name without value. As you can see in the TypeScript enum docs (https://www.typescriptlang.org/docs/handbook/enums.html#numeric-enums), when declaring an enum without values, it will result in a number, while the Adyen API is returning strings.

To Reproduce
Install @adyen/api-library and open notificationRequestItem.d.ts.

Expected behavior
Those enums have a string value, representing the value that is sent from the Adyen API. I created some typings in my own project to get around this bug:

enum NotificationEventCode {
    AUTHORISATION = 'AUTHORISATION',
    CANCELLATION = 'CANCELLATION',
    CANCEL_OR_REFUND = 'CANCELORREFUND',
    REFUND = 'REFUND',
    REFUND_FAILED = 'REFUNDFAILED',
}

enum NotificationSuccess {
    True = 'true',
    False = 'false',
}

Screenshots

export declare namespace NotificationRequestItem {
    enum EventCodeEnum {
        AUTHORISATION,
        AUTHORISATIONADJUSTMENT,
        CANCELLATION,
        CANCELORREFUND,
        CAPTURE,
        CAPTUREFAILED,
        HANDLEDEXTERNALLY,
        ORDEROPENED,
        ORDERCLOSED,
        PENDING,
        PROCESSRETRY,
        REFUND,
        REFUNDFAILED,
        REFUNDEDREVERSED,
        REFUNDWITHDATA,
        REPORTAVAILABLE,
        VOIDPENDINGREFUND,
        CHARGEBACK,
        CHARGEBACKREVERSED,
        NOTIFICATIONOFCHARGEBACK,
        NOTIFICATIONOFFRAUD,
        PREARBITRATIONLOST,
        PREARBITRATIONWON,
        REQUESTFORINFORMATION,
        SECONDCHARGEBACK,
        PAYOUTEXPIRE,
        PAYOUTDECLINE,
        PAYOUTTHIRDPARTY,
        PAIDOUTREVERSED,
        AUTORESCUE,
        CANCELAUTORESCUE,
        RECURRINGCONTRACT,
        POSTPONEDREFUND,
        OFFERCLOSED,
        MANUALREVIEWACCEPT,
        MANUALREVIEWREJECT
    }
    enum OperationsEnum {
        CANCEL,
        CAPTURE,
        REFUND
    }
    enum SuccessEnum {
        True,
        False
    }
}

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: 12.16.3
  • NPM Version: 6.14.4

[BUG] NPM package doesn't expose services

The main entry in the NPM package doesn't expose services:
@adyen/api-library/dist/lib/src/index.js

The TypeScript Typings indicate, that the services are supposed to be available.

The module entry (@adyen/api-library/dist/lib-esm/src/index.js) looks fine.

To Reproduce

import { CheckoutAPI } from '@adyen/api-library';
console.log(CheckoutAPI); // Prints "undefined"

Expected behavior

All services should be exported via CommonJs on the root level.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: v12.3.1
  • NPM Version: 6.9.0

Additional context
This is my current workaround:

import CheckoutAPI from '@adyen/api-library/dist/lib/src/service/checkout';

RecurringDetailsResult is not aligned with the actual API response

Hello
The actuel v49/listRecurringDetails API response has the following shape

{
  "creationDate": "2020-04-03T09:55:03+02:00",
  "details": [
    {
      "RecurringDetail": {
        "alias": "A549761438794558",
        "aliasType": "Default"
        ...
      },
            "RecurringDetail": {
        "alias": "A549761438794558",
        "aliasType": "Default"
       .....
      }
    }
  ]
}

but the SDK, (we are using v6.0.3) has the following shape, and it is still the same in the develop branch

interface RecurringDetailsResult {
     /**
      * The date when the recurring details were created.
      */
     creationDate?: string;
     /**
      * Payment details stored for recurring payments.
      */
     details?: IRecurring.RecurringDetail[];
     /**
      * The most recent email for this shopper (if available).
      */
     lastKnownShopperEmail?: string;
     /**
      * The reference you use to uniquely identify the shopper (e.g. user ID or account ID).
      */
     shopperReference?: string;
 }

interface RecurringDetail {
     /**
      * This field contains additional data, which may be returned in a particular response.
      *
      * The additionalData object consists of entries, each of which includes the key and value.
      */
     additionalData?: {};
     /**
      * The alias of the credit card number.
      *
      * Applies only to recurring contracts storing credit card details
      */
     alias?: string;
     /**
      * The alias type of the credit card number.
      *
      * Applies only to recurring contracts storing credit card details.
      */
     aliasType?: string;
     /**
      * A container for bank account data.
      */
     bank?: IRecurring.BankAccount;
     /**
      * The billing address.
      */
     billingAddress?: IRecurring.Address;
     /**
      * A container for card data.
      */
     card?: IRecurring.Card;
     /**
      * Types of recurring contracts.
      */
     contractTypes?: string[];
     /**
      * The date when the recurring details were created.
      */
     creationDate?: string;
     /**
      * The `pspReference` of the first recurring payment that created the recurring detail.
      */
     firstPspReference?: string;
     /**
      * An optional descriptive name for this recurring detail.
      */
     name?: string;
     /**
      * The  type or sub-brand of a payment method used, e.g. Visa Debit, Visa Corporate, etc. For more information, refer to [PaymentMethodVariant](https://docs.adyen.com/development-resources/paymentmethodvariant).
      */
     paymentMethodVariant?: string;
     /**
      * The reference that uniquely identifies the recurring detail.
      */
     recurringDetailReference: string;
     /**
      * The name of the shopper.
      */
     shopperName?: IRecurring.Name;
     /**
      * A shopper's social security number (only in countries where it is legal to collect).
      */
     socialSecurityNumber?: string;
     /**
      * The payment method, such as “mc", "visa", "ideal", "paypal".
      */
     variant: string;
 }

There is a missing property RecurringDetail in the interface, and the API response is not mapped correctly.

Regards

[BUG] Unable to import validateHMAC() function

I am currently following this tutorial to verify notification callback return to backend after payment success

but unable to import validateHMAC function, even following exactly, seems like it never import "validator" in the code
image

I tried change to

const {hmacValidator} = require('@adyen/api-library');
hmacValidator.validateHMAC(notificationRequest, hmacKey)

but it still shows

TypeError: hmacValidator.validateHMAC is not a function

To Reproduce

const {hmacValidator} = require('@adyen/api-library');
validator.validateHMAC({}, '');

Expected behavior
Should be able to import hmacValidator and able to use validateHMAC function to validate the data

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows, Linux
  • Node Version: v8.11.3
  • NPM Version: 6.14.1

Additional context
if refer to code snippet in documentation page, this variable also undefined but it can be fixed by changing hmacValidator.validateHMAC(notificationRequestItem, hmacKey) to hmacValidator.validateHMAC(notificationRequest, hmacKey)
image

[BUG] PascaleCase in SaleToAcquirerData properties names

Describe the bug
Adding nonempty saleToAcquirerData object to terminal payment request results in failing with { "message": "Sale to Acquirer Data: NotAllowed Value: extra data, Reason: Failed validation" } in PaymentResponse.response.additionalResponse.

To Reproduce
add

saleToAcquirerData: {
  applicationInfo: {
    merchantApplication: {
       name: 'my_app',
       version: '0.0.1',
    },
  },
}

in saleToPOIRequest.paymentRequest.saleData

Expected behavior
Request should pass and payment should be saved with custom applicationInfo.

To fix
in SaleToAcquirerData.attributeTypeMap "baseName"s are in PascalCase while here https://docs.adyen.com/point-of-sale/add-data they are in camelCase. Changing it in locally made my requests pass.

[BUG] Bad example code of verifying HMAC signatures

Describe the bug
Example code doesn't work (Node.JS)
https://docs.adyen.com/development-resources/webhooks/verify-hmac-signatures#hmac_validation

To Reproduce
Run example code.

Expected behavior
It works.

Fix

  | const { hmacValidator } = require('@adyen/api-library');
-- | --
  | const hmacKey = "YOUR_HMAC_KEY";
  | // YOUR_HMAC_KEY from the Customer Area
  | const validator = new hmacValidator()
  | const notificationRequest = NOTIFICATION_REQUEST_JSON; // Notification Request JSON
  | const notificationRequestItems = notificationRequest.notificationItems
  | notificationRequestItems.forEach(function(notificationRequest /*<== notificationRequestItem */) {
  | if( validator.validateHMAC(notificationRequestItem /*<== should add .NotificationRequestItem */, hmacKey) ) {
  | const eventCode = notificationRequestItem.eventCode;
  | // Process the notification based on the eventCode
  | } else {
  | // Non valid NotificationRequest
  | console.log("Non valid NotificationRequest");
  | }
  | });

Support for rollup.js / import

I am right now testing the drop-in solution of Adyen with my Svelte/Sapper client using rollup.js as bundler. The require() statement is not supported in this environment, just modern import statement.

So I tried something like: import {Client, Config, CheckoutAPI} from '@adyen/api-library' but got these errors when building the project:

Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
1: {
2: "name": "@adyen/api-library",
^
3: "version": "3.1.1",
4: "description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.",

Installing @rollup/plugin-json does not solve it, seems not being used anyhow. So I am not sure here what to do?

[BUG] When Local Terminal API Security Key Version is 0, validateSecurityKey throws exception

Describe the bug
When using the Local Terminal API and decrypting the received payload, if the keyVersion is set to 0 the key validation throws InvalidSecurityKeyException since it evaluates the 0 as false.

To Reproduce
Try to send a request to local terminal API with the following security key:

{
    "passphrase": "mysupersecretpassphrase",
    "keyIdentifier": "mykey",
    "keyVersion": 0,
    "adyenCryptoVersion": 1
}

Expected behavior
The feature works, it should instead check if the property is not null.

Desktop (please complete the following information):

  • OS: Windows 10
  • Node Version: v144.0
  • NPM Version: 6.14.4

[BUG] Notification Param that Should Be Optional?

Describe the bug
Convert.toNotification requires a paymentMethod field for all notifications, but Adyen does not send that field for Auto Rescue notifications thus causing an error.

To Reproduce
Send an auto rescue webhook notification and convert the notification using the library's Convert.toNotification

Expected behavior
Invalid value undefined for type "" error is thrown

Additional context
Example of Adyen's webhook notification for auto rescues we have received

  "live": "false",
  "notificationItems": [
    {
      "NotificationRequestItem": {
        "additionalData": {
          "hmacSignature": "asdfasdfasldfjaslkdfjlasjdkfjls;adjfjaskl;dfjlasjdflkas;",
          "merchantOrderReference": "asdfasdfasdfasdfasdfsadfsadf",
          "retry.rescueReference": "123876546890012"
        },
        "eventCode": "AUTORESCUE",
        "merchantReference": "asdfasdfasdfasdfasdfsadfsadf",
        "merchantAccountCode": "MerchantAccountName",
        "reason": "",
        "amount": {
          "currency": "EUR",
          "value": 0
        },
        "originalReference": "1234567890710101",
        "success": "true",
        "pspReference": "12345678901233",
        "eventDate": "2020-03-27T20:31:23+01:00"
      }
    }

Adyen's notification required typings
https://github.com/Adyen/adyen-node-api-library/blob/develop/src/typings/notification.ts#L49

@adyen/api-library :- httpURLConnectionClient.js:84 Uncaught (in promise) TypeError: url_1.URL is not a constructor

Describe the bug
image

URL Undefined
image

image

To Reproduce

Unablet o make call getting URL constructor error
const promise = this.checkout.paymentMethods({ merchantAccount: config.merchantAccount })
console.log(promise);

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • Windows
  • Node Version: 13.14.0
  • NPM Version: 6.14.4
  • Angualr ^9.1.12 and ^10.0.0
  • @adyen/api-library: ^7.0.0 / 6 ,

Additional context

[BUG] The BarcodeValue field name is Value

This should be updated to BarcodeValue, otherwise the terminal sends:

    "printResponse": {
      "response": {
        "additionalResponse": "errors=At%20SaleToPOIRequest.PrintRequest.PrintOutput.OutputContent.OutputBarcode.BarcodeType%3a%20Invalid%20value%0aAt%20SaleToPOIRequest.PrintRequest.PrintOutput.OutputContent.OutputBarcode%2c%20field%20BarcodeValue%3a%20Missing&warnings=At%20SaleToPOIRequest.PrintRequest.PrintOutput.OutputContent.OutputBarcode%2c%20field%20Value%3a%20Unexpected",
        "errorCondition": "MessageFormat",
        "result": "Failure"
      }
    }

[FEATURE] Remove requirement for an API key if using only Local Terminal API

Is your feature request related to a problem? Please describe.
I keep having to put in fake API keys into the config class when using the Local Terminal API even though they are not needed. Could the API key change into being optional? Same for merchant account, environment and checkout endpoint.

Describe the solution you'd like
Either isolate the Local Terminal API or make all options in the Config class optional.

Describe alternatives you've considered
This is my current code:

const config = new Config();
config.apiKey = 'AAAAA';
config.merchantAccount = 'MerchantsPOS';
config.environment = 'TEST';
config.checkoutEndpoint = 'https://checkout-test.adyen.com/checkout/V52';
config.certificatePath = './adyen-terminalfleet-test.pem';
let config1 = new Config(config);
config1.terminalApiLocalEndpoint = 'https://10.20.42.29';
let config2 = new Config(config);
config2.terminalApiLocalEndpoint = 'https://10.20.42.25';
const client = new Client({
    config: config1
});
const client2 = new Client({
    config: config2
});
const local = new TerminalLocalAPI(client);
const local2 = new TerminalLocalAPI(client2);

Code in dist/es5/vendors~main.js is not valid ECMAScript 5

Describe the bug

The NPM module you release contains invalid ECMAScript 5 code in the dist/es5/vendors~main.js bundle.

One or more of your dependencies is not distributed as ES5, and since Webpack will not transpile them unless you specifically instruct the TypeScript loader to include it, it's propagated without modification.

To Reproduce

Steps to reproduce the behavior:

  1. Install the module with npm install --save @adyen/api-library (or build the project).
  2. Inspect the file node_modules/@adyen/api-library/dist/es5/vendors~main.js.
  3. You'll see there instances of arrow functions and spread operators.

Expected behavior

The file should contain only ES5 language features as the es5 directory it's in leads users of the library to expect.

[BUG] authStringEnc not encoded when authenticating with username and password

Describe the bug
When I try to authenticate using username and password

const config = new Config({
    username: auth.username,
    password: auth.password,
  });

they are placed in the Authorization HTTP header as plain text https://github.com/Adyen/adyen-node-api-library/blob/develop/src/httpClient/httpURLConnectionClient.ts#L65
causing Adyen api to return error HTTP Exception: 401. Unauthorized

To Reproduce
Authenticate using username and password

Expected behavior
Request should contain encoded Authorization

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Node Version: v8.9.1
  • NPM Version: v5.5.1

Additional context
I changed the line passing the encoding base64

const authStringEnc = authEncBytes.toString();

and it worked.

[PW-2466] SaleToAquirerData not being encoded causing MessageFormat errors

Hi there,

we seem to have an issue with the encoding of the cloud terminal request send by the library.
I described it here below. Thanks for having a look.

Issue:
Using Adyen API Library for Node 3.2.3 to send cloud terminal api requests. If you don't include Application info, Application info is being appended to the payment requests in the SaleToAquirerData object. However, only the info in ApplicationInfo is being encoded to base64, instead of the whole SaleToAquirerData object. This is causing a messageFormat error.

What is the expected result?
Have the SaleToAquirerData object to be a Base64-encoded string

What happens instead?
only info in ApplicationInfo is encoded, causing a MessageFormat error of "Expected JSON string"

Please provide any additional information below.

Request:
{ "SaleToPOIRequest" : { "MessageHeader" : { "MessageCategory" : "Payment", "MessageClass" : "Service", "MessageType" : "Request", "POIID" : "V400cPlus-401840085", "SaleID" : "6dc37f53-21de-43f5-9ab0-f06c45289b1a", "ServiceID" : "54DD7CE906" }, "PaymentRequest" : { "PaymentTransaction" : { "AmountsReq" : { "Currency" : "EUR", "RequestedAmount" : 40 } }, "SaleData" : { "SaleToAcquirerData" : { "ApplicationInfo" : "eyJhZHllbkxpYnJhcnkiOnsibmFtZSI6ImFkeWVuLW5vZGUtYXBpLWxpYnJhcnkiLCJ2ZXJzaW9uIjoiMy4yLjMifX0=" }, "SaleTransactionID" : { "TimeStamp" : "2020-05-25T14:43:15+02:00", "TransactionID" : "TEST0000000000200000000095T" } } } } }

Response:

{ "SaleToPOIResponse" : { "PaymentResponse" : { "POIData" : { "POITransactionID" : { "TimeStamp" : "2020-05-25T12:43:18.081Z", "TransactionID" : "7ign001590410598042" } }, "SaleData" : { "SaleTransactionID" : { "TimeStamp" : "2020-05-25T12:43:15.000Z", "TransactionID" : "TEST0000000000200000000095T" } }, "Response" : { "Result" : "Failure", "AdditionalResponse" : "errors=At%20SaleToPOIRequest.PaymentRequest.SaleData.SaleToAcquirerData%3a%20Expected%20JSON%20string", "ErrorCondition" : "MessageFormat" } }, "MessageHeader" : { "ProtocolVersion" : "3.0", "SaleID" : "6dc37f53-21de-43f5-9ab0-f06c45289b1a", "MessageClass" : "Service", "MessageCategory" : "Payment", "ServiceID" : "54DD7CE906", "POIID" : "V400cPlus-401840085", "MessageType" : "Response" } } }

[BUG] Missing response definition in ModificationResult

Describe the bug
Currently the ModificationResult type has no allowed response value to support adjustAuthorisation ('adjustAuthorisation-received').

To Reproduce
Perform an adjust authorisation using the SDK.

Expected behavior
The type has 'adjustAuthorisation-received' as an allowed response value.

[BUG] The `confirmThirdParty` resource is calling the wrong endpoint `declineThirdParty`

Describe the bug
The confirmThirdParty resource is calling the wrong endpoint declineThirdParty

`${service.client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}/declineThirdParty`

I opened a PR #38

To Reproduce
Call the confirmThirdParty

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows, Mac, Linux]
  • Node Version: [e.g. 8.1.2]
  • NPM Version: [e.g. 6.7]

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.