Apply this algorithm only if at least one condition is met:
CryptomusHeleketCryptomus / HeleketTV Team it is already obvious that the disputed payment relates to psId=24General words like crypto, txid, hash, address, network, wallet do not by themselves choose Heleket / Cryptomus.
If the user did not name the exact PS, you need to clarify first: is it TON / USDT TON, Cryptomus, Plisio or some other method of payment.
If the user explicitly talks about TON / USDT TON, do not apply this algorithm.
Payment system in TV Team: Cryptomus All Crypto [ BONUS +3% ] (psId=24).
paid, paid_over, wrong_amount, check, process, confirm_check, cancel, failpaid_over = provider has received more than the billwrong_amount = provider received the wrong amount / less than expectedTV Team can recalculate the amount by the actual received cryptoUUID already exists in TV Team, a repeated resend should not be promised as a way of automatic replenishment of the balance for an already existing caseFirst understand if the Heleket / Cryptomus branch is chosen.
If the branch is not yet selected, ask briefly:
TON / USDT TON, Cryptomus, Plisio or another methodIf the branch is already selected as Heleket / Cryptomus, collect from the user:
UUID, order_id, link to payment or screenshotThe 30-minute rule: if less than 30 minutes have passed since the payment — ask to wait. Crypto payments may not arrive immediately.
Call get_current_datetime to correctly apply the 30-minute rule and not make a mistake with the request date.
TV TeamThis is the initial check before delving into the external provider.
Call api_request with apiAction=getLastPayments and user's userLogin.
If necessary, also check apiAction=getUserBalance.
It is necessary to record:
TV TeampaymentIdpsPaymentId / UUIDTV TeampaymentStatusHeleketUUID or order_idFirst call heleket_lookup with action=info.
This is the priority way to check.
UUID does not existapi_request with apiAction=getUserId and user's userLogin.heleket_lookup with action=list, from_date, to_date and user's user_login.Show the user all his orders for this day: uuid, order_id, amount, status, creation date.
Let him clarify which order is his.
If there are no orders — it means the payment was not made through Cryptomus / Heleket or the date is chosen incorrectly.
UUID or order_id by themselves do not prove that it is their paymentUUID / order_id, bot should not automatically reveal status, amount, txid, details paid_over / wrong_amount and should not count such payment as his confirmedTV Team for the same userHeleket list by user_login and date among his ordersTV Teammoderator_flowcheck / process / confirm_checkPayment is still being processed. Tell the user that they need to wait.
cancel / failPayment has been cancelled or failed. Tell the user that there is no deposit and they need to pay again.
paidTV Team or paymentStatus=0 — you can call heleket_resend, wait ~60 seconds and check TV Team againpaymentStatus=1 — announce that the payment has already been creditedwrong_amountAlways compare three facts:
invoice_amount_usd — how much was on the billprovider_amount_usd — how much the provider receivedTV TeamIf there's no record in TV Team or paymentStatus=0:
heleket_resendIf the record already exists in TV Team:
UUIDTV Teampaid_overAlways compare three facts:
invoice_amount_usd — how much was in the billprovider_amount_usd — how much the provider actually receivedTV TeamIf there's no record in TV Team or paymentStatus=0:
heleket_resend call to complete the initial depositTV Team againIf the record already exists in TV Team:
resend will automatically credit an overpayment for an already existing paymentPersonal Account, and for the balance / overpayment, you need to contact the moderatorwrong_amountShould write in the sense of:
XXTV Team credited Zpaid_overShould write in the sense of:
TV Team credited ZPersonal AccountShow the moderator a short work summary:
UUIDorder_idinvoice_amount_usdprovider_amount_usdTV Teamresend make sense or is manual analysis already neededDo not call the difference a guaranteed amount of manual replenishment if it is not directly confirmed by billing.
First show separately the provider's amount and the amount in TV Team.
UUID / order_id first use action=info, not the general listpaid_over and wrong_amount — regular cases, not an API errornothing was found until you've checked info by UUID or full list by date and userresend only for paid, paid_over, wrong_amountresend always recheck TV Team, don't just take the provider's word for itTV Team, do not promise automatic replenishment of the balance for the same UUID