mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
add SaleToPOIResponse as field for terminalApiResponse (#842)
This commit is contained in:
@@ -365,3 +365,24 @@ export const syncRefund = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const syncResEventNotification = {
|
||||
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"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* #############
|
||||
* ############
|
||||
* Adyen NodeJS API Library
|
||||
* Copyright (c) 2021 Adyen B.V.
|
||||
* Copyright (c) 2022 Adyen N.V.
|
||||
* This file is open source and available under the MIT license.
|
||||
* See the LICENSE file for more info.
|
||||
*/
|
||||
@@ -20,7 +20,7 @@
|
||||
import nock from "nock";
|
||||
import { createClient, createTerminalAPIPaymentRequest, createTerminalAPIRefundRequest } from "../__mocks__/base";
|
||||
import { asyncRes } from "../__mocks__/terminalApi/async";
|
||||
import { syncRefund, syncRes } from "../__mocks__/terminalApi/sync";
|
||||
import { syncRefund, syncRes, syncResEventNotification } from "../__mocks__/terminalApi/sync";
|
||||
import Client from "../client";
|
||||
import TerminalCloudAPI from "../services/terminalCloudAPI";
|
||||
import { TerminalApiResponse } from "../typings/terminal/models";
|
||||
@@ -68,6 +68,17 @@ describe("Terminal Cloud API", (): void => {
|
||||
expect(terminalAPIResponse.SaleToPOIResponse?.MessageHeader).toBeDefined();
|
||||
});
|
||||
|
||||
test.each([isCI, true])("should return event notification if response contains it, isMock: %p", async (isMock): Promise<void> => {
|
||||
!isMock && nock.restore();
|
||||
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
|
||||
scope.post("/sync").reply(200, syncResEventNotification);
|
||||
|
||||
const terminalAPIResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
|
||||
|
||||
expect(terminalAPIResponse.SaleToPOIRequest?.EventNotification).toBeDefined();
|
||||
});
|
||||
|
||||
test.each([isCI, true])("should make an async refund request, isMock: %p", async (isMock): Promise<void> => {
|
||||
!isMock && nock.restore();
|
||||
scope.post("/sync").reply(200, syncRes);
|
||||
|
||||
@@ -12,28 +12,24 @@
|
||||
* #############
|
||||
* ############
|
||||
* Adyen NodeJS API Library
|
||||
* Copyright (c) 2021 Adyen B.V.
|
||||
* Copyright (c) 2022 Adyen N.V.
|
||||
* This file is open source and available under the MIT license.
|
||||
* See the LICENSE file for more info.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Terminal API
|
||||
* Definition of Terminal API Schema
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import { SaleToPOIResponse } from './saleToPOIResponse';
|
||||
import {SaleToPOIRequest} from "./saleToPOIRequest";
|
||||
|
||||
export class TerminalApiResponse {
|
||||
'SaleToPOIResponse'?: SaleToPOIResponse;
|
||||
'SaleToPOIRequest'?: SaleToPOIRequest;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
@@ -42,7 +38,12 @@ export class TerminalApiResponse {
|
||||
"name": "SaleToPOIResponse",
|
||||
"baseName": "SaleToPOIResponse",
|
||||
"type": "SaleToPOIResponse"
|
||||
} ];
|
||||
},
|
||||
{
|
||||
"name": "SaleToPOIRequest",
|
||||
"baseName": "SaleToPOIRequest",
|
||||
"type": "SaleToPOIRequest"
|
||||
}];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return TerminalApiResponse.attributeTypeMap;
|
||||
|
||||
Reference in New Issue
Block a user