-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from FLUX-SE/stripe-price-api
Stripe price api
- Loading branch information
Showing
28 changed files
with
494 additions
and
111 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,21 +8,25 @@ | |
use FluxSE\SyliusPayumStripePlugin\Provider\DetailsProvider; | ||
use FluxSE\SyliusPayumStripePlugin\Provider\DetailsProviderInterface; | ||
use FluxSE\SyliusPayumStripePlugin\Provider\LineItemsProviderInterface; | ||
use FluxSE\SyliusPayumStripePlugin\Provider\ModeProviderInterface; | ||
use FluxSE\SyliusPayumStripePlugin\Provider\PaymentMethodTypesProviderInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Stripe\Checkout\Session; | ||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
final class DetailsProviderSpec extends ObjectBehavior | ||
{ | ||
public function let( | ||
CustomerEmailProviderInterface $customerEmailProvider, | ||
LineItemsProviderInterface $lineItemsProvider, | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider, | ||
ModeProviderInterface $modeProvider | ||
): void { | ||
$this->beConstructedWith( | ||
$customerEmailProvider, | ||
$lineItemsProvider, | ||
$paymentMethodTypesProvider | ||
$paymentMethodTypesProvider, | ||
$modeProvider | ||
); | ||
} | ||
|
||
|
@@ -36,14 +40,17 @@ public function it_get_full_details( | |
OrderInterface $order, | ||
CustomerEmailProviderInterface $customerEmailProvider, | ||
LineItemsProviderInterface $lineItemsProvider, | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider, | ||
ModeProviderInterface $modeProvider | ||
): void { | ||
$customerEmailProvider->getCustomerEmail($order)->willReturn('[email protected]'); | ||
$lineItemsProvider->getLineItems($order)->willReturn([]); | ||
$paymentMethodTypesProvider->getPaymentMethodTypes($order)->willReturn(['card']); | ||
$modeProvider->getMode($order)->willReturn(Session::MODE_PAYMENT); | ||
|
||
$this->getDetails($order)->shouldReturn([ | ||
'customer_email' => '[email protected]', | ||
'mode' => Session::MODE_PAYMENT, | ||
'line_items' => [], | ||
'payment_method_types' => ['card'], | ||
]); | ||
|
@@ -53,12 +60,16 @@ public function it_get_minimum_details( | |
OrderInterface $order, | ||
CustomerEmailProviderInterface $customerEmailProvider, | ||
LineItemsProviderInterface $lineItemsProvider, | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider | ||
PaymentMethodTypesProviderInterface $paymentMethodTypesProvider, | ||
ModeProviderInterface $modeProvider | ||
): void { | ||
$customerEmailProvider->getCustomerEmail($order)->willReturn(null); | ||
$lineItemsProvider->getLineItems($order)->willReturn(null); | ||
$paymentMethodTypesProvider->getPaymentMethodTypes($order)->willReturn([]); | ||
$modeProvider->getMode($order)->willReturn(Session::MODE_PAYMENT); | ||
|
||
$this->getDetails($order)->shouldReturn([]); | ||
$this->getDetails($order)->shouldReturn([ | ||
'mode' => Session::MODE_PAYMENT, | ||
]); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\FluxSE\SyliusPayumStripePlugin\Provider; | ||
|
||
use FluxSE\SyliusPayumStripePlugin\Provider\ModeProvider; | ||
use FluxSE\SyliusPayumStripePlugin\Provider\ModeProviderInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Stripe\Checkout\Session; | ||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
final class ModeProviderSpec extends ObjectBehavior | ||
{ | ||
public function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ModeProvider::class); | ||
$this->shouldHaveType(ModeProviderInterface::class); | ||
} | ||
|
||
public function it_get_payment_method_types( | ||
OrderInterface $order | ||
): void { | ||
$this->getMode($order)->shouldReturn(Session::MODE_PAYMENT); | ||
} | ||
} |
Oops, something went wrong.