-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6903849
commit d1b2d38
Showing
12 changed files
with
239 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Please add this in your .env global | ||
STRIPE_ENDPOINT=XXXX | ||
STRIPE_SECRET=XXXX | ||
STRIPE_PUBLIC=XXXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
Merci d'avoir acheté le module Stripe ! | ||
# Stripe Module | ||
### English | ||
|
||
Il vous suffit de glisser ces fichiers dans la racine de ClientX ! | ||
![Stripe logo](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSQFZVtgqQoU3xMNDMfYzfbAyC2LZJt_MwtHmJANd1MqAC4jjDpBY0opV2uR9FPL2V0qkA&usqp=CAU "Stripe logo") | ||
|
||
Ajoutez la ligne ->addModule(StripeModule::class) dans index.php | ||
The entire CLIENTXCMS team thanks you for this purchase. We hope you like it. | ||
|
||
Puis rendez-vous dans Bases de Données dans l'espace Administration de ClientX puis faites Migrate. | ||
To install this module please refer to the documentation. | ||
|
||
Le tour est joué et vous avez maintenant accès au module Stripe. | ||
## Support & Documentation # | ||
|
||
For any questions regarding this module, you should contact the CLIENTXCMS service support: | ||
|
||
- https://clientxcms.com/client/support Technical support | ||
- https://clientxcms.com/docs/en/stripe Official documentation | ||
- https://clientxcms.com/discord Community discord | ||
|
||
|
||
CLIENTXCMS, Customer manager, easy billing made for everyone. | ||
|
||
|
||
### French | ||
Toute l'équipe de CLIENTXCMS vous remercie pour cette achat. Nous espérons que celui la vous plaisent. | ||
|
||
Pour installer ce module veuillez vous référez à la documentation. | ||
|
||
# Support & Documentation # | ||
Pour toutes questions par rapport à ce module, vous devez vous adressez au support du service de CLIENTXCMS : | ||
- https://clientxcms.com/client/support Support technique | ||
- https://clientxcms.com/docs/fr/stripe documentation Officiel | ||
- https://clientxcms.com/discord Discord communautaire | ||
|
||
CLIENTXCMS, Customer manager, easy billing made for everyone. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Please add this in your .env global | ||
STRIPE_ENDPOINT=XXXX | ||
STRIPE_SECRET=XXXX | ||
STRIPE_PUBLIC=XXXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
<?php | ||
namespace App\Stripe\Actions; | ||
|
||
use App\Stripe\Database\StripeTable; | ||
use ClientX\Actions\Action; | ||
use ClientX\Renderer\RendererInterface; | ||
use ClientX\Actions\Payment\PaymentAdminAction; | ||
|
||
class StripeAdminAction extends Action { | ||
class StripeAdminAction extends PaymentAdminAction | ||
{ | ||
|
||
/** | ||
* @var StripeTable | ||
*/ | ||
private $table; | ||
|
||
public function __construct(RendererInterface $renderer, StripeTable $table) | ||
{ | ||
$this->renderer = $renderer; | ||
$this->table = $table; | ||
} | ||
|
||
public function __invoke() | ||
{ | ||
return $this->render('@stripe_admin/index', ['items' => $this->table->findAll()]); | ||
} | ||
} | ||
protected $routePrefix = "stripe.admin"; | ||
protected $moduleName = "Stripe"; | ||
protected $paymenttype = "stripe"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,45 @@ | ||
<?php | ||
namespace App\Stripe\Actions; | ||
|
||
use App\Shop\Database\InvoiceTable; | ||
use \App\Stripe\Api\Stripe; | ||
use App\Stripe\Database\StripeTable; | ||
use App\Auth\Database\UserTable; | ||
use App\Shop\Entity\Transaction; | ||
use App\Shop\Services\TransactionService; | ||
use App\Stripe\StripePaymentManager; | ||
use ClientX\Actions\Action; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
class StripeApiAction { | ||
|
||
/** | ||
* @var Stripe | ||
*/ | ||
private $stripe; | ||
|
||
/** | ||
* @var StripeTable | ||
*/ | ||
private $table; | ||
|
||
/** | ||
* @var InvoiceTable | ||
*/ | ||
private $invoiceTable; | ||
|
||
public function __construct(Stripe $stripe, StripeTable $table, InvoiceTable $invoiceTable) | ||
class StripeApiAction extends Action | ||
{ | ||
private UserTable $user; | ||
private StripePaymentManager $manager; | ||
private TransactionService $transaction; | ||
public function __construct(StripePaymentManager $manager, TransactionService $transaction, UserTable $user) | ||
{ | ||
$this->stripe = $stripe; | ||
$this->table = $table; | ||
$this->invoiceTable = $invoiceTable; | ||
$this->manager = $manager; | ||
$this->transaction = $transaction; | ||
$this->user = $user; | ||
} | ||
|
||
public function __invoke(ServerRequestInterface $request) | ||
{ | ||
$signature = $request->getServerParams()["HTTP_STRIPE_SIGNATURE"]; | ||
$webhook = $this->stripe->getWebhook($signature); | ||
if ($webhook->type === 'checkout.session'){ | ||
$object = $webhook->data->object; | ||
$id = $object->metadata->invoice; | ||
if ($object->payment_status !== "paid"){ | ||
$this->invoiceTable->updateStatus(0, $id); | ||
} | ||
$this->invoiceTable->update($id, [ | ||
'paymentId' => $object->id | ||
]); | ||
$this->table->createTransaction($webhook); | ||
var_dump($webhook); | ||
$webhook = $this->manager->getWebhook($request->getServerParams()['HTTP_STRIPE_SIGNATURE']); | ||
$object = $webhook->data->object; | ||
if (empty($object->metadata) === false){ | ||
|
||
$response = $this->manager->confirm($request); | ||
return $this->json(['success' => $response instanceof Transaction]); | ||
} | ||
$id = $object->metadata->transaction; | ||
|
||
$userId = $object->metadata->user; | ||
|
||
$user = $this->user->find($userId); | ||
$transaction = $this->transaction->findTransaction($id); | ||
if ($transaction != null && $transaction->getState() === $transaction::PENDING) { | ||
$response = $this->manager->test($transaction, $request, $user); | ||
return $this->json(['success' => $response instanceof Transaction]); | ||
} | ||
return $this->json(['error' => true]); | ||
|
||
die(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.