diff --git a/src/__mocks__/clouddevice/connected-devices.json b/src/__mocks__/clouddevice/connected-devices.json new file mode 100644 index 000000000..1b46d7c29 --- /dev/null +++ b/src/__mocks__/clouddevice/connected-devices.json @@ -0,0 +1,6 @@ +{ + "uniqueDeviceIds": [ + "P400Plus-123456789", + "V400m-123456789" + ] +} \ No newline at end of file diff --git a/src/__mocks__/clouddevice/payment-async-error.json b/src/__mocks__/clouddevice/payment-async-error.json new file mode 100644 index 000000000..d1b92d279 --- /dev/null +++ b/src/__mocks__/clouddevice/payment-async-error.json @@ -0,0 +1,20 @@ +{ + "SaleToPOIRequest": { + "EventNotification": { + "EventToNotify": "Reject", + "EventDetails": "message=Did+not+receive+a+response+from+the+POI.", + "RejectedMessage": "ewoi...0KfQo=", + "TimeStamp": "2020-03-31T10:28:39.515Z" + }, + "MessageHeader": { + "DeviceID": "666568147", + "MessageCategory": "Event", + "MessageClass": "Event", + "MessageType": "Notification", + "POIID": "P400Plus-123456789", + "ProtocolVersion": "3.0", + "SaleID": "saleid-4c32759faaa7", + "ServiceID": "31122609" + } + } +} \ No newline at end of file diff --git a/src/__mocks__/clouddevice/payment-sync-success.json b/src/__mocks__/clouddevice/payment-sync-success.json new file mode 100644 index 000000000..637405767 --- /dev/null +++ b/src/__mocks__/clouddevice/payment-sync-success.json @@ -0,0 +1,330 @@ +{ + "SaleToPOIResponse": { + "PaymentResponse": { + "POIData": { + "POITransactionID": { + "TimeStamp": "2019-04-29T00:00:00.000Z", + "TransactionID": "4r7i001556529591000.8515565295894301" + }, + "POIReconciliationID": "1000" + }, + "SaleData": { + "SaleTransactionID": { + "TimeStamp": "2019-04-29T00:00:00.000Z", + "TransactionID": "001" + } + }, + "PaymentReceipt": [ + { + "RequiredSignatureFlag": false, + "DocumentQualifier": "CashierReceipt", + "OutputContent": { + "OutputFormat": "Text", + "OutputText": [ + { + "CharacterStyle": "Bold", + "Text": "key=header1", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "key=header2", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=MERCHANT%20COPY&key=merchantTitle", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Date&value=29%2f04%2f19&key=txdate", + "EndOfLineFlag": true + }, + { + "Text": "name=Time&value=10%3a19%3a51&key=txtime", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Card&value=%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a3511&key=pan", + "EndOfLineFlag": true + }, + { + "Text": "name=Pref.%20name&value=MCC%20351%20v1%202&key=preferredName", + "EndOfLineFlag": true + }, + { + "Text": "name=Card%20type&value=mc&key=cardType", + "EndOfLineFlag": true + }, + { + "Text": "name=Payment%20method&value=mc&key=paymentMethod", + "EndOfLineFlag": true + }, + { + "Text": "name=Payment%20variant&value=mc&key=paymentMethodVariant", + "EndOfLineFlag": true + }, + { + "Text": "name=Entry%20mode&value=Contactless%20swipe&key=posEntryMode", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=AID&value=A0000000041010&key=aid", + "EndOfLineFlag": true + }, + { + "Text": "name=MID&value=1000&key=mid", + "EndOfLineFlag": true + }, + { + "Text": "name=TID&value=P400Plus-275039202&key=tid", + "EndOfLineFlag": true + }, + { + "Text": "name=PTID&value=75039202&key=ptid", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Auth.%20code&value=123456&key=authCode", + "EndOfLineFlag": true + }, + { + "Text": "name=Tender&value=4r7i001556529591000&key=txRef", + "EndOfLineFlag": true + }, + { + "Text": "name=Reference&value=003&key=mref", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Type&value=GOODS_SERVICES&key=txtype", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=TOTAL&value=%e2%82%ac%c2%a01.00&key=totalAmount", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=APPROVED&key=approved", + "EndOfLineFlag": true + } + ] + } + }, + { + "RequiredSignatureFlag": false, + "DocumentQualifier": "CustomerReceipt", + "OutputContent": { + "OutputFormat": "Text", + "OutputText": [ + { + "CharacterStyle": "Bold", + "Text": "key=header1", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "key=header2", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=CARDHOLDER%20COPY&key=cardholderHeader", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Date&value=29%2f04%2f19&key=txdate", + "EndOfLineFlag": true + }, + { + "Text": "name=Time&value=10%3a19%3a51&key=txtime", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Card&value=%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a3511&key=pan", + "EndOfLineFlag": true + }, + { + "Text": "name=Pref.%20name&value=MCC%20351%20v1%202&key=preferredName", + "EndOfLineFlag": true + }, + { + "Text": "name=Card%20type&value=mc&key=cardType", + "EndOfLineFlag": true + }, + { + "Text": "name=Payment%20method&value=mc&key=paymentMethod", + "EndOfLineFlag": true + }, + { + "Text": "name=Payment%20variant&value=mc&key=paymentMethodVariant", + "EndOfLineFlag": true + }, + { + "Text": "name=Entry%20mode&value=Contactless%20swipe&key=posEntryMode", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=AID&value=A0000000041010&key=aid", + "EndOfLineFlag": true + }, + { + "Text": "name=MID&value=1000&key=mid", + "EndOfLineFlag": true + }, + { + "Text": "name=TID&value=P400Plus-275039202&key=tid", + "EndOfLineFlag": true + }, + { + "Text": "name=PTID&value=75039202&key=ptid", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Auth.%20code&value=123456&key=authCode", + "EndOfLineFlag": true + }, + { + "Text": "name=Tender&value=4r7i001556529591000&key=txRef", + "EndOfLineFlag": true + }, + { + "Text": "name=Reference&value=003&key=mref", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Type&value=GOODS_SERVICES&key=txtype", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=TOTAL&value=%e2%82%ac%c2%a01.00&key=totalAmount", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "CharacterStyle": "Bold", + "Text": "name=APPROVED&key=approved", + "EndOfLineFlag": true + }, + { + "Text": "key=filler", + "EndOfLineFlag": true + }, + { + "Text": "name=Please%20retain%20for%20your%20records&key=retain", + "EndOfLineFlag": true + }, + { + "Text": "name=Thank%20you&key=thanks", + "EndOfLineFlag": true + } + ] + } + } + ], + "PaymentResult": { + "OnlineFlag": true, + "PaymentAcquirerData": { + "AcquirerPOIID": "P400Plus-123456789", + "ApprovalCode": "123456", + "AcquirerTransactionID": { + "TimeStamp": "2019-04-29T09:19:51.000Z", + "TransactionID": "8515565295894301" + }, + "MerchantID": "TestMerchant" + }, + "CurrencyConversion": [ + { + "ConvertedAmount": { + "AmountValue": 48.32, + "Currency": "EUR" + }, + "CustomerApprovedFlag": true, + "Markup": 3, + "Rate": 0.035 + } + ], + "PaymentInstrumentData": { + "CardData": { + "EntryMode": [ + "Tapped" + ], + "PaymentBrand": "mc", + "MaskedPan": "411111 **** 1111", + "SensitiveCardData": { + "ExpiryDate": "1225" + } + }, + "PaymentInstrumentType": "Card" + }, + "AmountsResp": { + "AuthorizedAmount": 1, + "Currency": "EUR" + } + }, + "Response": { + "Result": "Success", + "AdditionalResponse": "tid=75039202&AID=A0000000041010&transactionType=GOODS_SERVICES&backendGiftcardIndicator=false&expiryYear=2025&acquirerAccountCode=TestPmmAcquirerAccount&alias=M900978995070104&posOriginalAmountCurrency=EUR&giftcardIndicator=false&authorisedAmountValue=100&pspReference=8515565295894301&paymentMethodVariant=mc&cardHolderName=N%2fA&refusalReasonRaw=APPROVED&authorisationMid=1000&expiryDate=12%2f2025&applicationPreferredName=MCC%20351%20v1%202&acquirerCode=TestPmmAcquirer&txtime=10%3a19%3a51&iso8601TxDate=2019-04-29T09%3a19%3a51.0000000%2b0000&cardType=mc&posOriginalAmountValue=100&offline=false&aliasType=Default&txdate=29-04-2019&paymentMethod=mc&cvcResult=0%20Unknown&avsResult=0%20Unknown&mid=1000&merchantReference=003&transactionReferenceNumber=8515565295894301&expiryMonth=12&cardSummary=3511&posTotalAmountValue=100&posAuthAmountCurrency=EUR&cardHolderVerificationMethodResults=3F0300&authCode=123456&shopperCountry=NL&posEntryMode=CLESS_SWIPE&cardScheme=mc&cardBin=541333&posAuthAmountValue=100" + } + }, + "MessageHeader": { + "ProtocolVersion": "3.0", + "SaleID": "001", + "MessageClass": "Service", + "MessageCategory": "Payment", + "ServiceID": "1234567890", + "POIID": "P400Plus-123456789", + "MessageType": "Response" + } + } +} diff --git a/src/__mocks__/clouddevice/status-device.json b/src/__mocks__/clouddevice/status-device.json new file mode 100644 index 000000000..fc23716f2 --- /dev/null +++ b/src/__mocks__/clouddevice/status-device.json @@ -0,0 +1,4 @@ +{ + "deviceId": "AMS1-000168242800763", + "status": "ONLINE" +} \ No newline at end of file diff --git a/src/__tests__/cloudDeviceApi.spec.ts b/src/__tests__/cloudDeviceApi.spec.ts new file mode 100644 index 000000000..8c1fbebe1 --- /dev/null +++ b/src/__tests__/cloudDeviceApi.spec.ts @@ -0,0 +1,170 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import nock from "nock"; +import { createClient } from "../__mocks__/base"; +import Client from "../client"; +import { CloudDeviceAPI } from "../services"; +import { CloudDeviceApiRequest } from "../typings/clouddevice/models"; +import { DeviceStatus } from "../typings/clouddevice/models"; +import { + MessageCategory, + MessageClass, + MessageType, + SaleToPOIRequest, +} from "../typings/tapi/models"; + +import paymentSyncSuccess from "../__mocks__/clouddevice/payment-sync-success.json"; +import paymentAsyncError from "../__mocks__/clouddevice/payment-async-error.json"; +import connectedDevices from "../__mocks__/clouddevice/connected-devices.json"; +import statusDevice from "../__mocks__/clouddevice/status-device.json"; + +const BASE_URL = "https://device-api-test.adyen.com/v1"; +const merchantAccount = "myMerchant"; +const deviceId = "P400Plus-123456789"; + +function createCloudDeviceApiPaymentRequest(): CloudDeviceApiRequest { + const saleToPOIRequest: SaleToPOIRequest = { + MessageHeader: { + ProtocolVersion: "3.0", + MessageClass: MessageClass.Service, + MessageCategory: MessageCategory.Payment, + MessageType: MessageType.Request, + SaleID: "001", + ServiceID: "001", + POIID: deviceId, + }, + PaymentRequest: { + SaleData: { + SaleTransactionID: { + TransactionID: "001", + TimeStamp: new Date(), + }, + }, + PaymentTransaction: { + AmountsReq: { + Currency: "EUR", + RequestedAmount: 1, + }, + }, + }, + }; + return { SaleToPOIRequest: saleToPOIRequest }; +} + +let client: Client; +let cloudDeviceAPI: CloudDeviceAPI; +let scope: nock.Scope; + +beforeEach((): void => { + if (!nock.isActive()) { + nock.activate(); + } + client = createClient(); + cloudDeviceAPI = new CloudDeviceAPI(client); + scope = nock(BASE_URL); +}); + +afterEach(() => { + nock.cleanAll(); +}); + +describe("CloudDeviceApi", (): void => { + test("should send a sync payment request", async (): Promise => { + scope + .post(`/merchants/${merchantAccount}/devices/${deviceId}/sync`) + .reply(200, paymentSyncSuccess); + + const request = createCloudDeviceApiPaymentRequest(); + const response = await cloudDeviceAPI.CloudDeviceApi.sync(merchantAccount, deviceId, request); + + expect(response).toBeDefined(); + expect(response.SaleToPOIResponse).toBeDefined(); + expect(response.SaleToPOIResponse?.MessageHeader).toBeDefined(); + expect(response.SaleToPOIResponse?.MessageHeader?.POIID).toBe(deviceId); + }); + + test("should send an async payment request and get ok result", async (): Promise => { + scope + .post(`/merchants/${merchantAccount}/devices/${deviceId}/async`) + .reply(200, "ok"); + + const request = createCloudDeviceApiPaymentRequest(); + const response = await cloudDeviceAPI.CloudDeviceApi.async(merchantAccount, deviceId, request); + + expect(response).toBeDefined(); + expect(response.Result).toBe("ok"); + expect(response.SaleToPOIRequest).toBeUndefined(); + }); + + test("should handle async error response with EventNotification", async (): Promise => { + scope + .post(`/merchants/${merchantAccount}/devices/${deviceId}/async`) + .reply(200, paymentAsyncError); + + const request = createCloudDeviceApiPaymentRequest(); + const response = await cloudDeviceAPI.CloudDeviceApi.async(merchantAccount, deviceId, request); + + expect(response).toBeDefined(); + expect(response.Result).toBeUndefined(); + expect(response.SaleToPOIRequest).toBeDefined(); + expect(response.SaleToPOIRequest?.EventNotification?.EventToNotify).toBe("Reject"); + }); + + test("should get connected devices", async (): Promise => { + scope + .get(`/merchants/${merchantAccount}/connectedDevices`) + .reply(200, connectedDevices); + + const response = await cloudDeviceAPI.CloudDeviceApi.getConnectedDevices(merchantAccount); + + expect(response).toBeDefined(); + expect(response.uniqueDeviceIds).toHaveLength(2); + expect(response.uniqueDeviceIds?.[0]).toBe("P400Plus-123456789"); + expect(response.uniqueDeviceIds?.[1]).toBe("V400m-123456789"); + }); + + test("should get connected devices with store query param", async (): Promise => { + const store = "myStore"; + scope + .get(`/merchants/${merchantAccount}/connectedDevices`) + .query({ store }) + .reply(200, connectedDevices); + + const response = await cloudDeviceAPI.CloudDeviceApi.getConnectedDevices(merchantAccount, store); + + expect(response).toBeDefined(); + expect(response.uniqueDeviceIds).toHaveLength(2); + expect(response.uniqueDeviceIds?.[0]).toBe("P400Plus-123456789"); + expect(response.uniqueDeviceIds?.[1]).toBe("V400m-123456789"); + }); + + test("should get device status", async (): Promise => { + const statusDeviceId = "AMS1-000168242800763"; + scope + .get(`/merchants/${merchantAccount}/devices/${statusDeviceId}/status`) + .reply(200, statusDevice); + + const response = await cloudDeviceAPI.CloudDeviceApi.getDeviceStatus(merchantAccount, statusDeviceId); + + expect(response).toBeDefined(); + expect(response.deviceId).toBe(statusDeviceId); + expect(response.status).toBe(DeviceStatus.Online); + }); +}); diff --git a/src/services/clouddevice/cloudDeviceApi.ts b/src/services/clouddevice/cloudDeviceApi.ts new file mode 100644 index 000000000..b94a622ab --- /dev/null +++ b/src/services/clouddevice/cloudDeviceApi.ts @@ -0,0 +1,140 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import getJsonResponse from "../../helpers/getJsonResponse"; +import Service from "../../service"; +import Client from "../../client"; +import { IRequest } from "../../typings/requestOptions"; +import Resource from "../resource"; +import { CloudDeviceApiAsyncResponse } from "../../typings/clouddevice/models"; +import { CloudDeviceApiRequest } from "../../typings/clouddevice/models"; +import { CloudDeviceApiResponse } from "../../typings/clouddevice/models"; +import { ConnectedDevicesResponse } from "../../typings/clouddevice/models"; +import { DeviceStatusResponse } from "../../typings/clouddevice/models"; + +/** + * API handler for CloudDeviceApi + */ +export class CloudDeviceApi extends Service { + + private readonly API_BASEPATH: string = "https://device-api-test.adyen.com/v1"; + private baseUrl: string; + + public constructor(client: Client) { + super(client); + this.baseUrl = this.createBaseUrl(this.API_BASEPATH); + } + + /** + * @summary Send a Terminal API request and receive a synchronous response + * @param merchantAccount {@link string } The unique identifier of the merchant account. (required) + * @param deviceId {@link string } The unique identifier of the payment device. Must match POIID in the MessageHeader. (required) + * @param cloudDeviceApiRequest {@link CloudDeviceApiRequest } + * @param requestOptions {@link IRequest.Options } + * @return {@link CloudDeviceApiResponse } + */ + public async sync(merchantAccount: string, deviceId: string, cloudDeviceApiRequest: CloudDeviceApiRequest, requestOptions?: IRequest.Options): Promise { + const endpoint = `${this.baseUrl}/merchants/{merchantAccount}/devices/{deviceId}/sync` + .replace("{" + "merchantAccount" + "}", encodeURIComponent(String(merchantAccount))) + .replace("{" + "deviceId" + "}", encodeURIComponent(String(deviceId))); + const resource = new Resource(this, endpoint); + const response = await getJsonResponse( + resource, + cloudDeviceApiRequest, + { ...requestOptions, method: "POST" } + ); + return response; + } + + /** + * @summary Send a Terminal API request and receive an asynchronous response + * @param merchantAccount {@link string } The unique identifier of the merchant account. (required) + * @param deviceId {@link string } The unique identifier of the payment device. Must match POIID in the MessageHeader. (required) + * @param cloudDeviceApiRequest {@link CloudDeviceApiRequest } + * @param requestOptions {@link IRequest.Options } + * @return {@link CloudDeviceApiAsyncResponse } + */ + public async async(merchantAccount: string, deviceId: string, cloudDeviceApiRequest: CloudDeviceApiRequest, requestOptions?: IRequest.Options): Promise { + const endpoint = `${this.baseUrl}/merchants/{merchantAccount}/devices/{deviceId}/async` + .replace("{" + "merchantAccount" + "}", encodeURIComponent(String(merchantAccount))) + .replace("{" + "deviceId" + "}", encodeURIComponent(String(deviceId))); + const resource = new Resource(this, endpoint); + const response = await getJsonResponse( + resource, + cloudDeviceApiRequest, + { ...requestOptions, method: "POST" } + ); + const result = new CloudDeviceApiAsyncResponse(); + if (typeof response === "string" && response.toLowerCase().trim() === "ok") { + // successful response + result.Result = response.trim(); + } else { + // error returned by the terminal + const parsed = response as unknown as CloudDeviceApiAsyncResponse; + result.SaleToPOIRequest = parsed.SaleToPOIRequest; + } + return result; + } + + /** + * @summary Get a list of connected devices + * @param merchantAccount {@link string } The unique identifier of the merchant account. (required) + * @param store {@link string } The store ID of the store belonging to the merchant account specified in the path. (optional) + * @param requestOptions {@link IRequest.Options } + * @return {@link ConnectedDevicesResponse } + */ + public async getConnectedDevices(merchantAccount: string, store?: string, requestOptions?: IRequest.Options): Promise { + const endpoint = `${this.baseUrl}/merchants/{merchantAccount}/connectedDevices` + .replace("{" + "merchantAccount" + "}", encodeURIComponent(String(merchantAccount))); + const resource = new Resource(this, endpoint); + const hasDefinedQueryParams = store; + if (hasDefinedQueryParams) { + if (!requestOptions) requestOptions = {}; + if (!requestOptions.params) requestOptions.params = {}; + if (store) (requestOptions.params as Record)["store"] = store; + } + const response = await getJsonResponse( + resource, + "", + { ...requestOptions, method: "GET" } + ); + return response; + } + + /** + * @summary Get the connection status of a device + * @param merchantAccount {@link string } The unique identifier of the merchant account. (required) + * @param deviceId {@link string } The unique identifier of the device. (required) + * @param requestOptions {@link IRequest.Options } + * @return {@link DeviceStatusResponse } + */ + public async getDeviceStatus(merchantAccount: string, deviceId: string, requestOptions?: IRequest.Options): Promise { + const endpoint = `${this.baseUrl}/merchants/{merchantAccount}/devices/{deviceId}/status` + .replace("{" + "merchantAccount" + "}", encodeURIComponent(String(merchantAccount))) + .replace("{" + "deviceId" + "}", encodeURIComponent(String(deviceId))); + const resource = new Resource(this, endpoint); + const response = await getJsonResponse( + resource, + "", + { ...requestOptions, method: "GET" } + ); + return response; + } + +} diff --git a/src/services/clouddevice/index.ts b/src/services/clouddevice/index.ts new file mode 100644 index 000000000..a09730c6d --- /dev/null +++ b/src/services/clouddevice/index.ts @@ -0,0 +1,34 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import { CloudDeviceApi } from "./cloudDeviceApi"; + +import Service from "../../service"; +import Client from "../../client"; + +export default class CloudDeviceAPI extends Service { + + public constructor(client: Client) { + super(client); + } + + public get CloudDeviceApi() { + return new CloudDeviceApi(this.client); + } +} diff --git a/src/services/index.ts b/src/services/index.ts index e1222379f..a62d4c25f 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -2,6 +2,7 @@ // this file is not autogenerated (add/remove services manually) export { default as BalanceControlAPI } from "./balanceControl"; +export { default as CloudDeviceAPI } from "./clouddevice"; export { default as BalancePlatformAPI } from "./balancePlatform"; export { default as CapitalAPI } from "./capital"; export { default as BinLookupAPI } from "./binLookup"; diff --git a/src/typings/clouddevice/cloudDeviceApiAsyncResponse.ts b/src/typings/clouddevice/cloudDeviceApiAsyncResponse.ts new file mode 100644 index 000000000..c4b444a48 --- /dev/null +++ b/src/typings/clouddevice/cloudDeviceApiAsyncResponse.ts @@ -0,0 +1,54 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import { SaleToPOIRequest } from "../tapi/saleToPOIRequest"; + +/** + * Response of the /async endpoint. When successful the `Result` contains `ok`. + * In case of failure the `SaleToPOIRequest` contains the EventNotification details. + */ +export class CloudDeviceApiAsyncResponse { + "Result"?: string; + "SaleToPOIRequest"?: SaleToPOIRequest; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "Result", + "baseName": "Result", + "type": "string", + "format": "" + }, + { + "name": "SaleToPOIRequest", + "baseName": "SaleToPOIRequest", + "type": "SaleToPOIRequest", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CloudDeviceApiAsyncResponse.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/typings/clouddevice/cloudDeviceApiRequest.ts b/src/typings/clouddevice/cloudDeviceApiRequest.ts new file mode 100644 index 000000000..0db4c836d --- /dev/null +++ b/src/typings/clouddevice/cloudDeviceApiRequest.ts @@ -0,0 +1,43 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import { SaleToPOIRequest } from "../tapi/saleToPOIRequest"; + +export class CloudDeviceApiRequest { + "SaleToPOIRequest": SaleToPOIRequest; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "SaleToPOIRequest", + "baseName": "SaleToPOIRequest", + "type": "SaleToPOIRequest", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CloudDeviceApiRequest.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/typings/clouddevice/cloudDeviceApiResponse.ts b/src/typings/clouddevice/cloudDeviceApiResponse.ts new file mode 100644 index 000000000..33cefb101 --- /dev/null +++ b/src/typings/clouddevice/cloudDeviceApiResponse.ts @@ -0,0 +1,51 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import { SaleToPOIRequest } from "../tapi/saleToPOIRequest"; +import { SaleToPOIResponse } from "../tapi/saleToPOIResponse"; + +export class CloudDeviceApiResponse { + "SaleToPOIResponse"?: SaleToPOIResponse; + "SaleToPOIRequest"?: SaleToPOIRequest; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "SaleToPOIResponse", + "baseName": "SaleToPOIResponse", + "type": "SaleToPOIResponse", + "format": "" + }, + { + "name": "SaleToPOIRequest", + "baseName": "SaleToPOIRequest", + "type": "SaleToPOIRequest", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CloudDeviceApiResponse.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/typings/clouddevice/connectedDevicesResponse.ts b/src/typings/clouddevice/connectedDevicesResponse.ts new file mode 100644 index 000000000..6abf5e7d5 --- /dev/null +++ b/src/typings/clouddevice/connectedDevicesResponse.ts @@ -0,0 +1,41 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +export class ConnectedDevicesResponse { + "uniqueDeviceIds"?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "uniqueDeviceIds", + "baseName": "uniqueDeviceIds", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ConnectedDevicesResponse.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/typings/clouddevice/deviceStatus.ts b/src/typings/clouddevice/deviceStatus.ts new file mode 100644 index 000000000..45cbbd94f --- /dev/null +++ b/src/typings/clouddevice/deviceStatus.ts @@ -0,0 +1,23 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +export enum DeviceStatus { + Online = 'ONLINE', + Offline = 'OFFLINE' +} diff --git a/src/typings/clouddevice/deviceStatusResponse.ts b/src/typings/clouddevice/deviceStatusResponse.ts new file mode 100644 index 000000000..a6e043766 --- /dev/null +++ b/src/typings/clouddevice/deviceStatusResponse.ts @@ -0,0 +1,53 @@ +/* + * ###### + * ###### + * ############ ####( ###### #####. ###### ############ ############ + * ############# #####( ###### #####. ###### ############# ############# + * ###### #####( ###### #####. ###### ##### ###### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### + * ###### ###### #####( ###### #####. ###### ##### ##### ###### + * ############# ############# ############# ############# ##### ###### + * ############ ############ ############# ############ ##### ###### + * ###### + * ############# + * ############ + * Adyen NodeJS API Library + * Copyright (c) 2026 Adyen B.V. + * This file is open source and available under the MIT license. + * See the LICENSE file for more info. + */ + +import { DeviceStatus } from "./deviceStatus"; + +export class DeviceStatusResponse { + "deviceId"?: string; + "status"?: DeviceStatus; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "deviceId", + "baseName": "deviceId", + "type": "string", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "DeviceStatus", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DeviceStatusResponse.attributeTypeMap; + } + + public constructor() { + } +} + +export namespace DeviceStatusResponse { +} diff --git a/src/typings/clouddevice/models.ts b/src/typings/clouddevice/models.ts new file mode 100644 index 000000000..0adc326e5 --- /dev/null +++ b/src/typings/clouddevice/models.ts @@ -0,0 +1,6 @@ +export * from "./cloudDeviceApiAsyncResponse" +export * from "./cloudDeviceApiRequest" +export * from "./cloudDeviceApiResponse" +export * from "./connectedDevicesResponse" +export * from "./deviceStatus" +export * from "./deviceStatusResponse"