Commit 274f90989c185f65a8231a2322db5f4fa2fb1bf9

Authored by Adhidarma Hadiwinoto
1 parent c66f76c6e0
Exists in master

coba multipart

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

... ... @@ -64,7 +64,7 @@ function topupRequest(task, retry) {
64 64  
65 65 var payload_xml = createPayload(task);
66 66 console.log(payload_xml);
67   -
  67 + /*
68 68 request.post(config.h2h_out.partner, {message: payload_xml}, function(error, response, body) {
69 69 if (error) {
70 70 var error_mesasge = 'Error requesting to partner: ' + error;
... ... @@ -85,6 +85,39 @@ function topupRequest(task, retry) {
85 85 callbackReport(task['requestId'], '68', 'cek');
86 86  
87 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_mesasge = '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_mesasge = '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 + );
  120 +
88 121 }
89 122  
90 123 function createServer() {