Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@
"lodash@>=4.0.0 <=4.17.23": ">=4.18.0",
"lodash-es@<=4.17.23": ">=4.18.0",
"lodash@<=4.17.23": ">=4.18.0",
"axios@<1.15.0": ">=1.15.0"
"axios@<1.15.0": ">=1.15.0",
"postcss@<8.5.10": ">=8.5.10",
"fast-uri@<=3.1.0": ">=3.1.1",
"fast-uri@<=3.1.1": ">=3.1.2",
"brace-expansion@>=5.0.0 <5.0.6": ">=5.0.6",
"qs@>=6.11.1 <=6.15.1": ">=6.15.2"
}
},
"types": "./dist/index.d.ts",
Expand Down
49 changes: 27 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@ export type {
} from '@/models/Gateway.ts'
import { RegistryAccount } from '@/models/Gateway.ts'

export type {
IContactVerification,
IContactVerificationCommand
} from '@/models/ContactVerification.ts'
export type {
VerificationMethod,
VerificationProof,
VerificationClaim
} from '@/models/ContactVerification.ts'
import ContactVerification from '@/models/ContactVerification.ts'

/** All model classes */
export {
AcmeSubscription,
Expand Down Expand Up @@ -500,5 +511,6 @@ export {
Transaction,
TransferInfo,
ValidationCategory,
RegistryAccount
RegistryAccount,
ContactVerification
}
10 changes: 9 additions & 1 deletion src/models/Contact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ContactRegistryAccount, IContactRegistryAccount } from '@/models/Gateway.ts'
import ContactVerification, { IContactVerification } from '@/models/ContactVerification.ts'

export interface IContactValidation {
validatedOn: Date
Expand Down Expand Up @@ -77,12 +78,13 @@ export interface IContact {
registries?: string[]
properties?: Map<string, Map<string, string>>
validations?: IContactValidation[]
verifications?: IContactVerification[]
/** Only applicable on Gateway accounts. */
registryAccounts?: ContactRegistryAccount[]
}

export type ContactField = keyof Contact
export type ContactFilterField = Exclude<ContactField, 'validations' | 'properties' | 'customer' | 'registries' | 'registryAccounts'> | 'validation'
export type ContactFilterField = Exclude<ContactField, 'validations' | 'verifications' | 'properties' | 'customer' | 'registries' | 'registryAccounts'> | 'validation'

export interface IContactUpdate extends IContact{
designatedAgent?: DesignatedAgent
Expand All @@ -108,6 +110,7 @@ export default class Contact implements IContact {
registries?: string[]
properties?: Map<string, Map<string, string>>
validations?: ContactValidation[]
verifications?: ContactVerification[]
registryAccounts?: ContactRegistryAccount[]

constructor (contact: IContact) {
Expand All @@ -134,6 +137,11 @@ export default class Contact implements IContact {
d => new ContactValidation(d)
).sort((a, b) => a.category.localeCompare(b.category))
}
if (contact.verifications) {
this.verifications = contact.verifications.map(
v => new ContactVerification(v)
)
}
if (contact.registryAccounts) {
this.registryAccounts = contact.registryAccounts.map((a: IContactRegistryAccount) => new ContactRegistryAccount(a))
}
Expand Down
77 changes: 77 additions & 0 deletions src/models/ContactVerification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
export const VerificationMethods = {
REACHABILITY: 'REACHABILITY',
ELECTRONIC_DOCUMENT: 'ELECTRONIC_DOCUMENT',
PHYSICAL_DOCUMENT: 'PHYSICAL_DOCUMENT',
EID_AUTH: 'EID_AUTH',
TRANSACTION: 'TRANSACTION',
DATA: 'DATA'
} as const
export type VerificationMethod = keyof typeof VerificationMethods

export const VerificationProofs = {
LOG_RECORD: 'LOG_RECORD',
ID_CARD: 'ID_CARD',
PASSPORT: 'PASSPORT',
POPULATION_REGISTER: 'POPULATION_REGISTER',
RESIDENCE_PERMIT: 'RESIDENCE_PERMIT',
DRIVERS_LICENCE: 'DRIVERS_LICENCE',
COMPANY_REGISTER: 'COMPANY_REGISTER',
COMPANY_STATEMENT: 'COMPANY_STATEMENT',
BANK_ACCOUNT: 'BANK_ACCOUNT',
ONLINE_PAYMENT_ACCOUNT: 'ONLINE_PAYMENT_ACCOUNT',
UTILITY_ACCOUNT: 'UTILITY_ACCOUNT',
BANK_STATEMENT: 'BANK_STATEMENT',
TAX_STATEMENT: 'TAX_STATEMENT',
ADDRESS_DATABASE: 'ADDRESS_DATABASE'
} as const
export type VerificationProof = keyof typeof VerificationProofs

export const VerificationClaims = {
EMAIL: 'EMAIL',
ADDRESS: 'ADDRESS',
ORGANIZATION: 'ORGANIZATION',
NAME: 'NAME',
VOICE: 'VOICE'
} as const
export type VerificationClaim = keyof typeof VerificationClaims

export interface IContactVerification {
verificationDate: Date
method: VerificationMethod
proof: VerificationProof
source: string
externalId: string
claims: VerificationClaim[]
createdDate: Date
updatedDate?: Date
}

export interface IContactVerificationCommand {
verificationDate: Date
method: VerificationMethod
proof: VerificationProof
externalId: string
claims: VerificationClaim[]
}

export default class ContactVerification implements IContactVerification {
verificationDate: Date
method: VerificationMethod
proof: VerificationProof
source: string
externalId: string
claims: VerificationClaim[]
createdDate: Date
updatedDate?: Date

constructor (verification: IContactVerification) {
this.verificationDate = verification.verificationDate ? new Date(verification.verificationDate) : verification.verificationDate
this.method = verification.method
this.proof = verification.proof
this.source = verification.source
this.externalId = verification.externalId
this.claims = verification.claims
this.createdDate = verification.createdDate ? new Date(verification.createdDate) : verification.createdDate
this.updatedDate = verification.updatedDate ? new Date(verification.updatedDate) : verification.updatedDate
}
}
2 changes: 2 additions & 0 deletions src/models/Domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export enum DesignatedAgent {
BOTH = 'BOTH'
}

/** @deprecated has become obsolete */
export enum TransferContacts {
REGISTRANT = 'REGISTRANT',
ADMIN = 'ADMIN'
Expand Down Expand Up @@ -108,6 +109,7 @@ export interface IDomainRegister extends IDomainRegisterTransfer {
}

export interface IDomainTransfer extends IDomainRegisterTransfer {
/** @deprecated has become obsolete */
transferContacts?: TransferContacts
designatedAgent?: DesignatedAgent
}
Expand Down
4 changes: 2 additions & 2 deletions src/resources/ContactApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class ContactApi extends Base {
* @param contact - Contact data.
*/
async create (contact: IContact): Promise<ProcessResponse> {
const fields = (({ handle, brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax }) => ({ handle, brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax }))(contact)
const fields = (({ handle, brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, verifications }) => ({ handle, brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, verifications }))(contact)

return this.axios.post('/customers/' + this.customer + '/contacts/' + contact.handle, fields)
.then(response => new ProcessResponse(response))
Expand All @@ -43,7 +43,7 @@ export default class ContactApi extends Base {
* @param contact - Contact data, will update based on provided fields. Provided handle will determine the contact to update.
*/
async update (contact: IContactUpdate): Promise<ProcessResponse> {
const fields = (({ brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, designatedAgent, disclosedFields }) => ({ brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, designatedAgent, disclosedFields }))(contact)
const fields = (({ brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, designatedAgent, disclosedFields, verifications }) => ({ brand, name, organization, addressLine, postalCode, city, state, country, email, voice, fax, designatedAgent, disclosedFields, verifications }))(contact)

return this.axios.post('/customers/' + this.customer + '/contacts/' + contact.handle + '/update', fields)
.then(response => new ProcessResponse(response))
Expand Down
2 changes: 2 additions & 0 deletions src/resources/DomainApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default class DomainApi extends Base {
zone,
keyData,
privacyProtect,
/** @deprecated has become obsolete */
transferContacts,
designatedAgent,
languageCode,
Expand All @@ -160,6 +161,7 @@ export default class DomainApi extends Base {
zone,
keyData,
privacyProtect,
/** @deprecated has become obsolete */
transferContacts,
designatedAgent,
languageCode,
Expand Down