Skip to content

Commit 24134f7

Browse files
Merge pull request #11 from DecentralizeJustice/btcpayEarner
Btcpay earner
2 parents 96ffd52 + f3bc80d commit 24134f7

31 files changed

Lines changed: 1094 additions & 1409 deletions

netlify/functions/checkEarnerPaymentStatus.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

netlify/functions/checkPaymentStatus.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

netlify/functions/conciergeCheckPaymentStatus.js

Lines changed: 0 additions & 109 deletions
This file was deleted.

netlify/functions/createBTCPayInvoice.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
const BTCpayKey = process.env.BTCpayKey
22
const BTCpayStore = process.env.BTCpayStore
33
const axios = require("axios")
4-
4+
const Joi = require("joi")
55
exports.handler = async (event, context) => {
66
const params = event.body
77
const parsed = JSON.parse(params)
8+
89
const amount = parsed.amount
9-
const metadata = parsed.metadata
10+
const amountSchema = Joi.number().required().min(0).max(99999)
11+
await amountSchema.validateAsync(amount)
12+
13+
const metadata = Buffer.from(JSON.stringify(parsed.metadata)).toString('base64')
1014
const storeAddress = 'https://btcpay.anonshop.app/api/v1/stores/' + BTCpayStore + '/invoices'
1115
const response = await axios.post(
1216
storeAddress,
1317
{
1418
'amount': amount,
19+
'speedPolicy': 'LowSpeed',
1520
'checkout': {
1621
'paymentMethods': [
1722
'XMR'
1823
],
19-
'redirectURL': 'https://anonshop.app/checkOnOrder',
24+
'redirectURL': 'https://anonshop.app/login',
2025
'redirectAutomatically': true
2126
},
22-
'metadata': metadata
27+
'metadata': { info: metadata}
2328
},
2429
{
2530
headers: {

netlify/functions/createPayment.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)