From bfd0bb7213e1c4fa6e4b4c95e1a44148e834fe7d Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Mon, 18 Dec 2023 12:01:19 +0200 Subject: [PATCH] address typings improvements --- typings/index.d.ts | 2 +- typings/mangopay2-nodejs-sdk-tests.ts | 26 +------------------------- typings/models.d.ts | 2 +- typings/models/address.d.ts | 4 ++-- typings/models/user.d.ts | 3 --- 5 files changed, 5 insertions(+), 32 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index e685690..e7a8073 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -250,7 +250,7 @@ declare namespace MangoPay { } class Address extends EntityBase { - constructor(data: Partial); + constructor(data: Partial | address.CreateAddress); } interface Address extends address.AddressData { diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index cfe683e..5e81424 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -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", @@ -179,15 +171,7 @@ const userLegalPayer = new api.models.UserLegalPayer({ LegalPersonType: "BUSINESS", LegalRepresentativeFirstName: "Mango", LegalRepresentativeLastName: "Pay", - LegalRepresentativeEmail: "mango@mangopay.com", - LegalRepresentativeAddress: new api.models.Address({ - AddressLine1: "4101 Reservoir Rd NW", - AddressLine2: "", - City: "Washington", - Region: "District of Columbia", - PostalCode: "20007", - Country: "US" - }) + LegalRepresentativeEmail: "mango@mangopay.com" }); api.Users.create(userLegalPayer, @@ -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", diff --git a/typings/models.d.ts b/typings/models.d.ts index ba508f1..2be3459 100644 --- a/typings/models.d.ts +++ b/typings/models.d.ts @@ -31,7 +31,7 @@ export namespace Models { } class Address extends EntityBase { - constructor(data: Partial); + constructor(data: Partial | address.CreateAddress); } class BankAccountDetails { diff --git a/typings/models/address.d.ts b/typings/models/address.d.ts index f61c4fc..1bc994f 100644 --- a/typings/models/address.d.ts +++ b/typings/models/address.d.ts @@ -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 { /** @@ -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 diff --git a/typings/models/user.d.ts b/typings/models/user.d.ts index fbd6126..7be42bb 100644 --- a/typings/models/user.d.ts +++ b/typings/models/user.d.ts @@ -40,7 +40,6 @@ export namespace user { | "LegalRepresentativeNationality" | "LegalRepresentativeFirstName" | "LegalRepresentativeLastName" - | "LegalRepresentativeAddress" | "Email"; type RequiredUserNaturalData = @@ -68,7 +67,6 @@ export namespace user { type RequiredUserLegalPayerData = | "LegalPersonType" | "Name" - | "LegalRepresentativeAddress" | "LegalRepresentativeFirstName" | "LegalRepresentativeLastName" | "Email"; @@ -77,7 +75,6 @@ export namespace user { | "HeadquartersAddress" | "LegalPersonType" | "Name" - | "LegalRepresentativeAddress" | "LegalRepresentativeBirthday" | "LegalRepresentativeCountryOfResidence" | "LegalRepresentativeNationality"