fix: QA bugs in Taxes App (#654)
* fix: 🐛 turn off validateAddress in TaxJar * refactor: ♻️ make avatax & taxjar schemas strict * fix: 🐛 update providers bug * build: 👷 add changeset * Update cold-candles-fly.md
This commit is contained in:
parent
c0d01db55d
commit
c4be200925
6 changed files with 17 additions and 7 deletions
5
.changeset/cold-candles-fly.md
Normal file
5
.changeset/cold-candles-fly.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"saleor-app-taxes": patch
|
||||
---
|
||||
|
||||
The update provider configuration views no longer return "invalid credentials" and "invalid address" errors in inappropriate cases. The latter required temporarily disabling the TaxJar address validation, as it currently doesn't work.
|
|
@ -13,7 +13,7 @@ import {
|
|||
avataxConnectionSchema,
|
||||
} from "../avatax-connection-schema";
|
||||
|
||||
const getSchema = avataxConnectionSchema;
|
||||
const getSchema = avataxConnectionSchema.strict();
|
||||
|
||||
export class AvataxConnectionRepository {
|
||||
private crudSettingsManager: CrudSettingsManager;
|
||||
|
@ -83,7 +83,7 @@ export class AvataxConnectionRepository {
|
|||
return result.data;
|
||||
}
|
||||
|
||||
async patch(id: string, input: AvataxConfig): Promise<void> {
|
||||
async patch(id: string, input: Pick<AvataxConnection, "config">): Promise<void> {
|
||||
return this.crudSettingsManager.update(id, input);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ export class AvataxConnectionService {
|
|||
|
||||
await validationService.validate(input);
|
||||
|
||||
return this.avataxConnectionRepository.patch(id, input);
|
||||
return this.avataxConnectionRepository.patch(id, { config: input });
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
import { TAX_PROVIDER_KEY } from "../../provider-connections/public-provider-connections.service";
|
||||
import { TaxJarConfig, TaxJarConnection, taxJarConnection } from "../taxjar-connection-schema";
|
||||
|
||||
const getSchema = taxJarConnection;
|
||||
const getSchema = taxJarConnection.strict();
|
||||
|
||||
export class TaxJarConnectionRepository {
|
||||
private crudSettingsManager: CrudSettingsManager;
|
||||
|
@ -79,7 +79,7 @@ export class TaxJarConnectionRepository {
|
|||
return result.data;
|
||||
}
|
||||
|
||||
async patch(id: string, input: TaxJarConfig): Promise<void> {
|
||||
async patch(id: string, input: Pick<TaxJarConnection, "config">): Promise<void> {
|
||||
return this.crudSettingsManager.update(id, input);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ export class TaxJarConnectionService {
|
|||
|
||||
await validationService.validate(input);
|
||||
|
||||
return this.taxJarConnectionRepository.patch(id, input);
|
||||
return this.taxJarConnectionRepository.patch(id, { config: input });
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
|
|
|
@ -46,7 +46,12 @@ export class TaxJarClient {
|
|||
return this.client.createOrder(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* TaxJar validateAddress doesn't work. It's turned off for now.
|
||||
* @see https://github.com/taxjar/taxjar-node/issues/70
|
||||
* @todo Revisit this when TaxJar fixes the issue. Alternatively, create a custom validation.
|
||||
*/
|
||||
async validateAddress({ params }: ValidateAddressArgs) {
|
||||
return this.client.validateAddress(params);
|
||||
// return this.client.validateAddress(params);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue