From 3619f92b394dd1a57026ec0ae570cb977dc704b3 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Fri, 7 Jun 2024 17:25:10 +0530 Subject: [PATCH 1/6] TAXENGG-2594 Added evidence object to support fields to validate location of customer --- gradle.properties | 2 +- spec/spi/openapi_tax.yml | 143 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 51023b8..ea2860f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ sonar_project_key=chargebee_cb-provider-spi build_project_name=cb-provider-spi build_group=org.chargebee.spi -build_version=0.0.7 +build_version=0.0.8-SNAPSHOT # Artifactory config to be controlled at build time by CI/CD artifactory_build_url=https://artifactory.url/maven/build artifactory_publish_url=https://artifactory.url/maven/publish diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index 290efbd..eda377a 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -96,6 +96,8 @@ paths: $ref: '#/components/examples/TaxEstimationRequestWithLineItemDiscount' TaxEstimationRequestWithCustomerExemption: $ref: '#/components/examples/TaxEstimationRequestWithCustomerExemption' + TaxEstimationRequestWithLocationValidation: + $ref: '#/components/examples/TaxEstimationRequestWithLocationValidation' responses: '200': description: "Tax estimated successfully for given line items." @@ -143,6 +145,8 @@ paths: $ref: '#/components/examples/InvoiceRequestSimple' InvoiceRequestWithTaxInclusive: $ref: '#/components/examples/InvoiceRequestWithTaxInclusive' + InvoiceRequestWithLocationValidation: + $ref: '#/components/examples/InvoiceRequestWithLocationValidation' responses: '201': description: "Invoice created successfully." @@ -1100,6 +1104,8 @@ components: hasNexus: type: boolean description: "Determines whether a tax nexus exists between the Seller and the tax authority at the address provided." + locationValidation: + $ref: '#/components/schemas/Evidence' CreditNoteType: type: string description: "Whether the credit note was created for the full amount on the invoice or only for a part of the invoice amount." @@ -1249,6 +1255,26 @@ components: type: string description: The country of the address following the ISO 3166-1 alpha-2 standard. maxLength: 2 + Evidence: + type: object + description: "Represent the properties to perform location validation." + properties: + ip: + type: string + description: "An ip to validate location, this would be an IP of customer to verify which country customer belong to." + maxLength: 50 + bin: + type: string + description: "The bank identification number, this is generally first or last 6 digit of card to identify country." + maxLength: 15 + paymentCountryCode: + type: string + description: "Country code belong to the payment method." + maxLength: 5 + billingCountryCode: + type: string + description: "Country code belong to the billing." + maxLength: 5 BasicErrorResponse: type: object description: The basic error response containing the error message and the help documentation link. @@ -1705,6 +1731,45 @@ components: taxIdentifiers: - id: taxCode value: PT12312 + TaxEstimationRequestWithLocationValidation: + description: A sample tax estimation request with location validation evidences. + value: + seller: + address: + line1: 412 63rd South Avenue + city: Baltimore + state: MD + country: US + postalCode: '21230' + customer: + name: John Doe + customerCode: customer_test + address: + line1: 59, Starlight Avenue + city: Newark + state: NJ + country: US + postalCode: '98712' + taxIdentifiers: + - id: exemptionCode + value: ex_gg1s2149812312 + locationValidation: + ip: 127.0.0.1 + bin: 457200 + paymentCountryCode: US + billingCountryCode: US + estimateDateTime: '2022-11-01T10:42:08.131+05:30' + currency: USD + lineItems: + - number: 1 + itemCode: cbWatch + description: A winding watch. + quantity: 1 + amount: 110 + isTaxInclusive: false + taxIdentifiers: + - id: taxCode + value: PT12312 TaxEstimationResponseWithCustomerExemption: description: A sample response to the tax estimation request for a tax-exempt customer using an exemption code. value: @@ -1981,6 +2046,84 @@ components: rate: 0.375 taxableAmount: 91.85 taxAmount: 0.34 + InvoiceRequestWithLocationValidation: + description: A request to create a simple invoice in the tax provider system with location validation. + value: + invoiceCode: inv_12345 + documentDateTime: 2024-06-07T11:42:08.131+05:30 + currency: USD + seller: + address: + line1: 412 63rd South Avenue + city: Baltimore + state: MD + country: US + postalCode: "21230" + customer: + name: John Doe + customerCode: customer_test + address: + line1: "20 W 34th St" + city: New York + state: NY + country: US + postalCode: "10001" + locationValidation: + ip: 127.0.0.1 + bin: 457200 + paymentCountryCode: US + billingCountryCode: US + subtotal: 91.85 + exemptAmount: 0 + discountAmount: 0 + taxableAmount: 91.85 + taxAmount: 8.15 + total: 100 + lineItems: + - number: 1 + itemCode: cbWatch + description: A winding watch. + quantity: 1 + amount: 100 + isTaxInclusive: true + isTaxable: true + taxIdentifiers: + - id: taxCode + value: PT12312 + discountAmount: 0 + subtotal: 100 + exemptAmount: 0 + taxableAmount: 91.85 + taxAmount: 8.15 + total: 100 + taxes: + - number: 1 + jurisdiction: + code: "24354" + type: STATE + name: NEW YORK + name: SELLER_USE + rate: 4 + taxableAmount: 91.85 + taxAmount: 3.67 + - number: 2 + jurisdiction: + code: "25353" + type: CITY + name: NEW YORK + name: SELLER_USE + rate: 4.5 + taxableAmount: 91.85 + taxAmount: 4.14 + - number: 3 + jurisdiction: + code: "79774" + type: OTHER + name: METROPOLITAN COMMUTER TRANSPORTATION DISTRICT + name: SELLER_USE + rate: 0.375 + taxableAmount: 91.85 + taxAmount: 0.34 InvoiceResponseWithTaxInclusive: description: A simple invoice in the tax provider system with tax inclusive. value: From 445cc5a605cc6e1b907f5cb44cae12f3e5f4d0f7 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Mon, 10 Jun 2024 11:09:49 +0530 Subject: [PATCH 2/6] TAXENGG-2594 Addressed review comment about description of api fields --- spec/spi/openapi_tax.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index eda377a..d2f2198 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -1257,23 +1257,23 @@ components: maxLength: 2 Evidence: type: object - description: "Represent the properties to perform location validation." + description: Represent the properties to perform location validation. properties: ip: type: string - description: "An ip to validate location, this would be an IP of customer to verify which country customer belong to." + description: The customer's IP to determine which country the customer belongs to. maxLength: 50 bin: type: string - description: "The bank identification number, this is generally first or last 6 digit of card to identify country." + description: The country associated with a card by using the first or last 6 digits of the Bank Identification Number. maxLength: 15 paymentCountryCode: type: string - description: "Country code belong to the payment method." + description: Identifies the country code associated with the payment method. maxLength: 5 billingCountryCode: type: string - description: "Country code belong to the billing." + description: Identifies the country code associated with the billing. maxLength: 5 BasicErrorResponse: type: object From 8115bebddbebb54debb077c05d3cb5075d07d286 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Tue, 11 Jun 2024 18:26:45 +0530 Subject: [PATCH 3/6] TAXENGG-2594 Removed billingCountryCode from evidence since customer address already has it --- spec/spi/openapi_tax.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index d2f2198..1ca6c35 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -1271,10 +1271,6 @@ components: type: string description: Identifies the country code associated with the payment method. maxLength: 5 - billingCountryCode: - type: string - description: Identifies the country code associated with the billing. - maxLength: 5 BasicErrorResponse: type: object description: The basic error response containing the error message and the help documentation link. @@ -1757,7 +1753,6 @@ components: ip: 127.0.0.1 bin: 457200 paymentCountryCode: US - billingCountryCode: US estimateDateTime: '2022-11-01T10:42:08.131+05:30' currency: USD lineItems: @@ -2072,7 +2067,6 @@ components: ip: 127.0.0.1 bin: 457200 paymentCountryCode: US - billingCountryCode: US subtotal: 91.85 exemptAmount: 0 discountAmount: 0 From 62b0d9610d8180179c4c3eb2ef301463b32e58f0 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Wed, 12 Jun 2024 11:20:15 +0530 Subject: [PATCH 4/6] TAXENGG-2594 Renamed customer property locationEvidence instead of locationValidation --- spec/spi/openapi_tax.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index 1ca6c35..e09fdbd 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -1104,7 +1104,7 @@ components: hasNexus: type: boolean description: "Determines whether a tax nexus exists between the Seller and the tax authority at the address provided." - locationValidation: + locationEvidence: $ref: '#/components/schemas/Evidence' CreditNoteType: type: string @@ -1257,7 +1257,7 @@ components: maxLength: 2 Evidence: type: object - description: Represent the properties to perform location validation. + description: Represent the properties for location evidence. properties: ip: type: string @@ -1749,7 +1749,7 @@ components: taxIdentifiers: - id: exemptionCode value: ex_gg1s2149812312 - locationValidation: + locationEvidence: ip: 127.0.0.1 bin: 457200 paymentCountryCode: US @@ -2063,7 +2063,7 @@ components: state: NY country: US postalCode: "10001" - locationValidation: + locationEvidence: ip: 127.0.0.1 bin: 457200 paymentCountryCode: US From 6e564ccccc0125ef7893b9b669840add8df06a44 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Wed, 12 Jun 2024 11:25:58 +0530 Subject: [PATCH 5/6] TAXENGG-2594 Renamed customer property locationEvidence instead of locationValidation --- spec/spi/openapi_tax.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index e09fdbd..77342d9 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -96,8 +96,8 @@ paths: $ref: '#/components/examples/TaxEstimationRequestWithLineItemDiscount' TaxEstimationRequestWithCustomerExemption: $ref: '#/components/examples/TaxEstimationRequestWithCustomerExemption' - TaxEstimationRequestWithLocationValidation: - $ref: '#/components/examples/TaxEstimationRequestWithLocationValidation' + TaxEstimationRequestWithLocationEvidence: + $ref: '#/components/examples/TaxEstimationRequestWithLocationEvidence' responses: '200': description: "Tax estimated successfully for given line items." @@ -145,8 +145,8 @@ paths: $ref: '#/components/examples/InvoiceRequestSimple' InvoiceRequestWithTaxInclusive: $ref: '#/components/examples/InvoiceRequestWithTaxInclusive' - InvoiceRequestWithLocationValidation: - $ref: '#/components/examples/InvoiceRequestWithLocationValidation' + InvoiceRequestWithLocationEvidence: + $ref: '#/components/examples/InvoiceRequestWithLocationEvidence' responses: '201': description: "Invoice created successfully." @@ -1727,8 +1727,8 @@ components: taxIdentifiers: - id: taxCode value: PT12312 - TaxEstimationRequestWithLocationValidation: - description: A sample tax estimation request with location validation evidences. + TaxEstimationRequestWithLocationEvidence: + description: A sample tax estimation request with location evidences. value: seller: address: @@ -2041,8 +2041,8 @@ components: rate: 0.375 taxableAmount: 91.85 taxAmount: 0.34 - InvoiceRequestWithLocationValidation: - description: A request to create a simple invoice in the tax provider system with location validation. + InvoiceRequestWithLocationEvidence: + description: A request to create a simple invoice in the tax provider system with location evidence. value: invoiceCode: inv_12345 documentDateTime: 2024-06-07T11:42:08.131+05:30 From 49beb64d70aacf1cafbfccceb048a70c9560d903 Mon Sep 17 00:00:00 2001 From: cb-ashokmor Date: Wed, 12 Jun 2024 18:19:13 +0530 Subject: [PATCH 6/6] TAXENGG-2594 Updated name of the Evidence object based in review feedback --- spec/spi/openapi_tax.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/spi/openapi_tax.yml b/spec/spi/openapi_tax.yml index 77342d9..e8ec886 100644 --- a/spec/spi/openapi_tax.yml +++ b/spec/spi/openapi_tax.yml @@ -1105,7 +1105,7 @@ components: type: boolean description: "Determines whether a tax nexus exists between the Seller and the tax authority at the address provided." locationEvidence: - $ref: '#/components/schemas/Evidence' + $ref: '#/components/schemas/CustomerLocationEvidence' CreditNoteType: type: string description: "Whether the credit note was created for the full amount on the invoice or only for a part of the invoice amount." @@ -1255,9 +1255,9 @@ components: type: string description: The country of the address following the ISO 3166-1 alpha-2 standard. maxLength: 2 - Evidence: + CustomerLocationEvidence: type: object - description: Represent the properties for location evidence. + description: Represent the properties for customer location evidence. properties: ip: type: string