карта ПВЗ
All checks were successful
Deploy / build (push) Successful in 2m21s

This commit is contained in:
alsaze
2025-10-17 17:10:14 +03:00
parent 887ea75e8b
commit 2b8a5e5774
10 changed files with 418 additions and 95 deletions

View File

@@ -1,8 +1,8 @@
import https from 'node:https'
import axios from 'axios'
import { defineEventHandler } from 'h3'
import { defineEventHandler, readBody } from 'h3'
export default defineEventHandler(async () => {
export default defineEventHandler(async (event) => {
const merchantId = process.env.BSPB_MERCHANT_ID!
const merchantPassword = process.env.BSPB_MERCHANT_PASSWORD!
const apiUrl = process.env.BSPB_API_URL!
@@ -18,18 +18,9 @@ export default defineEventHandler(async () => {
rejectUnauthorized: false,
})
const data = {
order: {
typeRid: 'Purchase',
amount: 100,
currency: 'RUB',
title: 'Название заказа',
description: 'Описание заказа',
hppRedirectUrl: 'http://localhost:3000/cart',
},
}
const orderData = await readBody(event)
const response = await axios.post(`${apiUrl}/order`, data, {
const response = await axios.post(`${apiUrl}/order`, orderData, {
httpsAgent: agent,
headers: {
'Content-Type': 'application/json',