Merge pull request #1194 from motorina0/save_satspay_webhook_data
feat: store & show `webhook` response body for charges
This commit is contained in:
commit
24c678a283
|
@ -37,7 +37,11 @@ async def call_webhook(charge: Charges):
|
||||||
json=public_charge(charge),
|
json=public_charge(charge),
|
||||||
timeout=40,
|
timeout=40,
|
||||||
)
|
)
|
||||||
return {"webhook_success": r.is_success, "webhook_message": r.reason_phrase}
|
return {
|
||||||
|
"webhook_success": r.is_success,
|
||||||
|
"webhook_message": r.reason_phrase,
|
||||||
|
"webhook_response": r.text,
|
||||||
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to call webhook for charge {charge.id}")
|
logger.warning(f"Failed to call webhook for charge {charge.id}")
|
||||||
logger.warning(e)
|
logger.warning(e)
|
||||||
|
|
|
@ -23,6 +23,7 @@ const mapCharge = (obj, oldObj = {}) => {
|
||||||
charge.displayUrl = ['/satspay/', obj.id].join('')
|
charge.displayUrl = ['/satspay/', obj.id].join('')
|
||||||
charge.expanded = oldObj.expanded || false
|
charge.expanded = oldObj.expanded || false
|
||||||
charge.pendingBalance = oldObj.pendingBalance || 0
|
charge.pendingBalance = oldObj.pendingBalance || 0
|
||||||
|
charge.extra = charge.extra ? JSON.parse(charge.extra) : charge.extra
|
||||||
return charge
|
return charge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,12 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 q-pr-lg">
|
<div class="col-4 q-pr-lg">
|
||||||
<q-badge v-if="props.row.webhook_message" color="blue">
|
<q-badge
|
||||||
|
v-if="props.row.webhook_message"
|
||||||
|
@click="showWebhookResponseDialog(props.row.extra.webhook_response)"
|
||||||
|
color="blue"
|
||||||
|
class="cursor-pointer"
|
||||||
|
>
|
||||||
{{props.row.webhook_message }}
|
{{props.row.webhook_message }}
|
||||||
</q-badge>
|
</q-badge>
|
||||||
</div>
|
</div>
|
||||||
|
@ -528,6 +533,23 @@
|
||||||
</q-form>
|
</q-form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
|
<q-dialog v-model="showWebhookResponse" position="top">
|
||||||
|
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
readonly
|
||||||
|
v-model.trim="webhookResponse"
|
||||||
|
type="textarea"
|
||||||
|
label="Response"
|
||||||
|
></q-input>
|
||||||
|
|
||||||
|
<div class="row q-mt-lg">
|
||||||
|
<q-btn flat v-close-popup color="grey" class="q-ml-auto">Close</q-btn>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
||||||
<!-- lnbits/static/vendor
|
<!-- lnbits/static/vendor
|
||||||
|
@ -669,7 +691,9 @@
|
||||||
data: {
|
data: {
|
||||||
custom_css: ''
|
custom_css: ''
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
showWebhookResponse: false,
|
||||||
|
webhookResponse: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -757,7 +781,6 @@
|
||||||
'/satspay/api/v1/themes',
|
'/satspay/api/v1/themes',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
console.log(data)
|
|
||||||
this.themeLinks = data.map(c =>
|
this.themeLinks = data.map(c =>
|
||||||
mapCSS(
|
mapCSS(
|
||||||
c,
|
c,
|
||||||
|
@ -852,14 +875,12 @@
|
||||||
},
|
},
|
||||||
updateformDialog: function (themeId) {
|
updateformDialog: function (themeId) {
|
||||||
const theme = _.findWhere(this.themeLinks, {css_id: themeId})
|
const theme = _.findWhere(this.themeLinks, {css_id: themeId})
|
||||||
console.log(theme.css_id)
|
|
||||||
this.formDialogThemes.data.css_id = theme.css_id
|
this.formDialogThemes.data.css_id = theme.css_id
|
||||||
this.formDialogThemes.data.title = theme.title
|
this.formDialogThemes.data.title = theme.title
|
||||||
this.formDialogThemes.data.custom_css = theme.custom_css
|
this.formDialogThemes.data.custom_css = theme.custom_css
|
||||||
this.formDialogThemes.show = true
|
this.formDialogThemes.show = true
|
||||||
},
|
},
|
||||||
createTheme: async function (wallet, data) {
|
createTheme: async function (wallet, data) {
|
||||||
console.log(data.css_id)
|
|
||||||
try {
|
try {
|
||||||
if (data.css_id) {
|
if (data.css_id) {
|
||||||
const resp = await LNbits.api.request(
|
const resp = await LNbits.api.request(
|
||||||
|
@ -887,7 +908,6 @@
|
||||||
custom_css: ''
|
custom_css: ''
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('cun')
|
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -955,6 +975,10 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
showWebhookResponseDialog(webhookResponse) {
|
||||||
|
this.webhookResponse = webhookResponse
|
||||||
|
this.showWebhookResponse = true
|
||||||
|
},
|
||||||
exportchargeCSV: function () {
|
exportchargeCSV: function () {
|
||||||
LNbits.utils.exportCSV(
|
LNbits.utils.exportCSV(
|
||||||
this.chargesTable.columns,
|
this.chargesTable.columns,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user