diff --git a/bom-core b/bom-core index 524c0d5dea..4108220701 160000 --- a/bom-core +++ b/bom-core @@ -1 +1 @@ -Subproject commit 524c0d5dea439b34d68f4b5a60b4a4bea1aba07d +Subproject commit 410822070117f3bff1759617cb9cb82a16e540aa diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 999ca3b740..a4726ac150 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -205,6 +205,7 @@ abstract class GetSettingsModel { this.email, this.emailConsent, this.employmentStatus, + this.fatcaDeclaration, this.featureFlag, this.firstName, this.hasSecretAnswer, @@ -213,6 +214,7 @@ abstract class GetSettingsModel { this.lastName, this.nonPepDeclaration, this.phone, + this.phoneNumberVerification, this.placeOfBirth, this.preferredLanguage, this.requestProfessionalStatus, @@ -220,6 +222,8 @@ abstract class GetSettingsModel { this.salutation, this.taxIdentificationNumber, this.taxResidence, + this.tinSkipped, + this.tncStatus, this.tradingHub, this.userHash, }); @@ -275,6 +279,9 @@ abstract class GetSettingsModel { /// Employment Status. final EmploymentStatusEnum? employmentStatus; + /// Indicates client's self-declaration for FATCA. + final int? fatcaDeclaration; + /// Contains features that are enabled or disabled for this user final FeatureFlag? featureFlag; @@ -299,6 +306,9 @@ abstract class GetSettingsModel { /// Telephone (note: Only available for users who have at least one real account) final String? phone; + /// The status of the Phone Number Verification. + final PhoneNumberVerification? phoneNumberVerification; + /// Place of birth, 2-letter country code. final String? placeOfBirth; @@ -320,6 +330,12 @@ abstract class GetSettingsModel { /// Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. final String? taxResidence; + /// [Optional] Whether the client has skipped the TIN form. Only applicable for real money account. + final bool? tinSkipped; + + /// Terms and condition status tells us whether all the accounts of this user has accepted the latest T&C version. + final Map? tncStatus; + /// Boolean value 1 or 0, indicating if client has enabled the Trading Hub dashboard final int? tradingHub; @@ -348,6 +364,7 @@ class GetSettings extends GetSettingsModel { super.email, super.emailConsent, super.employmentStatus, + super.fatcaDeclaration, super.featureFlag, super.firstName, super.hasSecretAnswer, @@ -356,6 +373,7 @@ class GetSettings extends GetSettingsModel { super.lastName, super.nonPepDeclaration, super.phone, + super.phoneNumberVerification, super.placeOfBirth, super.preferredLanguage, super.requestProfessionalStatus, @@ -363,6 +381,8 @@ class GetSettings extends GetSettingsModel { super.salutation, super.taxIdentificationNumber, super.taxResidence, + super.tinSkipped, + super.tncStatus, super.tradingHub, super.userHash, }); @@ -389,6 +409,7 @@ class GetSettings extends GetSettingsModel { employmentStatus: json['employment_status'] == null ? null : employmentStatusEnumMapper[json['employment_status']], + fatcaDeclaration: json['fatca_declaration'], featureFlag: json['feature_flag'] == null ? null : FeatureFlag.fromJson(json['feature_flag']), @@ -406,6 +427,10 @@ class GetSettings extends GetSettingsModel { lastName: json['last_name'], nonPepDeclaration: getBool(json['non_pep_declaration']), phone: json['phone'], + phoneNumberVerification: json['phone_number_verification'] == null + ? null + : PhoneNumberVerification.fromJson( + json['phone_number_verification']), placeOfBirth: json['place_of_birth'], preferredLanguage: json['preferred_language'], requestProfessionalStatus: getBool(json['request_professional_status']), @@ -413,6 +438,8 @@ class GetSettings extends GetSettingsModel { salutation: json['salutation'], taxIdentificationNumber: json['tax_identification_number'], taxResidence: json['tax_residence'], + tinSkipped: getBool(json['tin_skipped']), + tncStatus: json['tnc_status'], tradingHub: json['trading_hub'], userHash: json['user_hash'], ); @@ -442,6 +469,7 @@ class GetSettings extends GetSettingsModel { .firstWhere((MapEntry entry) => entry.value == employmentStatus) .key; + resultMap['fatca_declaration'] = fatcaDeclaration; if (featureFlag != null) { resultMap['feature_flag'] = featureFlag!.toJson(); } @@ -458,6 +486,10 @@ class GetSettings extends GetSettingsModel { resultMap['last_name'] = lastName; resultMap['non_pep_declaration'] = nonPepDeclaration; resultMap['phone'] = phone; + if (phoneNumberVerification != null) { + resultMap['phone_number_verification'] = + phoneNumberVerification!.toJson(); + } resultMap['place_of_birth'] = placeOfBirth; resultMap['preferred_language'] = preferredLanguage; resultMap['request_professional_status'] = requestProfessionalStatus; @@ -465,6 +497,8 @@ class GetSettings extends GetSettingsModel { resultMap['salutation'] = salutation; resultMap['tax_identification_number'] = taxIdentificationNumber; resultMap['tax_residence'] = taxResidence; + resultMap['tin_skipped'] = tinSkipped; + resultMap['tnc_status'] = tncStatus; resultMap['trading_hub'] = tradingHub; resultMap['user_hash'] = userHash; @@ -490,6 +524,7 @@ class GetSettings extends GetSettingsModel { String? email, bool? emailConsent, EmploymentStatusEnum? employmentStatus, + int? fatcaDeclaration, FeatureFlag? featureFlag, String? firstName, bool? hasSecretAnswer, @@ -498,6 +533,7 @@ class GetSettings extends GetSettingsModel { String? lastName, bool? nonPepDeclaration, String? phone, + PhoneNumberVerification? phoneNumberVerification, String? placeOfBirth, String? preferredLanguage, bool? requestProfessionalStatus, @@ -505,6 +541,8 @@ class GetSettings extends GetSettingsModel { String? salutation, String? taxIdentificationNumber, String? taxResidence, + bool? tinSkipped, + Map? tncStatus, int? tradingHub, String? userHash, }) => @@ -527,6 +565,7 @@ class GetSettings extends GetSettingsModel { email: email ?? this.email, emailConsent: emailConsent ?? this.emailConsent, employmentStatus: employmentStatus ?? this.employmentStatus, + fatcaDeclaration: fatcaDeclaration ?? this.fatcaDeclaration, featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, hasSecretAnswer: hasSecretAnswer ?? this.hasSecretAnswer, @@ -536,6 +575,8 @@ class GetSettings extends GetSettingsModel { lastName: lastName ?? this.lastName, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, phone: phone ?? this.phone, + phoneNumberVerification: + phoneNumberVerification ?? this.phoneNumberVerification, placeOfBirth: placeOfBirth ?? this.placeOfBirth, preferredLanguage: preferredLanguage ?? this.preferredLanguage, requestProfessionalStatus: @@ -545,6 +586,8 @@ class GetSettings extends GetSettingsModel { taxIdentificationNumber: taxIdentificationNumber ?? this.taxIdentificationNumber, taxResidence: taxResidence ?? this.taxResidence, + tinSkipped: tinSkipped ?? this.tinSkipped, + tncStatus: tncStatus ?? this.tncStatus, tradingHub: tradingHub ?? this.tradingHub, userHash: userHash ?? this.userHash, ); @@ -590,3 +633,102 @@ class FeatureFlag extends FeatureFlagModel { wallet: wallet ?? this.wallet, ); } + +/// Phone number verification model class. +abstract class PhoneNumberVerificationModel { + /// Initializes Phone number verification model class . + const PhoneNumberVerificationModel({ + required this.verified, + this.challengeAttemptsRemaining, + this.nextAttempt, + this.nextEmailAttempt, + this.nextVerifyAttempt, + this.sessionTimestamp, + this.verifyAttemptsRemaining, + }); + + /// Indicates the verification status of the client's phone number. + final bool verified; + + /// Indicates the attempts remaining for /phone_number_challenge + final int? challengeAttemptsRemaining; + + /// (Optional) Indicates the timestamp for the next verification attempt + final int? nextAttempt; + + /// (Optional) Indicates the timestamp for the next email verification attempt + final int? nextEmailAttempt; + + /// (Optional) Indicates the timestamp for the next verify attempt + final int? nextVerifyAttempt; + + /// (Optional) Indicates the timestamp for the current's session email code expiry + final DateTime? sessionTimestamp; + + /// Indicates the attempts remaining for /phone_number_verification + final int? verifyAttemptsRemaining; +} + +/// Phone number verification class. +class PhoneNumberVerification extends PhoneNumberVerificationModel { + /// Initializes Phone number verification class. + const PhoneNumberVerification({ + required super.verified, + super.challengeAttemptsRemaining, + super.nextAttempt, + super.nextEmailAttempt, + super.nextVerifyAttempt, + super.sessionTimestamp, + super.verifyAttemptsRemaining, + }); + + /// Creates an instance from JSON. + factory PhoneNumberVerification.fromJson(Map json) => + PhoneNumberVerification( + verified: getBool(json['verified'])!, + challengeAttemptsRemaining: json['challenge_attempts_remaining'], + nextAttempt: json['next_attempt'], + nextEmailAttempt: json['next_email_attempt'], + nextVerifyAttempt: json['next_verify_attempt'], + sessionTimestamp: getDateTime(json['session_timestamp']), + verifyAttemptsRemaining: json['verify_attempts_remaining'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['verified'] = verified; + resultMap['challenge_attempts_remaining'] = challengeAttemptsRemaining; + resultMap['next_attempt'] = nextAttempt; + resultMap['next_email_attempt'] = nextEmailAttempt; + resultMap['next_verify_attempt'] = nextVerifyAttempt; + resultMap['session_timestamp'] = + getSecondsSinceEpochDateTime(sessionTimestamp); + resultMap['verify_attempts_remaining'] = verifyAttemptsRemaining; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PhoneNumberVerification copyWith({ + bool? verified, + int? challengeAttemptsRemaining, + int? nextAttempt, + int? nextEmailAttempt, + int? nextVerifyAttempt, + DateTime? sessionTimestamp, + int? verifyAttemptsRemaining, + }) => + PhoneNumberVerification( + verified: verified ?? this.verified, + challengeAttemptsRemaining: + challengeAttemptsRemaining ?? this.challengeAttemptsRemaining, + nextAttempt: nextAttempt ?? this.nextAttempt, + nextEmailAttempt: nextEmailAttempt ?? this.nextEmailAttempt, + nextVerifyAttempt: nextVerifyAttempt ?? this.nextVerifyAttempt, + sessionTimestamp: sessionTimestamp ?? this.sessionTimestamp, + verifyAttemptsRemaining: + verifyAttemptsRemaining ?? this.verifyAttemptsRemaining, + ); +} diff --git a/lib/basic_api/generated/get_settings_send.dart b/lib/basic_api/generated/get_settings_send.dart index 3f666ef92f..b97dcae370 100644 --- a/lib/basic_api/generated/get_settings_send.dart +++ b/lib/basic_api/generated/get_settings_send.dart @@ -28,7 +28,7 @@ class GetSettingsRequest extends Request { /// Must be `true` final bool? getSettings; - /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + /// [Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize. final String? loginid; /// Converts this instance to JSON diff --git a/lib/basic_api/generated/set_settings_send.dart b/lib/basic_api/generated/set_settings_send.dart index f6554a1df5..572b4713d0 100644 --- a/lib/basic_api/generated/set_settings_send.dart +++ b/lib/basic_api/generated/set_settings_send.dart @@ -36,6 +36,7 @@ class SetSettingsRequest extends Request { this.setSettings = true, this.taxIdentificationNumber, this.taxResidence, + this.tinSkipped, this.tradingHub, super.msgType = 'set_settings', super.passthrough, @@ -78,6 +79,8 @@ class SetSettingsRequest extends Request { json['set_settings'] == null ? null : json['set_settings'] == 1, taxIdentificationNumber: json['tax_identification_number'] as String?, taxResidence: json['tax_residence'] as String?, + tinSkipped: + json['tin_skipped'] == null ? null : json['tin_skipped'] == 1, tradingHub: json['trading_hub'] == null ? null : json['trading_hub'] == 1, passthrough: json['passthrough'] as Map?, @@ -123,13 +126,13 @@ class SetSettingsRequest extends Request { /// [Optional] Enable or disable one or multiple features. final Map? featureFlag; - /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes (can only be changed on unauthenticated svg accounts). + /// [Optional] Within 1-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes (can only be changed on unauthenticated svg accounts). final String? firstName; - /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes (can only be changed on unauthenticated svg accounts). + /// [Optional] Within 1-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes (can only be changed on unauthenticated svg accounts). final String? lastName; - /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + /// [Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize. final String? loginid; /// [Optional] Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). Effective for real accounts only. @@ -168,6 +171,9 @@ class SetSettingsRequest extends Request { /// [Optional] Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. Required for maltainvest landing company. final String? taxResidence; + /// [Optional] Whether the client has skipped the TIN form. Only applicable for real money account. + final bool? tinSkipped; + /// [Optional] Enable/Disable Trading Hub dashboard final bool? tradingHub; @@ -218,6 +224,11 @@ class SetSettingsRequest extends Request { : 0, 'tax_identification_number': taxIdentificationNumber, 'tax_residence': taxResidence, + 'tin_skipped': tinSkipped == null + ? null + : tinSkipped! + ? 1 + : 0, 'trading_hub': tradingHub == null ? null : tradingHub! @@ -258,6 +269,7 @@ class SetSettingsRequest extends Request { bool? setSettings, String? taxIdentificationNumber, String? taxResidence, + bool? tinSkipped, bool? tradingHub, Map? passthrough, int? reqId, @@ -293,6 +305,7 @@ class SetSettingsRequest extends Request { taxIdentificationNumber: taxIdentificationNumber ?? this.taxIdentificationNumber, taxResidence: taxResidence ?? this.taxResidence, + tinSkipped: tinSkipped ?? this.tinSkipped, tradingHub: tradingHub ?? this.tradingHub, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId,