Commit b6b185202d8a1134a5de5fc49851d7881acebfcb
1 parent
db96f57031
Exists in
master
inputCheck
Showing 1 changed file with 20 additions and 19 deletions Side-by-side Diff
partner-kospinjasa.js
... | ... | @@ -38,7 +38,7 @@ function topupRequest(task, retry) { |
38 | 38 | } |
39 | 39 | |
40 | 40 | var remoteProduct = task.remoteProduct.split(','); |
41 | - var args = { | |
41 | + var params = { | |
42 | 42 | userName: config.h2h_out.userid, |
43 | 43 | productCode: remoteProduct[0] , |
44 | 44 | terminal: 'terminal0', |
... | ... | @@ -47,13 +47,13 @@ function topupRequest(task, retry) { |
47 | 47 | amount: remoteProduct[1], |
48 | 48 | bit61: createBillNumber(task.destination), |
49 | 49 | reff: task.requestId, |
50 | - timeStamp: strftime('%d-%m-%Y %H:%M:%S', new Date()), | |
50 | + timeStamp: strftime('%d-%m-%Y %H:%M:%S', new Date()) | |
51 | 51 | } |
52 | 52 | |
53 | - var signature = createSignature(args, config.h2h_out.password); | |
54 | - args.signature = signature; | |
53 | + var signature = createSignature(params, config.h2h_out.password); | |
54 | + params.signature = signature; | |
55 | 55 | |
56 | - topupRequestEasySoap(task, args, retry); | |
56 | + topupRequestSoap(task, params, retry); | |
57 | 57 | } |
58 | 58 | |
59 | 59 | function topupRequestEasySoap(task, args, retry) { |
... | ... | @@ -89,13 +89,14 @@ function topupRequestEasySoap(task, args, retry) { |
89 | 89 | callbackReport(task.requestId, '68', 'debug'); |
90 | 90 | } |
91 | 91 | |
92 | -function topupRequestSoap(task, args, retry) { | |
92 | +function topupRequestSoap(task, params, retry) { | |
93 | 93 | |
94 | - soap.createClient(config.h2h_out.partner, function(err, client) { | |
94 | + soap.createClient(config.h2h_out.partner, function(err, soapClient) { | |
95 | 95 | |
96 | - logger.info('Requesting to service', {url: config.h2h_out.partner, args: args}); | |
96 | + logger.info('Requesting to service', {url: config.h2h_out.partner, params: params}); | |
97 | + | |
98 | + soapClient.apih2h.apih2hPort.billpayment({inputCheck: params}, function(err, result) { | |
97 | 99 | |
98 | - client.apih2h.apih2hPort.billpayment(args, function(err, result) { | |
99 | 100 | if (err) { |
100 | 101 | logger.warn('Error requesting service', {err: err}); |
101 | 102 | callbackReport(task.requestId, '68', 'something wrong'); |
... | ... | @@ -113,24 +114,24 @@ function topupRequestSoap(task, args, retry) { |
113 | 114 | |
114 | 115 | |
115 | 116 | |
116 | -function createSignature(args, password) { | |
117 | +function createSignature(params, password) { | |
117 | 118 | var passwordHash = crypto.createHash('sha256').update(password).digest().toString('hex'); |
118 | 119 | |
119 | 120 | var plain = |
120 | - args.userName | |
121 | + params.userName | |
121 | 122 | + passwordHash |
122 | - + args.productCode | |
123 | - + args.terminal | |
124 | - + args.transactionType | |
125 | - + args.billNumber | |
126 | - + args.amount | |
127 | - + args.reff | |
128 | - + args.timeStamp; | |
123 | + + params.productCode | |
124 | + + params.terminal | |
125 | + + params.transactionType | |
126 | + + params.billNumber | |
127 | + + params.amount | |
128 | + + params.reff | |
129 | + + params.timeStamp; | |
129 | 130 | |
130 | 131 | var result = crypto.createHash('sha1').update(plain).digest().toString('hex'); |
131 | 132 | |
132 | 133 | if (logger) { |
133 | - logger.verbose('Calculating signature', {plain: plain, result: result, args: args, password: password}); | |
134 | + logger.verbose('Calculating signature', {plain: plain, result: result, params: params, password: password}); | |
134 | 135 | } |
135 | 136 | |
136 | 137 | return result; |