Commit 6ec424b07d1838dea4779b2cdad58bcd470923a2

Authored by Adhidarma Hadiwinoto
1 parent ac8c1ea6eb
Exists in master

pushResponseToDb jika ada kegagalan

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

partner-bayarkilat.js
... ... @@ -57,22 +57,38 @@ function topupRequest(task, retry) {
57 57 if (error) {
58 58 logger.warn('Error requesting to partner', {error: error});
59 59 callbackReport(task.requestId, '68', 'Error requesting to partner. ' + error);
  60 +
  61 + var _response = {
  62 + raw: 'Error requesting to partner. ' + error,
  63 + parsed: {
  64 + MESSAGE: 'Error requesting to partner. ' + error,
  65 + error: error
  66 + }
  67 + }
  68 + aaa.pushResponseToMongoDb(task, _response, '68');
  69 +
60 70 return;
61 71 }
62 72  
63 73 if (response.statusCode != 200) {
64   - var message = 'Partner response with http status code other that 200 (' + response.statusCode +')';
  74 + var message = 'Partner response with http status code other that 200 (' + response.statusCode + ')';
65 75  
66 76 logger.warn(message);
67 77 callbackReport(task.requestId, '68', message);
  78 +
  79 + var _response = {
  80 + raw: 'Partner response with http status code other that 200 (' + response.statusCode + ')',
  81 + parsed: {
  82 + MESSAGE: 'Partner response with http status code other that 200 (' + response.statusCode + ')',
  83 + responseHttpStatus: response.statusCode,
  84 + responseBody: body,
  85 + }
  86 + }
  87 + aaa.pushResponseToMongoDb(task, _response, '68');
  88 +
68 89 return;
69 90 }
70 91  
71   - /*
72   - logger.verbose('Got response', {requestId: task.requestId, responseBody: body});
73   - callbackReport(task.requestId, '68', body);
74   - */
75   -
76 92 logger.verbose('Got respose', {rawBody: body});
77 93 parseResponse(body, task);
78 94 });