-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve 500 error on orders of 0.00 total (#116)
- Loading branch information
Showing
15 changed files
with
271 additions
and
14 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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{% set method = order.lastCartPayment().method %} | ||
{% set payment = order.lastCartPayment() %} | ||
|
||
{% if cw_tpay_get_gateway_config_value(method.gatewayConfig, 'type') == 'card' %} | ||
{% if payment is not null and | ||
cw_tpay_get_gateway_config_value(payment.method.gatewayConfig, 'type') == constant('CommerceWeavers\\SyliusTpayPlugin\\Tpay\\PaymentType::CARD') | ||
%} | ||
<div class="ui stackable grid"> | ||
{% include '@CommerceWeaversSyliusTpayPlugin/shop/payment/_card.html.twig' with {'method': method} %} | ||
{% include '@CommerceWeaversSyliusTpayPlugin/shop/payment/_card.html.twig' with {'method': payment.method} %} | ||
</div> | ||
{% endif %} |
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
3 changes: 2 additions & 1 deletion
3
templates/shop/cart/complete/_google_pay_regulations.html.twig
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace E2E\Checkout; | ||
|
||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\E2ETestCase; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Account\LoginShopUserTrait; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Order\CartTrait; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Order\TpayTrait; | ||
|
||
final class FreePaymentCheckoutTest extends E2ETestCase | ||
{ | ||
use CartTrait; | ||
use TpayTrait; | ||
use LoginShopUserTrait; | ||
|
||
private const FORM_ID = 'sylius_checkout_complete'; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->loadFixtures(['addressed_free_cart.yaml']); | ||
|
||
$this->loginShopUser('[email protected]', 'sylius'); | ||
// the cart is already addressed, so we go straight to selecting a shipping method | ||
$this->showSelectingShippingMethodStep(); | ||
$this->processWithDefaultShippingMethod(); | ||
} | ||
|
||
public function test_it_completes_the_checkout_if_order_total_is_0(): void | ||
{ | ||
// total is 0.00 so we do not choose payment method and go straight to complete | ||
$this->placeOrder(); | ||
|
||
$this->assertPageTitleContains('Thank you!'); | ||
} | ||
} |
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,109 @@ | ||
include: | ||
- common/channel.yaml | ||
- common/country.yaml | ||
- common/customer.yaml | ||
- common/payment_method.yaml | ||
- common/shipping_category.yaml | ||
- free_shipping_method.yaml | ||
- common/tax_category.yaml | ||
|
||
Sylius\Component\Core\Model\Product: | ||
product: | ||
fallbackLocale: en_US | ||
currentLocale: en | ||
code: 'MUG_SW' | ||
translations: | ||
- '@product_translation' | ||
|
||
Sylius\Component\Core\Model\ProductTranslation: | ||
product_translation: | ||
name: 'Mug' | ||
slug: 'mug' | ||
locale: 'en_US' | ||
translatable: '@product' | ||
|
||
Sylius\Component\Product\Model\ProductVariantTranslation: | ||
product_variant_translation: | ||
name: 'Mug' | ||
locale: en_US | ||
translatable: '@product_variant' | ||
|
||
Sylius\Component\Core\Model\ProductVariant: | ||
product_variant: | ||
code: 'MUG' | ||
version: 1 | ||
product: '@product' | ||
fallbackLocale: en_US | ||
currentLocale: en | ||
position: 1 | ||
optionValues: ['@product_option_value_color_blue'] | ||
channelPricings: | ||
channel_web: '@product_variant_channel_web_pricing' | ||
translations: | ||
- '@product_variant_translation' | ||
enabled: true | ||
tracked: true | ||
onHold: 0 | ||
onHand: 10 | ||
weight: 100.50 | ||
width: 100.50 | ||
height: 100.50 | ||
depth: 100.50 | ||
taxCategory: '@tax_category_default' | ||
shippingCategory: '@shipping_category_default' | ||
shippingRequired: true | ||
|
||
Sylius\Component\Core\Model\ChannelPricing: | ||
product_variant_channel_web_pricing: | ||
channelCode: 'WEB' | ||
price: 00 | ||
|
||
Sylius\Component\Product\Model\ProductOption: | ||
product_option_color: | ||
code: 'COLOR' | ||
currentLocale: 'en_US' | ||
translations: | ||
- '@product_option_translation_en_EN' | ||
|
||
Sylius\Component\Product\Model\ProductOptionTranslation: | ||
product_option_translation_en_EN: | ||
locale: 'en_US' | ||
name: 'Color' | ||
translatable: '@product_option_color' | ||
|
||
Sylius\Component\Product\Model\ProductOptionValue: | ||
product_option_value_color_blue: | ||
code: 'COLOR_BLUE' | ||
currentLocale: 'en_US' | ||
fallbackLocale: 'en_US' | ||
option: '@product_option_color' | ||
translations: | ||
- '@product_option_value_translation_blue' | ||
|
||
Sylius\Component\Product\Model\ProductOptionValueTranslation: | ||
product_option_value_translation_blue: | ||
locale: 'en_US' | ||
value: 'Blue' | ||
translatable: '@product_option_value_color_blue' | ||
|
||
App\Entity\Order: | ||
addressed_cart: | ||
channel: '@channel_web' | ||
currencyCode: 'USD' | ||
localeCode: 'en_US' | ||
customer: '@customer_tony' | ||
state: 'cart' | ||
checkoutState: 'addressed' | ||
createdByGuest: false | ||
shippingAddress: '@address_tony' | ||
billingAddress: '@address_tony' | ||
__calls: | ||
- addItem: ["@order_item"] | ||
|
||
Sylius\Component\Core\Model\OrderItem: | ||
order_item: | ||
variant: '@product_variant' | ||
|
||
Sylius\Component\Core\Model\OrderItemUnit: | ||
order_item_unit: | ||
__construct: ['@order_item'] |
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,32 @@ | ||
Sylius\Component\Core\Model\ShippingMethod: | ||
shipping_method_free: | ||
code: 'FREE' | ||
enabled: true | ||
calculator: 'flat_rate' | ||
configuration: | ||
WEB: | ||
amount: 00 | ||
MOBILE: | ||
amount: 00 | ||
zone: '@zone_world' | ||
currentLocale: 'en_US' | ||
translations: ["@shipping_method_translation_free"] | ||
channels: ["@channel_web"] | ||
|
||
Sylius\Component\Shipping\Model\ShippingMethodTranslation: | ||
shipping_method_translation_free: | ||
name: 'FREE' | ||
locale: 'en_US' | ||
description: '<paragraph(2)>' | ||
translatable: '@shipping_method_free' | ||
|
||
Sylius\Component\Addressing\Model\ZoneMember: | ||
zone_member_{US, FR, DE}: | ||
code: '<current()>' | ||
|
||
Sylius\Component\Addressing\Model\Zone: | ||
zone_world: | ||
code: 'WORLD' | ||
name: 'World' | ||
type: 'country' | ||
members: ['@zone_member_US', '@zone_member_FR', '@zone_member_DE'] |
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