Skip to content

Commit e76c08f

Browse files
Accounts test fix
1 parent ccd7829 commit e76c08f

1 file changed

Lines changed: 58 additions & 30 deletions

File tree

‎src/test/java/com/checkout/accounts/AccountsTestIT.java‎

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -486,22 +486,36 @@ private String createTestEntity() {
486486
.principalAddress(TestHelper.createAddress())
487487
.registeredAddress(TestHelper.createAddress())
488488
.representatives(Collections.singletonList(Representative.builder()
489-
.firstName("John")
490-
.lastName("Doe")
491-
.address(TestHelper.createAddress())
492-
.identification(Identification.builder()
493-
.nationalIdNumber("AB123456C")
494-
.build())
495-
.phone(buildAccountPhone())
496-
.dateOfBirth(DateOfBirth.builder()
497-
.day(5)
498-
.month(6)
499-
.year(1995)
500-
.build())
501-
.placeOfBirth(PlaceOfBirth.builder()
502-
.country(CountryCode.GB)
489+
// The nested `individual` shape, not the flat
490+
// firstName/lastName/address fields. Established against the
491+
// sandbox on 2026-09-29: the flat shape is rejected with 422
492+
// company_representatives_0_invalid on BOTH schema 2.0 and 3.0,
493+
// while this nested shape returns 201 on both. The swagger agrees:
494+
// representatives.items is a oneOf whose "Person of Interest"
495+
// variant requires `individual` and `roles`, with `individual`
496+
// requiring first_name, last_name, date_of_birth, place_of_birth
497+
// and address. buildCompanyEntity already used this shape; these
498+
// two fixtures had been left on the flat one.
499+
.individual(RepresentativeIndividual.builder()
500+
.firstName("John")
501+
.lastName("Doe")
502+
.dateOfBirth(DateOfBirth.builder()
503+
.day(5)
504+
.month(6)
505+
.year(1995)
506+
.build())
507+
.placeOfBirth(PlaceOfBirth.builder()
508+
.country(CountryCode.GB)
509+
.build())
510+
.address(TestHelper.createAddress())
503511
.build())
504-
.roles(Collections.singletonList(EntityRoles.UBO))
512+
// Role coverage is validated across the representative set: a set
513+
// without an authorised_signatory, a director and a control_person
514+
// is rejected with the corresponding *_required error codes.
515+
.roles(Arrays.asList(EntityRoles.UBO,
516+
EntityRoles.AUTHORISED_SIGNATORY,
517+
EntityRoles.DIRECTOR,
518+
EntityRoles.CONTROL_PERSON))
505519
.build()))
506520
.financialDetails(EntityFinancialDetails.builder()
507521
.annualProcessingVolume(120000L)
@@ -679,22 +693,36 @@ private static OnboardEntityRequest buildCompanyEntity(final String randomRefere
679693
.principalAddress(address)
680694
.registeredAddress(address)
681695
.representatives(Collections.singletonList(Representative.builder()
682-
.firstName("John")
683-
.lastName("Doe")
684-
.address(address)
685-
.identification(Identification.builder()
686-
.nationalIdNumber("AB123456C")
687-
.build())
688-
.phone(buildAccountPhone())
689-
.dateOfBirth(DateOfBirth.builder()
690-
.day(5)
691-
.month(6)
692-
.year(1995)
693-
.build())
694-
.placeOfBirth(PlaceOfBirth.builder()
695-
.country(CountryCode.ES)
696+
// The nested `individual` shape, not the flat
697+
// firstName/lastName/address fields. Established against the
698+
// sandbox on 2026-09-29: the flat shape is rejected with 422
699+
// company_representatives_0_invalid on BOTH schema 2.0 and 3.0,
700+
// while this nested shape returns 201 on both. The swagger agrees:
701+
// representatives.items is a oneOf whose "Person of Interest"
702+
// variant requires `individual` and `roles`, with `individual`
703+
// requiring first_name, last_name, date_of_birth, place_of_birth
704+
// and address. buildCompanyEntity already used this shape; these
705+
// two fixtures had been left on the flat one.
706+
.individual(RepresentativeIndividual.builder()
707+
.firstName("John")
708+
.lastName("Doe")
709+
.dateOfBirth(DateOfBirth.builder()
710+
.day(5)
711+
.month(6)
712+
.year(1995)
713+
.build())
714+
.placeOfBirth(PlaceOfBirth.builder()
715+
.country(CountryCode.ES)
716+
.build())
717+
.address(address)
696718
.build())
697-
.roles(Collections.singletonList(EntityRoles.UBO))
719+
// Role coverage is validated across the representative set: a set
720+
// without an authorised_signatory, a director and a control_person
721+
// is rejected with the corresponding *_required error codes.
722+
.roles(Arrays.asList(EntityRoles.UBO,
723+
EntityRoles.AUTHORISED_SIGNATORY,
724+
EntityRoles.DIRECTOR,
725+
EntityRoles.CONTROL_PERSON))
698726
.build()))
699727
.financialDetails(EntityFinancialDetails.builder()
700728
.annualProcessingVolume(120000L)

0 commit comments

Comments
 (0)