-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
93 lines (86 loc) · 2.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const soap = require('soap');
const url = 'https://homologation.payline.com/V4/services/WebPaymentAPI';
const wsdl = `${url}?wsdl`;
const { PAYLINE_USERNAME, PAYLINE_PASSWORD, PAYLINE_CONTRACT } = process.env;
const data = {
version: 21,
payment: {
amount: 100,
currency: 978,
action: 101,
mode: 'CPT',
contractNumber: '1234567_1'
},
returnURL: 'http://localhost:3010/confirmation/postmanFakeOrderId',
cancelURL: 'http://localhost:3010/payment',
order: {
ref: 'test',
amount: 100,
currency: 978,
date: '09/09/2019 15:38',
deliveryExpectedDate: '10/10/2019'
},
selectedContractList: { selectedContract: PAYLINE_CONTRACT },
buyer: {
lastName: 'TEST',
firstName: 'Charlotte',
email: 'Charlotte.ROBERTCRO@monext.net',
shippingAdress: {
name: 'Home',
firstName: 'Jane',
lastName: 'DOE',
street1: '7 place Ronde',
cityName: 'Marseille',
zipCode: '13005',
country: 'FR',
phone: '0491000000',
county: '5eme arr.',
phoneType: '0'
},
billingAddress: {
name: 'Monext',
firstName: 'John',
lastName: 'DOE',
street1: '260, rue Claude Nicolas Ledoux',
cityName: 'Aix-en-Provence Cedex 3',
zipCode: '13593',
country: 'FR',
phone: '0442000000',
phoneType: '0'
},
accountCreateDate: '10/02/09',
accountAverageAmount: 3609,
accountOrderCount: 15,
mobilePhone: '0600000000',
customerId: 'JohnDOE_20090210',
legalStatus: 1,
legalDocument: 5,
birthDate: '1980-01-20',
fingerprintID: '65w4765xf45qs4fmjslgkj354q354'
},
owner: {
lastName: 'DOE',
firstName: 'John',
billingAddress: {
street: '260, rue Claude Nico',
cityName: 'Aix-en-Provence Cedex 3',
zipCode: '13593',
country: 'FR',
phone: '0442000000'
},
issueCardDate: '0118'
},
merchantName: 'tictactrip'
};
soap.createClient(wsdl, (err, client) => {
client.setSecurity(
new soap.BasicAuthSecurity(PAYLINE_USERNAME, PAYLINE_PASSWORD)
);
client.setEndpoint(url);
client.doWebPayment(data, (error, result) => {
if(error) {
console.error(error);
}
console.log(JSON.stringify(result));
});
});