<?php
declare(strict_types=1);require __DIR__.'/native.php';require __DIR__.'/decimal-oracle.php';ck($lane==='B'&&!file_exists($runtime.'/B-retry-preconditions.json'),'B prepay retry prerequisites once');$prepared=json_decode(file_get_contents($runtime.'/prepared.json'),true);$guard=json_decode(file_get_contents($runtime.'/guard.json'),true);$z=readNative('ZHCT','SELECT COUNT(*) n FROM ydy_meal_order WHERE id=? OR order_no=?',[68496,'261011086705426']);ck((int)$z[0]['n']===0,'Rolled-back original order ID/no absent');$prepay=readNative('ZHCT','SELECT * FROM ydy_prepay_order WHERE id=?',[$prepared['ids']['STORE_P1']]);ck($prepay===[$prepared['rows']['STORE_P1']],'Prepay complete original value lease');$cash=readNative('AI','SELECT CAST(balance AS CHAR) balance_text,CAST(gift_balance AS CHAR) gift_text,CAST(pay_money AS CHAR) pay_text FROM yoshop_user WHERE user_id=?',[$prepared['ids']['AI_U1']]);ck(dec102text($cash[0]['balance_text'])==='1.00'&&dec102text($cash[0]['gift_text'])==='0.00'&&dec102text($cash[0]['pay_text'])==='0.00','B cash/pay full original lease');$old=oldProtection();ck($old===$guard['old_protection'],'Old fullrow preserved after failed HTTP');saveOnce('B-retry-preconditions.json',['rolled_order_count'=>$z,'prepay_fullrow'=>$prepay,'cash_text_raw'=>$cash,'old_protection'=>$old,'HTTP'=>0,'DML'=>0]);echo json_encode(['lane'=>$lane,'rolled_order_id_no_absent'=>true,'prepay_original'=>true,'cash'=>'1.00','old_protection_equal'=>true]),"\n";
