Skip to content

Commit b6bb39e

Browse files
committed
fix(serializer): update SummitTaxTypeSerializer rounding rule for rate field
1 parent 54030d3 commit b6bb39e

2 files changed

Lines changed: 60 additions & 2 deletions

File tree

app/ModelSerializers/Summit/Registration/SummitTaxTypeSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class SummitTaxTypeSerializer extends SilverStripeSerializer
2323
protected static $array_mappings = [
2424
'Name' => 'name:json_string',
2525
'TaxId' => 'tax_id:json_string',
26-
'Rate' => 'rate:json_float',
26+
'Rate' => 'rate:json_money:3',
2727
'SummitId' => 'summit_id:json_int',
2828
];
2929

@@ -76,4 +76,4 @@ public function serialize($expand = null, array $fields = [], array $relations =
7676
}
7777
return $values;
7878
}
79-
}
79+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php namespace Database\Migrations\Model;
2+
/**
3+
* Copyright 2025 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
use Doctrine\DBAL\Schema\Schema;
15+
use Doctrine\Migrations\AbstractMigration;
16+
17+
/**
18+
* Auto-generated Migration: Please modify to your needs!
19+
*/
20+
final class Version20260220195027 extends AbstractMigration
21+
{
22+
public function getDescription(): string
23+
{
24+
return 'update tax rate precision';
25+
}
26+
27+
public function up(Schema $schema): void
28+
{
29+
$sql = <<<SQL
30+
ALTER TABLE `SummitTaxType` CHANGE `Rate` `Rate` DECIMAL(9,5) NOT NULL DEFAULT '0.00000';
31+
SQL;
32+
33+
$this->addSql($sql);
34+
35+
$sql = <<<SQL
36+
ALTER TABLE `SummitAttendeeTicket_Taxes` CHANGE `Rate` `Rate` DECIMAL(9,5) NOT NULL DEFAULT '0.00000';
37+
SQL;
38+
39+
$this->addSql($sql);
40+
41+
}
42+
43+
public function down(Schema $schema): void
44+
{
45+
$sql = <<<SQL
46+
ALTER TABLE `SummitTaxType` CHANGE `Rate` `Rate` DECIMAL(9,2) NOT NULL DEFAULT '0.00';
47+
SQL;
48+
49+
$this->addSql($sql);
50+
51+
$sql = <<<SQL
52+
ALTER TABLE `SummitAttendeeTicket_Taxes` CHANGE `Rate` `Rate` DECIMAL(9,2) NOT NULL DEFAULT '0.00';
53+
SQL;
54+
55+
$this->addSql($sql);
56+
57+
}
58+
}

0 commit comments

Comments
 (0)