Browse Source

Update message status in db when payment failed

feature/dockerfile-arm
Ștefan D. Mihăilă 5 years ago
parent
commit
c98ba2d90e
No known key found for this signature in database GPG Key ID: 6220AD7846220A52
  1. 4
      api/controllers/payment.ts
  2. 3
      dist/api/controllers/payment.js
  3. 2
      dist/api/controllers/payment.js.map

4
api/controllers/payment.ts

@ -6,8 +6,9 @@ import * as helpers from '../helpers'
import { success } from '../utils/res'
import * as lightning from '../utils/lightning'
import {tokenFromTerms} from '../utils/ldat'
import * as constants from '../../config/constants.json'
const constants = require(__dirname + '/../../config/constants.json');
const sendPayment = async (req, res) => {
const {
@ -107,6 +108,7 @@ const sendPayment = async (req, res) => {
success(res, jsonUtils.messageToJson(message, chat))
},
failure: (error) => {
message.update({status: constants.statuses.failed})
res.status(200);
res.json({ success: false, error });
res.end();

3
dist/api/controllers/payment.js

@ -17,7 +17,7 @@ const helpers = require("../helpers");
const res_1 = require("../utils/res");
const lightning = require("../utils/lightning");
const ldat_1 = require("../utils/ldat");
const constants = require(__dirname + '/../../config/constants.json');
const constants = require("../../config/constants.json");
const sendPayment = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const { amount, chat_id, contact_id, destination_key, media_type, muid, text, remote_text, dimensions, remote_text_map, contact_ids, } = req.body;
console.log('[send payment]', req.body);
@ -98,6 +98,7 @@ const sendPayment = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
res_1.success(res, jsonUtils.messageToJson(message, chat));
}),
failure: (error) => {
message.update({ status: constants.statuses.failed });
res.status(200);
res.json({ success: false, error });
res.end();

2
dist/api/controllers/payment.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save