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/apay/api/v1/session';
const { url, domain, title } = event.body;
console.log(event.body);
const body = {
key: key,
resource: resource,
nonce: process.hrtime().toString().replace(",", ""),
mode: "sha256",
payload: {
url: url,
domain: domain,
title: title
}
}
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(data);
$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)