Skip to content

Commit

Permalink
fix: tax rates serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Atala committed Feb 7, 2025
1 parent a599b7a commit d8c6985
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
13 changes: 2 additions & 11 deletions cypress/e2e/local-commerce/@admin/create_delivery_as_admin.cy.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
context('Delivery (role: admin)', () => {
beforeEach(() => {
const prefix = Cypress.env('COMMAND_PREFIX')

let cmd =
'bin/console coopcycle:setup --env=test'
if (prefix) {
cmd = `${prefix} ${cmd}`
}

cy.exec(cmd)

cmd =
'bin/console coopcycle:fixtures:load -f cypress/fixtures/stores.yml --env test'
if (prefix) {
Expand Down Expand Up @@ -560,10 +551,10 @@ context('Delivery (role: admin)', () => {
'match',
/\/admin\/orders\/[0-9]+$/,
)
cy.get('[name="variantName"]')
cy.get('[data-testid="name"]')
.contains('Test product')

cy.get('#variantPriceVAT')
cy.get('[data-testid="total"]')
.contains('€72.00')
})
})
16 changes: 8 additions & 8 deletions cypress/fixtures/sylius_taxation.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
AppBundle\Entity\Sylius\TaxRate:
tva_10:
name: "TVA 10%"
code: tva_10
name: tax_rate.intermediary
code: FR_BASE_INTERMEDIARY_INTERMEDIARY
amount: 0.1
includedInPrice: true
calculator: default
tva_20:
name: "TVA 20%"
code: tva_20
name: tax_rate.standard
code: FR_BASE_STANDARD_STANDARD
amount: 0.2
includedInPrice: true
calculator: default
country: fr
tva_standard:
name: "TVA 0%"
code: tax_rate.standard
name: tax_rate.standard
code: FR_SERVICE_STANDARD
amount: 0.2
includedInPrice: true
calculator: default
country: fr
tva_zero:
name: "TVA 0%"
code: tax_rate.zero
name: tax_rate.zero
code: FR_SERVICE_TAX_EXEMPT_ZERO
amount: 0.0
includedInPrice: true
calculator: default
Expand Down
2 changes: 1 addition & 1 deletion js/app/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@
"DELIVERY_FORM_ERROR_HOUR": "Le retrait doit être avant le dépôt",
"DELIVERY_FORM_CONTACT_PLACEHOLDER": "Contact",
"DELIVERY_FORM_REMEMBER_ADDRESS": "Se souvenir de cette adresse",
"DELIVERY_FORM_TOTAL_PRICE": "Prix total",
"DELIVERY_FORM_TOTAL_PRICE": "Prix",
"DELIVERY_FORM_TOTAL_VAT": "TTC",
"DELIVERY_FORM_TOTAL_EX_VAT": "HT",
"DELIVERY_FORM_REMOVE_DROPOFF": "Retirer ce dépôt",
Expand Down
5 changes: 5 additions & 0 deletions src/Api/Resource/TaxRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ public function __construct(BaseTaxRate $taxRate, string $name, array $alternati
public function getId() {
return $this->id;
}

public function setId(int $id) {
$this->id = $id;

Check failure on line 65 in src/Api/Resource/TaxRate.php

View workflow job for this annotation

GitHub Actions / Lint PHP (8.2)

Property AppBundle\Api\Resource\TaxRate::$id (string) does not accept int.

Check failure on line 65 in src/Api/Resource/TaxRate.php

View workflow job for this annotation

GitHub Actions / Lint PHP (8.3)

Property AppBundle\Api\Resource\TaxRate::$id (string) does not accept int.
return $this;
}
}
5 changes: 5 additions & 0 deletions src/Entity/Sylius/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,11 @@ public function getDeliveryPrice(): PriceInterface
}
}

public function hasArbitraryPrice(): bool
{
return $this->getDeliveryPrice() instanceof ArbitraryPrice;
}

public function getExports(): Collection
{
return $this->exports;
Expand Down

0 comments on commit d8c6985

Please sign in to comment.