commit
3d65749269
1 changed files with 9 additions and 0 deletions
|
|
@ -199,6 +199,14 @@ export class OfferManager {
|
||||||
if (!userOffer) {
|
if (!userOffer) {
|
||||||
return this.HandleDefaultUserOffer(offerReq, appId, remote)
|
return this.HandleDefaultUserOffer(offerReq, appId, remote)
|
||||||
}
|
}
|
||||||
|
if (userOffer.app_user_id === userOffer.offer_id) {
|
||||||
|
if (userOffer.price_sats !== 0 || userOffer.expected_data) {
|
||||||
|
this.logger("default offer has custom price or expected data, resetting")
|
||||||
|
await this.storage.offerStorage.UpdateUserOffer(userOffer.app_user_id, userOffer.offer_id, { price_sats: 0, expected_data: null })
|
||||||
|
userOffer.price_sats = 0
|
||||||
|
userOffer.expected_data = null
|
||||||
|
}
|
||||||
|
}
|
||||||
let amt = userOffer.price_sats
|
let amt = userOffer.price_sats
|
||||||
if (userOffer.price_sats === 0) {
|
if (userOffer.price_sats === 0) {
|
||||||
if (!amount || isNaN(amount) || amount < 10 || amount > remote) {
|
if (!amount || isNaN(amount) || amount < 10 || amount > remote) {
|
||||||
|
|
@ -208,6 +216,7 @@ export class OfferManager {
|
||||||
}
|
}
|
||||||
const { passed, validated } = this.ValidateExpectedData(userOffer, offerReq.payer_data)
|
const { passed, validated } = this.ValidateExpectedData(userOffer, offerReq.payer_data)
|
||||||
if (!passed) {
|
if (!passed) {
|
||||||
|
console.log("Invalid expected data", validated)
|
||||||
return { success: false, code: 1, max: remote }
|
return { success: false, code: 1, max: remote }
|
||||||
}
|
}
|
||||||
const res = await this.applicationManager.AddAppUserInvoice(appId, {
|
const res = await this.applicationManager.AddAppUserInvoice(appId, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue