forked from unimatrix/web
Recover a committed Rihla voucher after lost client response
This commit is contained in:
parent
021f68c602
commit
e56a20c909
2 changed files with 34 additions and 6 deletions
|
|
@ -204,6 +204,13 @@ export function createRihlaCashLedger(bank,{readReceipt,postbank,clock=Date.now}
|
|||
|
||||
return async (actor,input)=>{
|
||||
if(!validUuid(input.uuid))fail('Invalid native cash identity.');
|
||||
if(input.action==='cash_recent_deposit'){
|
||||
const deposit=await bank.first(`SELECT o.voucher FROM ria_cash_operations o
|
||||
LEFT JOIN ria_cash_redemptions r ON r.voucher=o.voucher
|
||||
WHERE o.owner_id=? AND o.player_uuid=? AND o.direction='deposit' AND o.state='committed' AND r.id IS NULL
|
||||
ORDER BY o.created_at DESC,o.id DESC LIMIT 1`,[actor.id,input.uuid]);
|
||||
return {ok:true,voucher:deposit?.voucher??null};
|
||||
}
|
||||
if(input.action==='cash_lookup')return voucher(actor,input);
|
||||
if(!NATIVE_SERVERS.includes(input.server))fail('Invalid native cash server.');
|
||||
if(input.action==='cash_pending')return pending(actor,input);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export function createGameRihlaAPI(central,bank,settings={},deps={}){
|
|||
create:['action','uuid','amount','recipientUuid','quoteReference','requestId'],
|
||||
cancel:['action','uuid','number'],collect:['action','uuid','number'],collectAll:['action','uuid'],
|
||||
cash_prepare:['action','uuid','server','requestId','direction','pieces'],cash_pending:['action','uuid','server'],
|
||||
cash_settle:['action','uuid','server','requestId'],cash_prepare_abort:['action','uuid','server','requestId'],cash_lookup:['action','uuid','voucher'],
|
||||
cash_settle:['action','uuid','server','requestId'],cash_prepare_abort:['action','uuid','server','requestId'],cash_lookup:['action','uuid','voucher'],cash_recent_deposit:['action','uuid'],
|
||||
cash_redeem_bank:['action','uuid','server','requestId','voucher'],
|
||||
cash_redeem_cash:['action','uuid','server','requestId','voucher','direction','pieces']
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff