avadev/AvaTax-REST-V2-JS-SDK

Addresses undefined when using the `auditTransaction` function

BioSurienDG opened this issue ยท 5 comments

I updated my SDK and configured the client based on this PR:
#249 (comment)

However, now when I call await avatax.auditTransaction (as shown below) the address is undefined/empty as shown in my screenshots (- note I only show response but it also isn't in request for both reconstructed and original fields of the returned object).

await avatax.auditTransaction({
                    companyCode: companyCode,
                    transactionCode: salesInvoice.code,
                })

image

@BioSurienDG Are you referring to adding the enableStrictTypeConversion: true, property to the config?

If this is the case, could you share with me:

  1. A screenshot of the response model with the new property turned on.
  2. A screenshot of the response model with the new property turned off.
  3. A code sample of your audit transactions method call.

I tried it in my test harness and I am seeing the proper results. Either no address is there with the property on and off. or its there in both cases. I am wondering if the transaction you are looking at is not returning any address for response overall.

@svc-developer

  1. Here is a video with it turned on:
    https://www.loom.com/share/0a94365e82754906876742f35548fe8d
  2. Here is a video with it turned off (and working):
    https://www.loom.com/share/7db30ff15bcc4de3b5b422cb98c4cee4
  3. Here is my test code from the videos:
const avaTax = new AvaTaxClient({
            appName: 'myapp testing',
            appVersion: '1.0',
            machineName: 'test machine',
            environment: 'sandbox',
            timeout: 60000,
            enableStrictTypeConversion: true, // is false in the second video
        }).withSecurity({ accountId: config.avataxAccountId(), licenseKey: config.avataxLicenseKey() });
        const createTransactionModel: CreateTransactionModel = {
            type: DocumentType.SalesInvoice,
            companyCode: 'DEFAULT',
            customerCode: randomUUID(),
            commit: false,
            date: new Date(),
            addresses: {
                shipTo: {
                    line1: '123 Main Street',
                    city: 'Irvine',
                    region: 'CA',
                    country: 'US',
                    postalCode: '92614',
                },
                shipFrom: {
                    line1: '456 Main Street',
                    city: 'Irvine',
                    region: 'CA',
                    country: 'US',
                    postalCode: '92614',
                },
            },
            lines: [
                {
                    number: '1',
                    quantity: 1,
                    amount: 100,
                    itemCode: 'test-item',
                },
            ],
        };
        const transaction = await avaTax.createTransaction({ model: createTransactionModel });
        const audit = await avaTax.auditTransaction({ transactionCode: transaction.code, companyCode: 'DEFAULT' });
        const transactionRefetched = await avaTax.getTransactionByCode({
            transactionCode: transaction.code,
            companyCode: 'DEFAULT',
        });

I appreciate you taking the time to document that so thoroughly. I was able to reproduce the issue and ascertain the cause. I will put out a fix for it in the next release.

cc: @BioSurienDG

@svc-developer Any estimate for when you think the next release will be out?

Its here today - Fixed issue where case sensitive property names were causing deserialization failures due to mismatches between the swagger and the actual model properties This should be resolved with 23.4.1. Thanks for your patience @BioSurienDG