Skip to content

Commit

Permalink
Merge pull request #11 from DecentralizeJustice/btcpayEarner
Browse files Browse the repository at this point in the history
Btcpay earner
  • Loading branch information
itsMikeLowrey committed Mar 19, 2023
2 parents 96ffd52 + f3bc80d commit 24134f7
Show file tree
Hide file tree
Showing 31 changed files with 1,094 additions and 1,409 deletions.
96 changes: 0 additions & 96 deletions netlify/functions/checkEarnerPaymentStatus.js

This file was deleted.

107 changes: 0 additions & 107 deletions netlify/functions/checkPaymentStatus.js

This file was deleted.

109 changes: 0 additions & 109 deletions netlify/functions/conciergeCheckPaymentStatus.js

This file was deleted.

13 changes: 9 additions & 4 deletions netlify/functions/createBTCPayInvoice.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
const BTCpayKey = process.env.BTCpayKey
const BTCpayStore = process.env.BTCpayStore
const axios = require("axios")

const Joi = require("joi")
exports.handler = async (event, context) => {
const params = event.body
const parsed = JSON.parse(params)

const amount = parsed.amount
const metadata = parsed.metadata
const amountSchema = Joi.number().required().min(0).max(99999)
await amountSchema.validateAsync(amount)

const metadata = Buffer.from(JSON.stringify(parsed.metadata)).toString('base64')
const storeAddress = 'https://btcpay.anonshop.app/api/v1/stores/' + BTCpayStore + '/invoices'
const response = await axios.post(
storeAddress,
{
'amount': amount,
'speedPolicy': 'LowSpeed',
'checkout': {
'paymentMethods': [
'XMR'
],
'redirectURL': 'https://anonshop.app/checkOnOrder',
'redirectURL': 'https://anonshop.app/login',
'redirectAutomatically': true
},
'metadata': metadata
'metadata': { info: metadata}
},
{
headers: {
Expand Down
43 changes: 0 additions & 43 deletions netlify/functions/createPayment.js

This file was deleted.

Loading

0 comments on commit 24134f7

Please sign in to comment.