import * as selectively from "selectively" import { Name as ProcessorName } from "./Name" export interface Processor { mid: string entry: "e-commerce" | string reference: { transaction: string retrieval: string scheme: string } response: { code: string csc: "matched" | "not matched" | "not processed" | "not present" | "not certified" | "not checked" description: string } code: string eci?: string } export namespace Processor { export function is(value: any | Processor): value is Processor { return ( typeof value == "object" && value && typeof value.mid == "string" && typeof value.entry == "string" && typeof value.reference == "object" && value.reference && typeof value.reference.transaction == "string" && typeof value.reference.retrieval == "string" && typeof value.reference.scheme == "string" && typeof value.response == "object" && value.response && typeof value.response.code == "string" && typeof value.response.csc == "string" && typeof value.response.description == "string" && typeof value.code == "string" && (value.eci == undefined || typeof value.eci == "string") ) } export const template = new selectively.Type.Object({ mid: new selectively.Type.String(), entry: new selectively.Type.Union([new selectively.Type.String("e-commerce"), new selectively.Type.String()]), reference: new selectively.Type.Object({ transaction: new selectively.Type.String(), retrieval: new selectively.Type.String(), scheme: new selectively.Type.String(), }), response: new selectively.Type.Object({ code: new selectively.Type.String(), csc: new selectively.Type.String(), description: new selectively.Type.String(), }), code: new selectively.Type.String(), eci: new selectively.Type.String(), }) export type Name = ProcessorName export namespace Name { export const is = ProcessorName.is } }