This commit is contained in:
parent
b5091d2a16
commit
3c41b7d9a1
@ -1,20 +1,20 @@
|
|||||||
import fs from 'node:fs'
|
|
||||||
import https from 'node:https'
|
import https from 'node:https'
|
||||||
import path from 'node:path'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { defineEventHandler } from 'h3'
|
import { defineEventHandler } from 'h3'
|
||||||
import bspbKey from '~/server/cert/pgtest_key.key?raw'
|
|
||||||
import bspbCert from '~/server/cert/pgtest_cer_2025.pem?raw'
|
|
||||||
|
|
||||||
export default defineEventHandler(async () => {
|
export default defineEventHandler(async () => {
|
||||||
const merchantId = process.env.BSPB_MERCHANT_ID!
|
const merchantId = process.env.BSPB_MERCHANT_ID!
|
||||||
const merchantPassword = process.env.BSPB_MERCHANT_PASSWORD!
|
const merchantPassword = process.env.BSPB_MERCHANT_PASSWORD!
|
||||||
const apiUrl = process.env.BSPB_API_URL!
|
const apiUrl = process.env.BSPB_API_URL!
|
||||||
|
|
||||||
|
const assetsStorage = useStorage('assets:server')
|
||||||
|
|
||||||
|
const bspbKey = await assetsStorage.getItem<string>('pgtest_key.key')
|
||||||
|
const bspbCert = await assetsStorage.getItem<string>('pgtest_cer_2025.pem')
|
||||||
|
|
||||||
const agent = new https.Agent({
|
const agent = new https.Agent({
|
||||||
key: bspbKey,
|
key: bspbKey!,
|
||||||
cert: bspbCert,
|
cert: bspbCert!,
|
||||||
rejectUnauthorized: false, // ⚠️ только для теста!
|
rejectUnauthorized: false, // ⚠️ только для теста!
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user