Commit 88b4e0d50fd656200fa180b73b88acb0c1eea40a

Authored by Adhidarma Hadiwinoto
1 parent 4312e4630a
Exists in master

gunakan req.end

Showing 1 changed file with 3 additions and 35 deletions Side-by-side Diff

... ... @@ -64,8 +64,8 @@ function topupRequest(task, retry) {
64 64  
65 65 var payload_xml = createPayload(task);
66 66 console.log(payload_xml);
67   - /*
68   - request.post(config.h2h_out.partner, {message: payload_xml}, function(error, response, body) {
  67 +
  68 + request({uri: config.h2h_out.partner, method: 'POST'}, function(error, response, body) {
69 69 if (error) {
70 70 var error_mesasge = 'Error requesting to partner: ' + error;
71 71 console.log(error_message);
... ... @@ -84,39 +84,7 @@ function topupRequest(task, retry) {
84 84 console.log(body);
85 85 callbackReport(task['requestId'], '68', 'cek');
86 86  
87   - });;
88   - */
89   -
90   - request(
91   - {
92   - method: 'PUT',
93   - uri: config.h2h_out.partner,
94   - multipart: [{
95   - 'content-type': 'text/xml',
96   - body: payload_xml
97   - }]
98   - },
99   -
100   - function(error, response, body) {
101   - if (error) {
102   - var error_message = 'Error requesting to partner: ' + error;
103   - console.log(error_message);
104   - callbackReport(task['requestId'], '40', error_message);
105   - return;
106   - }
107   -
108   - if (response.statusCode != 200) {
109   - var error_message = 'HTTP status code = ' + response.statusCode;
110   - console.log(error_message);
111   - callbackReport(task['requestId'], '40', error_message);
112   - return;
113   - }
114   -
115   - console.log('Direct response from partner:');
116   - console.log(body);
117   - callbackReport(task['requestId'], '68', 'cek');
118   - }
119   - );
  87 + }).end(payload_xml);;
120 88  
121 89 }
122 90