This file contains hidden or 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
<?php | |
namespace App\Service\Api; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |
use GuzzleHttp\Client; | |
use GuzzleHttp\Cookie\CookieJar; | |
use GuzzleHttp\Exception\RequestException as GuzzleRequestException; | |
use App\Model\Exception\RequestException; |
This file contains hidden or 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
<?php | |
namespace App\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use App\Model\DTO\StripeProcessSubscriptionDTO; | |
use App\Service\StripeProcessSubscription; |
This file contains hidden or 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
<?php | |
namespace App\Service | |
use App\Model\DTO\StripeProcessSubscriptionDTO; | |
use App\Repository\StripePlanRepository; | |
use App\Service\StripeCreateCustomer; | |
use App\Service\StripeCreateSubscription; | |
final class StripeProcessSubscription { |
This file contains hidden or 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
<?php | |
namespace App\Service; | |
use Stripe\Stripe; | |
use Stripe\Subscription; | |
final class StripeCreateSubscription { | |
/** |
This file contains hidden or 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
<?php | |
namespace App\Service; | |
use Stripe\Stripe; | |
use Stripe\Customer; | |
final class StripeCreateCustomer { | |
/** |
This file contains hidden or 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
{% extends 'base.html.twig' %} | |
{% block body %} | |
{% for stripePlan in stripePlans %} | |
<div> | |
<form action="{{ path('stripe_subscription_process') }}" method="POST"> | |
<script | |
src="https://checkout.stripe.com/checkout.js" class="stripe-button" |
This file contains hidden or 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
<?php | |
namespace App\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\Response; | |
use App\Repository\StripePlanRepository; | |
class ChooseSubscriptionController extends AbstractController { |
This file contains hidden or 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
stripe_choose_subscription: | |
path: /u/stripe/choose-subscription | |
controller: App\Controller\ChooseSubscriptionController | |
stripe_process_subscription: | |
path: /u/stripe/process-subscription | |
controller: App\Controller\ProcessSubscriptionController |
This file contains hidden or 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
<?php | |
namespace App\Service; | |
final class StripeUtils { | |
/** | |
* Converts an amount in format 20.123 to string 2012 | |
* | |
* @param float $amount |
This file contains hidden or 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
<?php | |
namespace App\Model\DTO; | |
class StripeCreatePlanDTO { | |
private $currency; | |
private $interval; | |
private $amount; | |
private $productId; |