Fix the zip core error on trial initiation (#10100)

This commit is contained in:
cyprain-okeke 2024-07-13 07:19:46 +01:00 committed by GitHub
parent 06cf849b18
commit 410d1c6394
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 37 deletions

View File

@ -112,7 +112,7 @@ export class TrialBillingStepComponent implements OnInit {
}
protected changedCountry() {
this.paymentComponent.hideBank = this.taxInfoComponent.taxInfo.country !== "US";
this.paymentComponent.hideBank = this.taxInfoComponent.taxFormGroup.value.country !== "US";
if (
this.paymentComponent.hideBank &&
this.paymentComponent.method === PaymentMethodType.BankAccount
@ -206,13 +206,13 @@ export class TrialBillingStepComponent implements OnInit {
private getBillingInformationFromTaxInfoComponent(): BillingInformation {
return {
postalCode: this.taxInfoComponent.taxInfo.postalCode,
country: this.taxInfoComponent.taxInfo.country,
taxId: this.taxInfoComponent.taxInfo.taxId,
addressLine1: this.taxInfoComponent.taxInfo.line1,
addressLine2: this.taxInfoComponent.taxInfo.line2,
city: this.taxInfoComponent.taxInfo.city,
state: this.taxInfoComponent.taxInfo.state,
postalCode: this.taxInfoComponent.taxFormGroup?.value.postalCode,
country: this.taxInfoComponent.taxFormGroup?.value.country,
taxId: this.taxInfoComponent.taxFormGroup?.value.taxId,
addressLine1: this.taxInfoComponent.taxFormGroup?.value.line1,
addressLine2: this.taxInfoComponent.taxFormGroup?.value.line2,
city: this.taxInfoComponent.taxFormGroup?.value.city,
state: this.taxInfoComponent.taxFormGroup?.value.state,
};
}

View File

@ -108,8 +108,8 @@ export class PremiumComponent implements OnInit {
fd.append("paymentToken", result[0]);
}
fd.append("additionalStorageGb", (this.additionalStorage || 0).toString());
fd.append("country", this.taxInfoComponent.taxInfo.country);
fd.append("postalCode", this.taxInfoComponent.taxInfo.postalCode);
fd.append("country", this.taxInfoComponent?.taxFormGroup?.value.country);
fd.append("postalCode", this.taxInfoComponent?.taxFormGroup?.value.postalCode);
return this.apiService.postPremium(fd);
})
.then((paymentResponse) => {

View File

@ -55,8 +55,9 @@ export class AdjustPaymentDialogComponent {
}
submit = async () => {
if (!this.taxInfoComponent.taxFormGroup.valid) {
if (!this.taxInfoComponent?.taxFormGroup.valid && this.taxInfoComponent?.taxFormGroup.touched) {
this.taxInfoComponent.taxFormGroup.markAllAsTouched();
return;
}
const request = new PaymentRequest();
const response = this.paymentComponent.createPaymentToken().then((result) => {

View File

@ -315,17 +315,6 @@ export class TaxInfoComponent {
];
taxRates: TaxRateResponse[];
// private pristine: TaxInfoView = {
// taxId: null,
// line1: null,
// line2: null,
// city: null,
// state: null,
// postalCode: null,
// country: "US",
// includeTaxId: false,
// };
constructor(
private apiService: ApiService,
private route: ActivatedRoute,
@ -435,8 +424,6 @@ export class TaxInfoComponent {
try {
const taxInfo = await this.apiService.getTaxInfo();
if (taxInfo) {
// this.taxInfo.postalCode = taxInfo.postalCode;
// this.taxInfo.country = taxInfo.country || "US";
this.postalCode = taxInfo.postalCode;
this.country = taxInfo.country || "US";
}
@ -451,8 +438,6 @@ export class TaxInfoComponent {
this.taxFormGroup.get("postalCode").updateValueAndValidity();
}
//this.pristine = Object.assign({}, this.taxInfo);
// If not the default (US) then trigger onCountryChanged
if (this.country !== "US") {
this.onCountryChanged.emit();
}
@ -487,7 +472,6 @@ export class TaxInfoComponent {
get taxRate() {
if (this.taxRates != null) {
const localTaxRate = this.taxRates.find(
//(x) => x.country === this.taxInfo.country && x.postalCode === this.taxInfo.postalCode,
(x) => x.country === this.country && x.postalCode === this.postalCode,
);
return localTaxRate?.rate ?? null;
@ -578,16 +562,6 @@ export class TaxInfoComponent {
return this.taxSupportedCountryCodes.includes(countryCode);
}
// private hasChanged(): boolean {
// for (const key in this.taxInfo) {
// // eslint-disable-next-line
// if (this.pristine.hasOwnProperty(key) && this.pristine[key] !== this.taxInfo[key]) {
// return true;
// }
// }
// return false;
// }
private taxSupportedCountryCodes: string[] = [
"CN",
"FR",