Skip to content

Commit

Permalink
address typings improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Dec 18, 2023
1 parent 02f3d61 commit bfd0bb7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 32 deletions.
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ declare namespace MangoPay {
}

class Address extends EntityBase<address.AddressData> {
constructor(data: Partial<address.AddressData>);
constructor(data: Partial<address.AddressData> | address.CreateAddress);
}

interface Address extends address.AddressData {
Expand Down
26 changes: 1 addition & 25 deletions typings/mangopay2-nodejs-sdk-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ const legalUser = new api.models.UserLegal({
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeAddress: new api.models.Address({
AddressLine1: "4101 Reservoir Rd NW",
AddressLine2: "",
City: "Washington",
Region: "District of Columbia",
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeBirthday: 1300186358,
LegalRepresentativeNationality: "FR",
LegalRepresentativeCountryOfResidence: "FR",
Expand Down Expand Up @@ -179,15 +171,7 @@ const userLegalPayer = new api.models.UserLegalPayer({
LegalPersonType: "BUSINESS",
LegalRepresentativeFirstName: "Mango",
LegalRepresentativeLastName: "Pay",
LegalRepresentativeEmail: "[email protected]",
LegalRepresentativeAddress: new api.models.Address({
AddressLine1: "4101 Reservoir Rd NW",
AddressLine2: "",
City: "Washington",
Region: "District of Columbia",
PostalCode: "20007",
Country: "US"
})
LegalRepresentativeEmail: "[email protected]"
});

api.Users.create(userLegalPayer,
Expand All @@ -212,14 +196,6 @@ const userLegalOwner = new api.models.UserLegalOwner({
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeAddress: new api.models.Address({
AddressLine1: "4101 Reservoir Rd NW",
AddressLine2: "",
City: "Washington",
Region: "District of Columbia",
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeBirthday: 1300186358,
LegalRepresentativeNationality: "FR",
LegalRepresentativeCountryOfResidence: "FR",
Expand Down
2 changes: 1 addition & 1 deletion typings/models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export namespace Models {
}

class Address extends EntityBase<address.AddressData> {
constructor(data: Partial<address.AddressData>);
constructor(data: Partial<address.AddressData> | address.CreateAddress);
}

class BankAccountDetails {
Expand Down
4 changes: 2 additions & 2 deletions typings/models/address.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CountryISO } from "../types";
import { Models } from "../models";

export namespace address {
type AddressType = string | AddressData | Models.Address;
type AddressType = string | AddressData | Models.Address | CreateAddress;

interface AddressData {
/**
Expand Down Expand Up @@ -55,7 +55,7 @@ export namespace address {
/**
* The region of the address - this is optional except if the Country is US, CA or MX
*/
Region: string;
Region?: string;

/**
* The postal code of the address - can be alphanumeric, dashes or spaces
Expand Down
3 changes: 0 additions & 3 deletions typings/models/user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export namespace user {
| "LegalRepresentativeNationality"
| "LegalRepresentativeFirstName"
| "LegalRepresentativeLastName"
| "LegalRepresentativeAddress"
| "Email";

type RequiredUserNaturalData =
Expand Down Expand Up @@ -68,7 +67,6 @@ export namespace user {
type RequiredUserLegalPayerData =
| "LegalPersonType"
| "Name"
| "LegalRepresentativeAddress"
| "LegalRepresentativeFirstName"
| "LegalRepresentativeLastName"
| "Email";
Expand All @@ -77,7 +75,6 @@ export namespace user {
| "HeadquartersAddress"
| "LegalPersonType"
| "Name"
| "LegalRepresentativeAddress"
| "LegalRepresentativeBirthday"
| "LegalRepresentativeCountryOfResidence"
| "LegalRepresentativeNationality"
Expand Down

0 comments on commit bfd0bb7

Please sign in to comment.