Мой код для создания кошелька с помощью REST API для создания компоновщика гиперлогов:
async function walletCreation(tx) {
var userId = {
userId: tx.userId,
};
var walletPassword = {
walletPassword: tx.walletPassword,
};
const encryptWalletId = await request.post({ uri:
'http://payment.api.in/encrypt', json: userId });
const encryptWalletPassword = await request.post({ uri:
'http://payment.api.in/encryptPass', json: walletPassword });
return getAssetRegistry('com.payment.UserWallet')
.then(function (userAssetRegistry) {
// Get the factory for creating new asset instances.
var factory = getFactory();
// Create the wallet.
tx.walletId = encryptWalletId.walletId;
var walletAsset = factory.newResource('com.payment', 'UserWallet',
tx.walletId);
walletAsset.userId = tx.userId;
walletAsset.walletPassword = encryptWalletPassword.walletPassword;
walletAsset.currency = tx.currency;
walletAsset.walletBalance = 0;
walletAsset.createdDate = new Date();
userAssetRegistry.add(walletAsset);
})
.catch(function (error) {
throw new Error("wallet creation failed");
});
}
Ниже приведено тело запроса (ввод Swagger) для создания кошелька.
:
{
"$class": "com.payment.WalletCreation",
"userId": "Hari",
"walletPassword": "hari@123",
"currency": "INR",
"walletBalance": 0
}
Ниже приведен ожидаемый ответ для вышеуказанного ввода:
{
"$class": "com.payment.WalletCreation",
"userId": "Hari",
"status":"Wallet creation successfully",
"WalletId":"1234567asder",
"walletId": 0,
"walletPassword": "hari@123",
"currency": "INR",
"walletBalance": 0,
"transactionId":
"deee486e2e74647635e53e316f2a8e1b71ab500e9dd3bf15945665a4025fc208"
}
Но это то, что я получаю в ответ
{
"$class": "com.payment.WalletCreation",
"userId": "Hari",
"walletPassword": "hari@123",
"currency": "INR",
"walletBalance": 0,
"transactionId":
"deee486e2e74647635e53e316f2a8e1b71ab500e9dd3bf15945665a4025fc208"
}
Пожалуйста, помогите мне исправить это, застрял на 2 дня, не может исправить ошибку