0.0.5 • Published 8 months ago

mwa-engine v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Example:

import { generateAndValidateXml } from ".";

const PayingPerson = {
  Nm: "My Co.",
  PstlAdr: {
    StrtNm: "Hi",
    BldgNb: "Hi",
    PstCd: "Hi",
    TwnNm: "Hi",
    Ctry: "KE",
  },
};

const PersonBeingPaid = {
  Nm: "Joe Reeve",
  MobNb: "+447480833086",
  EmailAdr: "joe@della.hu",
};

generateAndValidateXml(
  {
    MsgId: "hi",
    CreDtTm: new Date(),
    InitgPty: PayingPerson,
  },
  {
    PmtMtd: "TRF",
    BtchBookg: true,
    Dbtr: PayingPerson,
    DbtrAcct: {
      iban: "BE30001216371411",
    },
    DbtrAgt: {
      bic: "DDDDBEBB",
    },
  },
  [
    {
      EndToEndId: "Some ID",
      Amount: {
        Amount: 40000,
        Currency: "HUF",
      },
      ChrgBr: "DEBT",
      CdtrAgt: { bic: "DDDDBEBB" },
      Cdtr: PersonBeingPaid,
      CdtrAcct: { iban: "BE30001216371411" },
    },
  ]
).then(
  (xmlDoc: string) => {
    console.log("Generated Document:", xmlDoc.trim());
    console.log(`Validated Successfully!`);
  },
  ({ xmlDoc, validationErrors }) => {
    console.warn(`Generated Document:`, xmlDoc);
    console.warn(`Validation Failed:`, validationErrors);
  }
);
0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago

1.0.0

8 months ago