Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement telegram payments #392

Closed
wants to merge 7 commits into from
Closed

implement telegram payments #392

wants to merge 7 commits into from

Conversation

pou
Copy link
Contributor

@pou pou commented Jul 5, 2023

Usage

$token = config('telegraph.payments.token');
$currency = config('telegraph.payments.currency');
$orderId = 2;

$invoice = new Invoice();
$invoice->providerToken = $token;
$invoice->currency = $currency;
$invoice->title = 'Title';
$invoice->description = 'Description';
$invoice->payload = json_encode([
    'order_id' => $orderId,
]);

$price = new LabeledPrice();
$price->label = 'Order';
$price->amount = 10000;
$invoice->prices = [
    $price,
];

/** @var TelegraphChat $chat */
$chat = TelegraphChat::find(1);

$chat->invoice($invoice, function (PreCheckoutQuery $data) use ($orderId) {
    $payload = json_decode($data->invoicePayload, false);
    
    return $payload->order_id === $orderId;
})->send();

@fabio-ivona
Copy link
Member

Thanks @pou for your contribution

I'll take the time to fully review your work, will update soon!

@fabio-ivona
Copy link
Member

Meanwhile, would you mind to fix failing tests?

pou added 3 commits July 6, 2023 23:06
Changed the Closure serialization package used in TelegraphChat model from Opis to Laravel's SerializableClosure. This switch was necessary to maintain compatibility with newer versions of Laravel, as well as ensuring better functionality and stability of closure serialization. Additionally, the composer.json file was updated accordingly to reflect this change.
Deleted HandlesConversations.php and composer.json from telegraph/src directory. These files were not being used in the current implementation and were causing confusion and unnecessary clutter.
@fabio-ivona
Copy link
Member

fabio-ivona commented Aug 12, 2023

no plans for this for now, sorry, I need to tinker with the payment API in order to gain a full understanding of it before accepting a PR for such a sensible feature

@pou
Copy link
Contributor Author

pou commented Aug 14, 2023

it's a pity

@pou pou mentioned this pull request Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants