UNPKG

@adyen/api-library

Version:

The Adyen API Library for NodeJS enables you to work with Adyen APIs.

100 lines 4.32 kB
"use strict"; /* * The version of the OpenAPI document: v2 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit this class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationWebhooksHandler = void 0; const __1 = require(".."); /** * Handler for processing ConfigurationWebhooks. * * This class provides functionality to deserialize the payload of ConfigurationWebhooks events. */ class ConfigurationWebhooksHandler { constructor(jsonPayload) { this.payload = JSON.parse(jsonPayload); } /** * This method checks the type of the webhook payload and returns the appropriate deserialized object. * * @returns A deserialized object of type GenericWebhook. * @throws Error if the type is not recognized. */ getGenericWebhook() { const type = this.payload["type"]; if (Object.values(__1.configurationWebhooks.AccountHolderNotificationRequest.TypeEnum).includes(type)) { return this.getAccountHolderNotificationRequest(); } if (Object.values(__1.configurationWebhooks.BalanceAccountNotificationRequest.TypeEnum).includes(type)) { return this.getBalanceAccountNotificationRequest(); } if (Object.values(__1.configurationWebhooks.CardOrderNotificationRequest.TypeEnum).includes(type)) { return this.getCardOrderNotificationRequest(); } if (Object.values(__1.configurationWebhooks.NetworkTokenNotificationRequest.TypeEnum).includes(type)) { return this.getNetworkTokenNotificationRequest(); } if (Object.values(__1.configurationWebhooks.PaymentNotificationRequest.TypeEnum).includes(type)) { return this.getPaymentNotificationRequest(); } if (Object.values(__1.configurationWebhooks.SweepConfigurationNotificationRequest.TypeEnum).includes(type)) { return this.getSweepConfigurationNotificationRequest(); } throw new Error("Could not parse the json payload: " + this.payload); } /** * Deserialize the webhook payload into a AccountHolderNotificationRequest * * @returns Deserialized AccountHolderNotificationRequest object. */ getAccountHolderNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "AccountHolderNotificationRequest"); } /** * Deserialize the webhook payload into a BalanceAccountNotificationRequest * * @returns Deserialized BalanceAccountNotificationRequest object. */ getBalanceAccountNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "BalanceAccountNotificationRequest"); } /** * Deserialize the webhook payload into a CardOrderNotificationRequest * * @returns Deserialized CardOrderNotificationRequest object. */ getCardOrderNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "CardOrderNotificationRequest"); } /** * Deserialize the webhook payload into a NetworkTokenNotificationRequest * * @returns Deserialized NetworkTokenNotificationRequest object. */ getNetworkTokenNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "NetworkTokenNotificationRequest"); } /** * Deserialize the webhook payload into a PaymentNotificationRequest * * @returns Deserialized PaymentNotificationRequest object. */ getPaymentNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "PaymentNotificationRequest"); } /** * Deserialize the webhook payload into a SweepConfigurationNotificationRequest * * @returns Deserialized SweepConfigurationNotificationRequest object. */ getSweepConfigurationNotificationRequest() { return __1.configurationWebhooks.ObjectSerializer.deserialize(this.payload, "SweepConfigurationNotificationRequest"); } } exports.ConfigurationWebhooksHandler = ConfigurationWebhooksHandler; //# sourceMappingURL=configurationWebhooksHandler.js.map