#🔒 Variable problem
64 messages · Page 1 of 1 (latest)
@wispy mountain
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
instead of changing this status variable, why not call a function to do this?
you can have the function update the status as well if you still need that
What's the context here? Are threads being used?
Can you show a example?
Can you explain?
I cant understand
Can you share the code you've written?
@bot.hybrid_command()
async def test(ctx: commands.Context, value, description):
payment = Payment.create({
"amount": {
"value": value,
"currency": "RUB"
},
"confirmation": {
"type": "redirect",
"return_url": "https://discord.com/channels/1218919938442395669/1218942092643143712"
},
"capture": True,
"description": description
}, uuid.uuid4())
confirmation_url = payment.confirmation.confirmation_url
link_button = Button(
style=discord.ButtonStyle.link,
label="Перейти к оплате",
url=confirmation_url,
)
# Create a view to hold the button
orderview = View()
orderview.add_item(link_button)
await ctx.send("Оплатите здесь, чтобы создать заказ", ephemeral=True, view=orderview)
Payment.capture(payment_id=payment.id)
Ah, discord.
Payment.status
Yes
And what sets that variable?
The payment status on payment site
I can send you a API for this library
is the payment service using a callback url?
I just don't really understand what you're talking about
I can send you a library API
package
I can't access that site
Do you have VPN?
Try to use VPN with Russia country
no.
How i can show you a class?
Anyway, the return url probably wants a site you control, not discord.
you can handle the callback by setting something in a service like redis or rabbitmq. You can use aioredis to wait for an event to be set.
!pip aioredis
Status sets automaticaly without any code.
is Payment.capture blocking?
!pip redis This is actually built into the standard redis client now
I just need a code where this variable checks and then the vatiable is succeeded bot send a message with order number
My first thought is to use asyncio.Event
You'll need to inspect how Payment.capture works to set the status variable.
He send a payment object
using requests?
Example of the object
{
"id": "2419a771-000f-5000-9000-1edaf29243f2",
"status": "pending",
"paid": false,
"amount": {
"value": "100.00",
"currency": "RUB"
},
"confirmation": {
"type": "redirect",
"confirmation_url": "https://yoomoney.ru/api-pages/v2/payment-confirm/epl?orderId=2419a771-000f-5000-9000-1edaf29243f2"
},
"created_at": "2019-03-12T11:10:41.802Z",
"description": "Заказ №37",
"metadata": {
"order_id": "37"
},
"recipient": {
"account_id": "100500",
"gateway_id": "100700"
},
"refundable": false,
"test": false
}
How you can see the object have a status
if there's no callback url, keep querying it until it says success
I'm not familiar with the api and can't access the docs. Do they have any examples?
How i can do that?
No. They have only a Payment.capture which have a this object
How i can check it?
no idea.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.