Browse Source

fix repayment, dont include failed payments in tx list

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
83362bd4e3
  1. 6
      dist/src/controllers/payment.js
  2. 2
      dist/src/controllers/payment.js.map
  3. 1
      dist/src/utils/timers.js
  4. 2
      dist/src/utils/timers.js.map
  5. 6
      src/controllers/payment.ts
  6. 1
      src/utils/timers.ts

6
dist/src/controllers/payment.js

@ -165,7 +165,8 @@ exports.listPayments = (req, res) => __awaiter(void 0, void 0, void 0, function*
constants_1.default.message_types.direct_payment,
constants_1.default.message_types.keysend,
constants_1.default.message_types.purchase,
] }
] },
status: { [sequelize_1.Op.not]: constants_1.default.statuses.failed }
},
{
type: { [sequelize_1.Op.or]: [
@ -175,7 +176,8 @@ exports.listPayments = (req, res) => __awaiter(void 0, void 0, void 0, function*
amount: {
[sequelize_1.Op.gt]: MIN_VAL // greater than
},
network_type: constants_1.default.network_types.lightning
network_type: constants_1.default.network_types.lightning,
status: { [sequelize_1.Op.not]: constants_1.default.statuses.failed }
}
],
},

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

File diff suppressed because one or more lines are too long

1
dist/src/utils/timers.js

@ -100,6 +100,7 @@ function payBack(t) {
message: { id: t.msgId, amount: t.amount },
amount: t.amount,
type: constants_1.default.message_types.repayment,
realSatsContactId: t.receiver
});
models_1.models.Timer.destroy({ where: { id: t.id } });
});

2
dist/src/utils/timers.js.map

@ -1 +1 @@
{"version":3,"file":"timers.js","sourceRoot":"","sources":["../../../src/utils/timers.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AAEpC,MAAM,MAAM,GAAC,EAAE,CAAA;AACf,SAAS,UAAU,CAAC,CAAC;IACjB,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACxB,IAAG,IAAI;QAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;AACvC,CAAC;AACD,SAAsB,kBAAkB,CAAC,K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AAO,CAAC,WAAW,CAAC;YAChB,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,EAAE,EAAC,CAAC,CAAC,KAAK,EAAC,MAAM,EAAC,CAAC,CAAC,MAAM,EAAC;YACrC,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,IAAI,EAAE,mBAAS,CAAC,aAAa,CAAC,SAAS;YACvC,iBAAiB,EAAE,CAAC,CAAC,QAAQ;SAChC,CAAC,CAAA;QACF,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAC,KAAK,EAAC,EAAC,EAAE,EAAC,CAAC,CAAC,EAAE,EAAC,EAAC,CAAC,CAAA;IAC3C,CAAC;CAAA;AAjBD,0BAiBC"}

6
src/controllers/payment.ts

@ -181,7 +181,8 @@ export const listPayments = async (req, res) => {
constants.message_types.direct_payment,
constants.message_types.keysend,
constants.message_types.purchase,
]}
]},
status: {[Op.not]: constants.statuses.failed}
},
{
type: {[Op.or]: [
@ -191,7 +192,8 @@ export const listPayments = async (req, res) => {
amount: {
[Op.gt]: MIN_VAL // greater than
},
network_type: constants.network_types.lightning
network_type: constants.network_types.lightning,
status: {[Op.not]: constants.statuses.failed}
}
],
},

1
src/utils/timers.ts

@ -72,6 +72,7 @@ export async function payBack(t){
message: {id:t.msgId,amount:t.amount},
amount: t.amount,
type: constants.message_types.repayment,
realSatsContactId: t.receiver
})
models.Timer.destroy({where:{id:t.id}})
}

Loading…
Cancel
Save