0.0.11 • Published 9 years ago

@ostad/moth v0.0.11

Weekly downloads
1
License
ISC
Repository
-
Last release
9 years ago

Moth for shaparak!

Description

This package made to make easy to deal with shaparak terminal however it's so soon to use it.

Installation

npm install @ostad/moth --save

Settings

For using you have to save your terminal settings in config/bank.json with format like this.

{
	"default": {
		"name": "bankName",
		"description": "",
		"portals": {
			"host": "pep.shaparak.ir",
			"pay": "/gateway.aspx",
			"result": "/CheckTransactionResult.aspx",
			"verify": "/VerifyPayment.aspx",
			"refund": "/doRefund.aspx"
		},
		"metchanId": "123456",
		"terminalId": "654321",
		"key": "private pem key"
	},
	"shop2": {
		"name": "pasargad",
		"description": "",
		"portals": {
			"host": "pep.shaparak.ir",
			"pay": "/gateway.aspx",
			"result": "/CheckTransactionResult.aspx",
			"verify": "/VerifyPayment.aspx",
			"refund": "/doRefund.aspx"
		},
		"metchanId": "234567",
		"terminalId": "987654",
		"key": "private pem key"
	}
}

Usage

you need to pass an object like folowing table

NameDescriptiontype(s)NullabeDefault
bankName of the bank object in bank.jsonstringtrueDefault
invoiceNumberInvoice nubmernumber,stringfalse
invoiceDateInvoice dateDate, stringtruecurrent datetime
amountamount money to pay in RIALnumber, stringfalse
redirectAddressthe URL for proccessing to after the payment.stringfalse

Example

var moth = require('@ostad/moth').invoice;

var invoice = {
	bank:'pasargad',
	invoiceNumber:'123',
	invoiceDate: '2015-11-13 15:43:32' , 
	amount: '240000',
	redirectAddress:'http://eco.mysite.com/'
};


//sign the request
moth(invoice).pay();

//check for payment
moth(invoice).result();

//confirm payment
moth(invoice).verify()

//return money to user
moth(invoice).refund()
0.0.11

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.2

9 years ago