my issue is that I am defining transaction in model file and then using it in js script but it throws an error " Error: Could not find any functions to execute for transaction." when i try to execute.It occurs during testing of the code
my mode file /** * New model file */
/**
* New model file
*/
namespace org.acme.bank
participant accountholder identified by bankid
{
o String bankid
o String firstname
o String lastname
o String address
}
asset acount identified by accno
{
o String accno
o String balance
-->accountholder customer1
}
transaction amountTransfer
{
o String tid
o String amount
-->acount owner1
-->acount owner2
}
my script.js
/**
* Track the trade of a commodity from one trader to another
* @param {org.acme.bank.amountTransfer} Transfer - to trade
* @transactiton
*/
function Transfer(Transfer)
{
var amount1=Transfer.owner1.balance
var amount2=Transfer.owner2.balance
if(Transfer.amount>amount1)
{
return 0;
}else
{
owner1.balance-=Transfer.amount
owner2.balance+=Transfer.amount
return getAssetRegistry('org.acme.bank.acount')
.then(function (assetRegistry) {
return assetRegistry.update(Transfer.owner1);
}).then(function () {
return getAssetRegistry('org.acme.bank.acount');
}).then(function (assetRegistry) {
return assetRegistry.update(Transfer.owner2);
});
}
}
thank you in advance