Ctrlpanel-gg / panel

CtrlPanel offers an easy-to-use and free billing solution for all starting and experienced hosting providers that seamlessly integrates with the Pterodactyl panel.
https://ctrlpanel.gg/
MIT License
408 stars 146 forks source link

feat: CryptoBot payments #940

Open gru2007 opened 5 months ago

gru2007 commented 5 months ago

I’m just adding new optional payment method

what is it? - https://help.crypt.bot/crypto-pay-api

MrWeez commented 5 months ago

Hi! It looks very cool, but could you change the Russian localization to English? Thank you for helping to improve cpgg ❤️

gru2007 commented 5 months ago

Only one thing, for some reason money doesn’t add after sending event with payment. So I added this construction:

try {
            $user->increment('credits', $payment->amount);
        } catch (Exception $exception) {
            throw $exception;
        }

I’m sure, that it is not right way to do that. I don’t know what happens in your code.

gru2007 commented 5 months ago

Hi! It looks very cool, but could you change the Russian localization to English? Thank you for helping to improve cpgg ❤️

Oh sorry, I have missed that. Couple minutes.

1day2die commented 5 months ago

awesome!

1day2die commented 5 months ago

Only one thing, for some reason money doesn’t add after sending event with payment. So I added this construction:

try {
            $user->increment('credits', $payment->amount);
        } catch (Exception $exception) {
            throw $exception;
        }

I’m sure, that it is not right way to do that. I don’t know what happens in your code.

@IceToast mind checking this?

IceToast commented 5 months ago

So i see you've created a extension with all the necessary information. I will sketch out the payment workflow:

User payment request -> URL fetching from extension -> Redirecting to payment URL -> ... -> Success redirection to success route of extension -> done

Gateway Webhook -> request to extension webhook route -> sets a payment as "paid" -> emits a user payment event -> payment listener updates user credits and possibly any new limits -> done

The first thing i noticed is that you might want to validate that the webhook request actually wants to update a payment to the PAID status. In your PR it will set it to PAID under any circumstances? Maybe im missing something about the gateway.

For your problem: You should debug into CryptoBotExtension.php:110 to see whether the event really gets triggered and what da parameters are. If everything is processed correctly the event will be listened to in here: Listeners/UserPayment.php

gru2007 commented 5 months ago

@IceToast Thanks, I will come back with result soon.

MrWeez commented 4 months ago

@gru2007 Is there any news about fixes?

gru2007 commented 4 months ago

@gru2007 Is there any news about fixes?

Excuse me for afk, I just haven’t enough time to solve that right now. I’ll do it in near future.

MrWeez commented 4 months ago

@gru2007 Is there any news about fixes?

Excuse me for afk, I just haven’t enough time to solve that right now. I’ll do it in near future.

Ok, no problem

S0ly commented 2 months ago

updated the branch @gru2007 any news ? :)

S0ly commented 2 months ago

damn good review

MrWeez commented 2 months ago

damn good review

I decided to double-check this PR so that there would be no problems in the future

S0ly commented 3 weeks ago

any update ?

S0ly commented 1 week ago

if there is no update soon this PR will be closed