mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-30 18:02:31 +00:00
fix: LS webhook order_number
This commit is contained in:
parent
a1973a0b81
commit
d98c53d349
@ -37,7 +37,7 @@ routerAdd('POST', '/api/ls', (c) => {
|
|||||||
data: {
|
data: {
|
||||||
type,
|
type,
|
||||||
attributes: {
|
attributes: {
|
||||||
order_id,
|
order_number,
|
||||||
product_name,
|
product_name,
|
||||||
product_id,
|
product_id,
|
||||||
status,
|
status,
|
||||||
@ -46,9 +46,9 @@ routerAdd('POST', '/api/ls', (c) => {
|
|||||||
},
|
},
|
||||||
} = data
|
} = data
|
||||||
|
|
||||||
log({ user_id, order_id, product_name, product_id, status, email })
|
log({ user_id, order_number, product_name, product_id, status, email })
|
||||||
|
|
||||||
if (status !== `active`) {
|
if (![`active`, `paid`].includes(status)) {
|
||||||
audit({ email, event: `LS_ERR` }, `Unsupported status ${status}: ${raw}`)
|
audit({ email, event: `LS_ERR` }, `Unsupported status ${status}: ${raw}`)
|
||||||
return c.json(500, { status: 'unsupported status' })
|
return c.json(500, { status: 'unsupported status' })
|
||||||
} else {
|
} else {
|
||||||
@ -62,11 +62,11 @@ routerAdd('POST', '/api/ls', (c) => {
|
|||||||
log(`user ID ok`, user_id)
|
log(`user ID ok`, user_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!order_id) {
|
if (!order_number) {
|
||||||
audit({ email, event: `LS_ERR` }, `No order ID: ${raw}`)
|
audit({ email, event: `LS_ERR` }, `No order #: ${raw}`)
|
||||||
return c.json(500, { status: 'no order ID' })
|
return c.json(500, { status: 'no order #' })
|
||||||
} else {
|
} else {
|
||||||
log(`order ID ok`, order_id)
|
log(`order # ok`, order_number)
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = (() => {
|
const user = (() => {
|
||||||
@ -117,7 +117,7 @@ routerAdd('POST', '/api/ls', (c) => {
|
|||||||
const collection = $app.dao().findCollectionByNameOrId('payments')
|
const collection = $app.dao().findCollectionByNameOrId('payments')
|
||||||
const payment = new Record(collection, {
|
const payment = new Record(collection, {
|
||||||
user: user_id,
|
user: user_id,
|
||||||
payment_id: `ls_${order_id}`,
|
payment_id: `ls_${order_number}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user