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

View File

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

View File

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

View File

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