Skip to content

Commit 7fd9d44

Browse files
committed
Send first and last name for invoice info
1 parent b96ff0b commit 7fd9d44

File tree

5 files changed

+81
-42
lines changed

5 files changed

+81
-42
lines changed

backend/api/tests/schema/test_create_order.py

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def _create_order(graphql_client, code, input):
2222
errors {
2323
nonFieldErrors
2424
invoiceInformation {
25-
name
25+
firstName
26+
lastName
2627
street
2728
zipcode
2829
fiscalCode
@@ -79,7 +80,8 @@ def test_cannot_create_order_unlogged(graphql_client):
7980
"invoiceInformation": {
8081
"isBusiness": False,
8182
"company": "",
82-
"name": "Patrick",
83+
"firstName": "Patrick",
84+
"lastName": "Arminio",
8385
"street": "street",
8486
"zipcode": "92100",
8587
"city": "Avellino",
@@ -133,7 +135,8 @@ def test_calls_create_order(graphql_client, user, mocker, requests_mock, pretix_
133135
"invoiceInformation": {
134136
"isBusiness": False,
135137
"company": "",
136-
"name": "Patrick",
138+
"firstName": "Patrick",
139+
"lastName": "Arminio",
137140
"street": "street",
138141
"zipcode": "92100",
139142
"city": "Avellino",
@@ -209,7 +212,8 @@ def test_calls_create_order_doesnt_require_attendee_data_for_non_admission_produ
209212
"invoiceInformation": {
210213
"isBusiness": False,
211214
"company": "",
212-
"name": "Patrick",
215+
"firstName": "Patrick",
216+
"lastName": "Arminio",
213217
"street": "street",
214218
"zipcode": "92100",
215219
"city": "Avellino",
@@ -287,7 +291,8 @@ def test_handles_payment_url_set_to_none(
287291
"invoiceInformation": {
288292
"isBusiness": False,
289293
"company": "",
290-
"name": "Patrick",
294+
"firstName": "Patrick",
295+
"lastName": "Arminio",
291296
"street": "street",
292297
"zipcode": "92100",
293298
"city": "Avellino",
@@ -343,7 +348,8 @@ def test_handles_errors(graphql_client, user, mocker, requests_mock, pretix_item
343348
"invoiceInformation": {
344349
"isBusiness": False,
345350
"company": "",
346-
"name": "Patrick",
351+
"firstName": "Patrick",
352+
"lastName": "Arminio",
347353
"street": "street",
348354
"zipcode": "92100",
349355
"city": "Avellino",
@@ -383,7 +389,8 @@ def test_invoice_validation_fails_without_required_field_in_country_italy(
383389
data = {
384390
"isBusiness": False,
385391
"company": "",
386-
"name": "Patrick",
392+
"firstName": "Patrick",
393+
"lastName": "Arminio",
387394
"street": "street",
388395
"zipcode": "92100",
389396
"city": "Avellino",
@@ -449,7 +456,8 @@ def test_invoice_validation_fails_with_missing_required_fields(
449456
data = {
450457
"isBusiness": False,
451458
"company": "",
452-
"name": "Patrick",
459+
"firstName": "Patrick",
460+
"lastName": "Arminio",
453461
"street": "street",
454462
"zipcode": "92100",
455463
"city": "Avellino",
@@ -533,7 +541,8 @@ def test_fiscal_code_not_required_for_non_it_orders(
533541
"invoiceInformation": {
534542
"isBusiness": False,
535543
"company": "",
536-
"name": "Patrick",
544+
"firstName": "Patrick",
545+
"lastName": "Arminio",
537546
"street": "street",
538547
"zipcode": "92100",
539548
"city": "Avellino",
@@ -590,7 +599,8 @@ def test_invoice_validation_fails_with_invalid_fiscal_code_in_country_italy(
590599
"invoiceInformation": {
591600
"isBusiness": False,
592601
"company": "",
593-
"name": "Patrick",
602+
"firstName": "Patrick",
603+
"lastName": "Arminio",
594604
"street": "street",
595605
"zipcode": "92100",
596606
"city": "Avellino",
@@ -650,7 +660,8 @@ def test_invoice_validation_checks_pec_email_if_provided(
650660
"invoiceInformation": {
651661
"isBusiness": False,
652662
"company": "",
653-
"name": "Patrick",
663+
"firstName": "Patrick",
664+
"lastName": "Arminio",
654665
"street": "street",
655666
"zipcode": "92100",
656667
"city": "Avellino",
@@ -711,7 +722,8 @@ def test_invoice_validation_fails_with_empty_vat_for_businesses(
711722
"invoiceInformation": {
712723
"isBusiness": True,
713724
"company": "business",
714-
"name": "Patrick",
725+
"firstName": "Patrick",
726+
"lastName": "Arminio",
715727
"street": "street",
716728
"zipcode": "92100",
717729
"city": "Avellino",
@@ -771,7 +783,8 @@ def test_invoice_validation_fails_with_empty_business_name_for_businesses(
771783
"invoiceInformation": {
772784
"isBusiness": True,
773785
"company": "",
774-
"name": "Patrick",
786+
"firstName": "Patrick",
787+
"lastName": "Arminio",
775788
"street": "street",
776789
"zipcode": "92100",
777790
"city": "Avellino",
@@ -831,7 +844,8 @@ def test_invoice_validation_fails_with_invalid_country_code(
831844
"invoiceInformation": {
832845
"isBusiness": True,
833846
"company": "name",
834-
"name": "Patrick",
847+
"firstName": "Patrick",
848+
"lastName": "Arminio",
835849
"street": "street",
836850
"zipcode": "92100",
837851
"city": "Avellino",
@@ -891,7 +905,8 @@ def test_invoice_validation_fails_when_italian_business_and_no_sdi(
891905
"invoiceInformation": {
892906
"isBusiness": True,
893907
"company": "LTD",
894-
"name": "Patrick",
908+
"firstName": "Patrick",
909+
"lastName": "Arminio",
895910
"street": "street",
896911
"zipcode": "92100",
897912
"city": "Avellino",
@@ -952,7 +967,8 @@ def test_invoice_validation_fails_when_italian_business_with_invalid_sdi(
952967
"invoiceInformation": {
953968
"isBusiness": True,
954969
"company": "LTD",
955-
"name": "Patrick",
970+
"firstName": "Patrick",
971+
"lastName": "Arminio",
956972
"street": "street",
957973
"zipcode": "92100",
958974
"city": "Avellino",
@@ -1013,7 +1029,8 @@ def test_invoice_validation_fails_when_italian_zipcode_is_invalid(
10131029
"invoiceInformation": {
10141030
"isBusiness": True,
10151031
"company": "LTD",
1016-
"name": "Patrick",
1032+
"firstName": "Patrick",
1033+
"lastName": "Arminio",
10171034
"street": "street",
10181035
"zipcode": "921",
10191036
"city": "Avellino",
@@ -1074,7 +1091,8 @@ def test_order_creation_fails_if_attendee_name_is_empty(
10741091
"invoiceInformation": {
10751092
"isBusiness": False,
10761093
"company": "LTD",
1077-
"name": "Patrick",
1094+
"firstName": "Patrick",
1095+
"lastName": "Arminio",
10781096
"street": "street",
10791097
"zipcode": "921",
10801098
"city": "Avellino",
@@ -1135,7 +1153,8 @@ def test_order_creation_fails_if_attendee_email_is_empty(
11351153
"invoiceInformation": {
11361154
"isBusiness": False,
11371155
"company": "LTD",
1138-
"name": "Patrick",
1156+
"firstName": "Patrick",
1157+
"lastName": "Arminio",
11391158
"street": "street",
11401159
"zipcode": "921",
11411160
"city": "Avellino",
@@ -1196,7 +1215,8 @@ def test_order_creation_fails_if_attendee_email_is_invalid(
11961215
"invoiceInformation": {
11971216
"isBusiness": False,
11981217
"company": "LTD",
1199-
"name": "Patrick",
1218+
"firstName": "Patrick",
1219+
"lastName": "Arminio",
12001220
"street": "street",
12011221
"zipcode": "921",
12021222
"city": "Avellino",
@@ -1257,7 +1277,8 @@ def test_invoice_validation_works_when_not_italian_and_no_sdi(
12571277
"invoiceInformation": {
12581278
"isBusiness": True,
12591279
"company": "LTD",
1260-
"name": "Patrick",
1280+
"firstName": "Patrick",
1281+
"lastName": "Arminio",
12611282
"street": "street",
12621283
"zipcode": "92100",
12631284
"city": "Avellino",
@@ -1329,7 +1350,8 @@ def test_create_order_billing_address_stores_both_non_and_business(
13291350
"invoiceInformation": {
13301351
"isBusiness": True,
13311352
"company": "LTD",
1332-
"name": "Patrick",
1353+
"firstName": "Patrick",
1354+
"lastName": "Arminio",
13331355
"street": "street",
13341356
"zipcode": "92100",
13351357
"city": "Avellino",
@@ -1407,7 +1429,8 @@ def test_create_order_updates_billing_address(
14071429
"invoiceInformation": {
14081430
"isBusiness": True,
14091431
"company": "LTD",
1410-
"name": "Patrick",
1432+
"firstName": "Patrick",
1433+
"lastName": "Arminio",
14111434
"street": "street",
14121435
"zipcode": "92100",
14131436
"city": "Avellino",

backend/pretix/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ def get_quotas(conference: Conference) -> Dict[str, Quota]:
248248
@strawberry.type
249249
class InvoiceInformationErrors:
250250
company: list[str] = strawberry.field(default_factory=list)
251-
name: list[str] = strawberry.field(default_factory=list)
251+
first_name: list[str] = strawberry.field(default_factory=list)
252+
last_name: list[str] = strawberry.field(default_factory=list)
252253
street: list[str] = strawberry.field(default_factory=list)
253254
zipcode: list[str] = strawberry.field(default_factory=list)
254255
city: list[str] = strawberry.field(default_factory=list)
@@ -316,7 +317,8 @@ def validate(
316317
class InvoiceInformation:
317318
is_business: bool
318319
company: Optional[str]
319-
name: str
320+
first_name: str
321+
last_name: str
320322
street: str
321323
zipcode: str
322324
city: str
@@ -328,7 +330,8 @@ class InvoiceInformation:
328330

329331
def validate(self, errors: CreateOrderErrors) -> CreateOrderErrors:
330332
required_fields = [
331-
"name",
333+
"first_name",
334+
"last_name",
332335
"street",
333336
"zipcode",
334337
"city",

frontend/src/components/checkout-page-handler/billing-card.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,23 @@ export const BillingCard = ({
129129
)}
130130
<InputWrapper
131131
required={true}
132-
title={<FormattedMessage id="orderInformation.name" />}
132+
title={<FormattedMessage id="orderInformation.firstName" />}
133133
>
134134
<Input
135-
{...text("name")}
135+
{...text("firstName")}
136+
required={true}
137+
placeholder={inputPlaceholder}
138+
errors={invoiceInformationErrors?.firstName}
139+
/>
140+
</InputWrapper>
141+
<InputWrapper
142+
required={true}
143+
title={<FormattedMessage id="orderInformation.lastName" />}
144+
>
145+
<Input
146+
{...text("lastName")}
136147
required={true}
137148
placeholder={inputPlaceholder}
138-
errors={invoiceInformationErrors?.name}
139149
/>
140150
</InputWrapper>
141151
{isBusiness && (
@@ -154,13 +164,15 @@ export const BillingCard = ({
154164
)}
155165
<InputWrapper
156166
required={true}
157-
title={<FormattedMessage id="orderInformation.zipCode" />}
167+
title={<FormattedMessage id="orderInformation.address" />}
158168
>
159-
<Input
160-
{...text("zipCode")}
169+
<Textarea
170+
rows={3}
171+
{...textarea("address")}
172+
autoComplete="street-address"
161173
required={true}
162174
placeholder={inputPlaceholder}
163-
errors={invoiceInformationErrors?.zipcode}
175+
errors={invoiceInformationErrors?.street}
164176
/>
165177
</InputWrapper>
166178

@@ -177,15 +189,13 @@ export const BillingCard = ({
177189
</InputWrapper>
178190
<InputWrapper
179191
required={true}
180-
title={<FormattedMessage id="orderInformation.address" />}
192+
title={<FormattedMessage id="orderInformation.zipCode" />}
181193
>
182-
<Textarea
183-
rows={3}
184-
{...textarea("address")}
185-
autoComplete="street-address"
194+
<Input
195+
{...text("zipCode")}
186196
required={true}
187197
placeholder={inputPlaceholder}
188-
errors={invoiceInformationErrors?.street}
198+
errors={invoiceInformationErrors?.zipcode}
189199
/>
190200
</InputWrapper>
191201
<InputWrapper

frontend/src/components/tickets-page/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export type InvoiceInformationState = {
22
isBusiness: boolean;
33
companyName: string;
4-
name: string;
4+
firstName: string;
5+
lastName: string;
56
fiscalCode: string;
67
pec: string;
78
sdi: string;

frontend/src/locale/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ Click the box to change. If left empty, we will assume you are available.`,
651651
"orderInformation.individualConsumer": "Individual Customer",
652652
"orderInformation.businessConsumer": "Business Customer",
653653
"orderInformation.companyName": "Company name",
654-
"orderInformation.name": "Name",
654+
"orderInformation.firstName": "First name",
655+
"orderInformation.lastName": "Last name",
655656
"orderInformation.vatId": "VAT ID",
656657
"orderInformation.address": "Address",
657658
"orderInformation.zipCode": "Zip Code",
@@ -1434,7 +1435,8 @@ The sooner you buy your ticket, the more you save!`,
14341435
"orderInformation.individualConsumer": "Persona individuale",
14351436
"orderInformation.businessConsumer": "Azienda",
14361437
"orderInformation.companyName": "Nome azienda",
1437-
"orderInformation.name": "Nome completo",
1438+
"orderInformation.firstName": "Nome",
1439+
"orderInformation.lastName": "Cognome",
14381440
"orderInformation.vatId": "Partita IVA",
14391441
"orderInformation.address": "Indirizzo",
14401442
"orderInformation.zipCode": "CAP",

0 commit comments

Comments
 (0)