auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const axios = require('axios');
const crypto = require("crypto");
// IMPORTANTE: Personalizar por el comercio
const key = 'key';
const resource = 'resource';
const secret = 'secret';
// Fin de personalización del comercio
const endpoint = 'https://sandbox.sipay.es/mdwr/v1/authorization';
const { token, request_id } = event.body;
const body = {
key: key,
resource: resource,
nonce: process.hrtime().toString().replace(",", ""),
mode: "sha256",
payload: {
amount: 10,
currency: 'EUR',
catcher: {
type: 'apay',
token_apay: token,
request_id: request_id
}
}
}
const response = await axios({
method: 'POST',
url: endpoint,
headers: {
'Content-Signature': crypto.createHmac('sha256', secret).update(JSON.stringify(body)).digest("hex"),
'Content-Type': 'application/json'
},
data: body,
});
const { data } = response;
console.log(body);
$checkpoint = data;
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
await $respond({
status: 200,
immediate: true,
body: $checkpoint
})
async
params => {
}
$end(params.reason)