import { WebApiClient } from '../web-api/web-api-client'; import { ConfigurationError } from '../core/error'; import { SigningObject } from './signing-object'; /** * @export * @class SigningUtils */ export class SigningUtils { /** * Replaces order's signInfo property with new SigningObject with passed parameters * * @static * @param {any} order * @param {WebApiClient} client * @param {string} url * @returns {void} * * @memberOf SigningUtils */ public static createSigningObject(order: any, client: WebApiClient, url: string): void { if (!order || !order.signInfo) { return; } if (!client) { throw new ConfigurationError('You must pass client to createSigningObject function to have the ability to call API'); } if (!url) { throw new ConfigurationError('You must pass url for signing to createSigningObject function'); } order.signing = new SigningObject(order, client, url); delete order.signInfo; } }