nps_sdk
Version:
A Node.Js SDK for Ingenico ePayments - NPS LatAm Services
865 lines (744 loc) • 20.8 kB
JavaScript
var Sdk = require('../lib/nps-sdk');
var constants = require('../lib/constants')
var Sdk = new Sdk();
var wLogger = require('winston')
wLogger.level = 'debug'
Sdk.connect({environment: constants.SANDBOX,
//secretKey: 'a3jxFQMDnMp2APdlN4zhVRPI6B97sEOUF8RUWmfH8UJIsw2FzzwSQJlXUueK70pM'
secretKey: 'IeShlZMDk8mp8VA6vy41mLnVggnj1yqHcJyNqIYaRINZnXdiTfhF0Ule9WNAUCR6',
logLevel: constants.INFO,
logger: wLogger,
sanitize: true,
cache: true
})
//Sdk.payOnline2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '986',
// psp_Country: 'BRA',
// psp_Product: 14,
// psp_CardNumber: 4012001038166662,
// psp_CardExpDate: 1906,
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_SecureHash: "x"
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// //console.log(response);
// }
//});
//Sdk.authorize2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.bankPayment2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_ScreenDescription: 'Descripcion',
// psp_TicketDescription: 'Descripcion',
// psp_CustomerBankId: 'RIOP',
// psp_CustomerDocType: 'DNI',
// psp_CustomerDocNum: '11111111',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 320,
// psp_ExpDate1: '2016-12-01',
// psp_Amount1: 15050,
// psp_ExpMark: 0,
// psp_ExpTime: '14:00:00',
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.splitPayOnline2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_Transactions: [{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-1',
// psp_Product: 14,
// psp_Amount: 10000,
// psp_NumPayments: 1
// },{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_Product: 5,
// psp_Amount: 5050,
// psp_NumPayments: 1
// }]
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.splitAuthorize2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_Transactions: [{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-1',
// psp_Product: 14,
// psp_Amount: 10000,
// psp_NumPayments: 1
// },{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_Product: 5,
// psp_Amount: 5050,
// psp_NumPayments: 1
// }]
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.payOnline3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.splitPayOnline3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_Transactions: [{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-1',
// psp_Product: 14,
// psp_Amount: 10000,
// psp_NumPayments: 1
// },{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_Product: 5,
// psp_Amount: 5050,
// psp_NumPayments: 1
// }]
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.authorize3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.splitAuthorize3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_Transactions: [{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-1',
// psp_Product: 14,
// psp_Amount: 10000,
// psp_NumPayments: 1
// },{
// psp_MerchantId: 'psp_test',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_Product: 5,
// psp_Amount: 5050,
// psp_NumPayments: 1
// }]
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.bankPayment3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_ScreenDescription: 'Descripcion',
// psp_TicketDescription: 'Descripcion',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 320,
// psp_ExpDate1: '2016-12-01',
// psp_Amount1: 15050,
// psp_ExpMark: 0,
// psp_ExpTime: '14:00:00',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.cashPayment3p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_ReturnURL: 'http://localhost/',
// psp_FrmLanguage: 'es_AR',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 301,
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.authorize2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log('Capture ERROR (Authorize2p ERROR)');
// } else {
//
// Sdk.capture({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666',
// psp_TransactionId_Orig: response.psp_TransactionId,
// psp_AmountToCapture: 15050,
// psp_PosDateTime: '2016-12-01 12:00:00'
// },
// function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
// });
// }
//});
//Sdk.authorize2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666-2',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log('Refund ERROR (Authorize2p ERROR)');
// } else {
//
// Sdk.refund({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666',
// psp_TransactionId_Orig: response.psp_TransactionId,
// psp_AmountToRefund: 15050,
// psp_PosDateTime: '2016-12-01 12:00:00'
// },
// function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
// });
// }
//});
//Sdk.simpleQueryTx({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_QueryCriteria: 'M',
// psp_QueryCriteriaId: 'ORDER66666',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.queryCardNumber({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_QueryCriteria: 'M',
// psp_QueryCriteriaId: 'ORDER66666',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.queryCardDetails({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_QueryCriteria: 'M',
// psp_QueryCriteriaId: 'WS-CLIENT.547DD35F9C5431.33195318',
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_TxSource: 'WEB'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.queryTxs({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_QueryCriteria: 'O',
// psp_QueryCriteriaId: 'ORDER66666',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.getIinDetails({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_IIN: '000000',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.fraudScreening({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66666',
// psp_MerchOrderId: 'ORDER66666',
// psp_Amount: 15050,
// psp_NumPayments: 1,
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: 14,
// psp_CardNumber: 4507990000000010,
// psp_CardExpDate: 1612,
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.notifyFraudScreeningReview({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_Criteria: 'T',
// psp_CriteriaId: 'ORDER66666',
// psp_ReviewResult: 'A',
// psp_PosDateTime: '2016-12-01 12:00:00',
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.changeSecretKey({
// psp_Version: '2.2',
// psp_MerchantId: 'fbasile',
// psp_NewSecretKey: 'e3jxFQMDnMp2APdlN4zhVRPI6B97sEOUF8RUWmfH8UJIsw2FzzwSQJlXUueK70pM',
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.createClientSession({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.createPaymentMethodToken({
// 'psp_Address': {
// 'AdditionalInfo': '2 A',
// 'City': 'Miami',
// 'Country': 'USA',
// 'HouseNumber': '1245',
// 'StateProvince': 'Florida',
// 'Street': 'Av. Collins',
// 'ZipCode': '33140'
// },
// 'psp_CardInputDetails': {
// 'ExpirationDate': '1909',
// 'HolderName': 'JOHN DOE',
// 'Number': '4507990000000010',
// 'SecurityCode': '123'
// },
// 'psp_ClientSession': 'C5jwwbyAYneLbvZe0IYPHTvn7ODMb3vG8ZqCYaYIioUmWUbcgKscGpg8WhXrspRs',
// 'psp_MerchantId': 'psp_test',
// 'psp_Person': {
// 'DateOfBirth': '1979-01-12',
// 'FirstName': 'John',
// 'Gender': 'M',
// 'IDNumber': '54111111',
// 'IDType': '200',
// 'LastName': 'Doe',
// 'MiddleName': 'Michael',
// 'Nationality': 'ARG',
// 'PhoneNumber1': '+1 011 11111111',
// 'PhoneNumber2': '+1 011 22222222'
// },
// 'psp_Product': '14',
// 'psp_Version': '2.2'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.retrievePaymentMethodToken({
// 'psp_PaymentMethodToken': 'HGIYeXKJpQyBvO3pHuZTN9JZiVPnzQaQ',
// 'psp_ClientSession': 'C5jwwbyAYneLbvZe0IYPHTvn7ODMb3vG8ZqCYaYIioUmWUbcgKscGpg8WhXrspRs',
// 'psp_MerchantId': 'psp_test',
// 'psp_Version': '2.2'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.createPaymentMethod({
// 'psp_MerchantId': 'psp_test',
// 'psp_PaymentMethod': {
// 'Address': {
// 'AdditionalInfo': '2 A',
// 'City': 'Miami',
// 'Country': 'USA',
// 'HouseNumber': '1245',
// 'StateProvince': 'Florida',
// 'Street': 'Av. Collins',
// 'ZipCode': '33140'
// },
// 'PaymentMethodToken': '9h6oVZawzknHqkypj9qU9dKJevc9pMGl',
// 'Person': {
// 'DateOfBirth': '1979-01-12',
// 'FirstName': 'John',
// 'Gender': 'M',
// 'IDNumber': '54111111',
// 'IDType': '200',
// 'LastName': 'Doe',
// 'MiddleName': 'Michael',
// 'Nationality': 'ARG',
// 'PhoneNumber1': '+1 011 11111111',
// 'PhoneNumber2': '+1 011 22222222'
// },
// 'Product': '14'
// },
// 'psp_PosDateTime': '2008-01-12 13:05:00',
// 'psp_SetAsCustomerDefault': '1',
// 'psp_Version': '2.2'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.recachePaymentMethodToken({
// 'psp_Address': {
// 'AdditionalInfo': '2 A',
// 'City': 'Miami',
// 'Country': 'USA',
// 'HouseNumber': '1245',
// 'StateProvince': 'Florida',
// 'Street': 'Av. Collins',
// 'ZipCode': '33140'
// },
// 'psp_CardSecurityCode': '123',
// 'psp_ClientSession': 'C5jwwbyAYneLbvZe0IYPHTvn7ODMb3vG8ZqCYaYIioUmWUbcgKscGpg8WhXrspRs',
// 'psp_MerchantId': 'psp_test',
// 'psp_PaymentMethodId': 'Nzmd7DyGytXXC5PtKwnCsXXuQWHJB9EE',
// 'psp_Person': {
// 'DateOfBirth': '1979-01-12',
// 'FirstName': 'John',
// 'Gender': 'M',
// 'IDNumber': '54111111',
// 'IDType': '200',
// 'LastName': 'Doe',
// 'MiddleName': 'Michael',
// 'Nationality': 'ARG',
// 'PhoneNumber1': '+1 011 11111111',
// 'PhoneNumber2': '+1 011 22222222'
// },
// 'psp_Version': '2.2'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.retrievePaymentMethod({
// 'psp_MerchantId': 'psp_test',
// 'psp_PaymentMethodId': 'Q3OS3q3mw8qF6gtlihyB4dWL6Cu8Yjk1',
// 'psp_PosDateTime': '2008-01-12 13:05:00',
// 'psp_Version': '2.2'
// },
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.createCustomer({
// 'psp_AccountCreatedAt': '2010-10-23',
// 'psp_AccountID': 'jdoe78',
// 'psp_Address': {
// 'AdditionalInfo': '2 A',
// 'City': 'Miami',
// 'Country': 'USA',
// 'HouseNumber': '1245',
// 'StateProvince': 'Florida',
// 'Street': 'Av. Collins',
// 'ZipCode': '33140'
// },
// 'psp_AlternativeEmailAddress': 'jdoe@example.com',
// 'psp_EmailAddress': 'jhon.doe@example.com',
// 'psp_MerchantId': 'psp_test',
//
// 'psp_Person': {
// 'DateOfBirth': '1979-01-12',
// 'FirstName': 'John',
// 'Gender': 'M',
// 'IDNumber': '54111111',
// 'IDType': '200',
// 'LastName': 'Doe',
// 'MiddleName': 'Michael',
// 'Nationality': 'ARG',
// 'PhoneNumber1': '+1 011 11111111',
// 'PhoneNumber2': '+1 011 22222222'
// },
// 'psp_PosDateTime': '2008-01-12 13:05:00',
// 'psp_Version': '2.2'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.capture({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER666xd',
// psp_TransactionId_Orig: '99975',
// psp_AmountToCapture: '15050',
// psp_PosDateTime: '2016-12-01 12:00:00'
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});
//Sdk.authorize2p({
// psp_Version: '2.2',
// psp_MerchantId: 'psp_test',
// psp_TxSource: 'WEB',
// psp_MerchTxRef: 'ORDER66662-2',
// psp_MerchOrderId: 'ORDER66662',
// psp_Amount: '15050',
// psp_NumPayments: '1',
// psp_Currency: '032',
// psp_Country: 'ARG',
// psp_Product: '14',
// psp_CardNumber: '4507990000000010',
// psp_CardExpDate: '1712',
// psp_CardSecurityCode: '325',
// psp_PosDateTime: '2016-12-01 12:00:00',
// psp_MerchantAdditionalDetails: {
// ShoppingCartDetails: 'Card'
// }
//},
//function (error, response) {
// if (error) {
// console.log(error)
// } else {
// console.log(response);
// }
//});