1.0.14 • Published 10 months ago

masav v1.0.14

Weekly downloads
9
License
MIT
Repository
github
Last release
10 months ago

Masav

A JavaScript library for building "Masav" files - Israeli sending payments file Masav. The package can build only "send payments" and "get payments" files as described in the following files: Mifrat Zikuim MSV.pdf, Mifrat Hiuvim MSV.pdf.

For implementing other Masav files, please contact me at elisha.mayer.il@gmail.com.

Warning! This npm package not supported by "Masav"

Installation

npm i masav

Importing

 // For send payments files
const { InstitutionSendPayment, SendPaymentsRecord, MasaVSendPayments } = require("masav");
 // For get payments files
const { InstitutionGetPayment, GetPaymentsRecord, MasaVGetPayments } = require("masav");

Building Masav Send Payments File

To build a file you will need the institution details that you got from "Masav", and details about the transactions. You will need to create an instance of MasaVSendPayments.

let masavFile = new MasaVSendPayments();

And an instance of InstitutionSendPayment.

let institution = new InstitutionSendPayment(
  "12345678",
  "12345",
  "201005",
  "201005",
  "<Company-Name>",
  "001"
);

The constructor of InstitutionSendPayment get the following arguments: | Argument Name | Description | Format | | ------------- | ------------- | ----------| | institutionId | The institution Id ( Given by Masav ) | String, Numbers only, Max length 8 digits| | sendingInstitutionId | The sending institution Id ( Given by Masav ) | String, Numbers only, Max length 5 digits| | createDate | The creation date of the record | String, Date in the following format YYMMDD | | paymentDate | The payment date | String, Date in the following format YYMMDD | | institutionName | The institution name | String, Max length 30 characters| | serialNumber | Serial number of the record | String, Numbers only, Max length 3 digits|

Then add the transactions to the institution

institution.addPaymentRecords([
  new SendPaymentsRecord(
    "01",
    "123",
    "123456789",
    "000000018",
    "Receiver Name",
    "000001234",
    12
  ),
  new SendPaymentsRecord(
    "09",
    "222",
    "654321",
    "000000018",
    "Receiver Name",
    "000001234",
    100.12
  ),
]);

The constructor of SendPaymentsRecord get the following arguments: | Argument Name | Description | Format | | ------------- | ------------- | ----------| | bankId | The bank Id number | String, Numbers only, Max length 2 digits| | branchId | The bank branch Id | String, Numbers only, Max length 3 digits| | accountId | The bank account number | String, Numbers only, Max length 9 digits| | payeeId | Payee id ( תעודת זהות ) | String, Numbers only, Max length 9 digits| | payeeName | Payee name | String, Max length 16 characters| | payeeNumber | Payee number | String, Max length 20 characters| | amount | Amount to pay | Number, Bigger than 0, Up to 2 digits after decimal| | paymentPeriod | Payment period | TimeSpan ( gets start and end date as string YYMM ) not required |

Add the institution to the file

masavFile.addInstitution(institution);

Save the file ( Works only on Nodejs )

masavFile.saveFile('test.bin');

Or get Buffer

let buffer = masavFile.toBuffer();

Full Example

const { InstitutionSendPayment, SendPaymentsRecord, MasaVSendPayments } = require("masav");

let masavFile = new MasaVSendPayments();
let institution = new InstitutionSendPayment(
  "12345678",
  "12345",
  "201005",
  "201005",
  "<Company-Name>",
  "001"
);
institution.addPaymentRecords([
  new SendPaymentsRecord(
    "01",
    "123",
    "123456789",
    "000000018",
    "Receiver Name",
    "000001234",
    12
  ),
  new SendPaymentsRecord(
    "09",
    "222",
    "654321",
    "000000018",
    "Receiver Name",
    "000001234",
    100.12
  ),
]);
masavFile.addInstitution(institution);
masavFile.saveFile('test.bin');

Building Masav Get Payments File

To build a file you will need the institution details that you got from "Masav", and details about the transactions. You will need to create an instance of MasaVGetPayments.

let masavFile = new MasaVGetPayments();

And an instance of InstitutionGetPayment.

let institution = new InstitutionGetPayment(
  "12345678",
  "12345",
  "201005",
  "201005",
  "<Company-Name>",
  "001"
);

The constructor of InstitutionGetPayment get the following arguments: | Argument Name | Description | Format | | ------------- | ------------- | ----------| | institutionId | The institution Id ( Given by Masav ) | String, Numbers only, Max length 8 digits| | sendingInstitutionId | The sending institution Id ( Given by Masav ) | String, Numbers only, Max length 5 digits| | createDate | The creation date of the record | String, Date in the following format YYMMDD | | paymentDate | The payment date | String, Date in the following format YYMMDD | | institutionName | The institution name | String, Max length 30 characters| | serialNumber | Serial number of the record | String, Numbers only, Max length 3 digits|

Then add the transactions to the institution

institution.addPaymentRecords([
  new GetPaymentsRecord(
    "01",
    "123",
    "123456789",
    "000000018",
    "Receiver Name",
    "000001234",
    12
  ),
  new GetPaymentsRecord(
    "09",
    "222",
    "654321",
    "000000018",
    "Receiver Name",
    "000001234",
    100.12
  ),
]);

The constructor of GetPaymentsRecord get the following arguments: | Argument Name | Description | Format | | ------------- | ------------- | ----------| | bankId | The bank Id number | String, Numbers only, Max length 2 digits| | branchId | The bank branch Id | String, Numbers only, Max length 3 digits| | accountId | The bank account number | String, Numbers only, Max length 9 digits| | payeeId | Payee id ( תעודת זהות ) | String, Numbers only, Max length 9 digits| | payeeName | Payee name | String, Max length 16 characters| | payeeNumber | Payee number | String, Max length 20 characters| | amount | Amount to pay | Number, Bigger than 0, Up to 2 digits after decimal| | paymentPeriod | Payment period | TimeSpan ( gets start and end date as string YYMM ) not required |

Add the institution to the file

masavFile.addInstitution(institution);

Save the file ( Works only on Nodejs )

masavFile.saveFile('test.bin');

Or get Buffer

let buffer = masavFile.toBuffer();

Full Example

const { InstitutionGetPayment, GetPaymentsRecord, MasaVGetPayments } = require("masav");

let masavFile = new MasaVGetPayments();
let institution = new InstitutionGetPayment(
  "12345678",
  "12345",
  "201005",
  "201005",
  "<Company-Name>",
  "001"
);

institution.addPaymentRecords([
  new GetPaymentsRecord(
    "01",
    "123",
    "123456789",
    "000000018",
    "Receiver Name",
    "000001234",
    12
  ),
  new GetPaymentsRecord(
    "09",
    "222",
    "654321",
    "000000018",
    "Receiver Name",
    "000001234",
    100.12
  ),
]);
masavFile.addInstitution(institution);
masavFile.saveFile('test.bin');
1.0.14

10 months ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago