summaryrefslogtreecommitdiff
path: root/lib/super_good
AgeCommit message (Collapse)Author
2021-04-13Consider promotions in default shipping calculatorNoah Silvera
Previously, the shipment_total method on order was used, which does not take into account shipment promotions. Instead, we should manually sum the shipment cost taking into account any adjustments. Co-authored-by: Nick Van Doorn <nick@super.gd>
2021-03-25Add nexus regions method to APINicholas Van Doorn
We want to start syncing nexus data from TaxJar to this extension. As such we start by implementing an API call to fetch nexus regions from TaxJar. Future commits should offer path for users to persist this data in their Solidus store. Co-authored-by: Noah Silvera <noah@super.gd> Co-authored-by: Adnan Abdulally <adnan.abdulally@printivity.com>
2021-03-25Bump super_good-solidus_taxjar to 0.18.1Jared Norman
2021-03-24Fix `.default_taxjar_client`Nicholas Van Doorn
In #34, we modified `.default_taxjar_client` to include the API version, and then the name of the plugin, but we also introduced a critical bug. `Taxjar::Client#set_api_config` returns a hash and not the TaxJar client, so it is not safe to chain the method call. As such, we add a spec to cover this case and patch the class method. Co-authored-by: Noah Silvera <noah@super.gd>
2021-03-18Fix typo in `validate_address_params` helperChris Todorov
This change fixes a typo in the params helper for addresses without a `state` association. This was a previously untested behaviour so we never caught this. This change also marks the failing test as no longer pending.
2021-03-17Update CHANGELOG.mdAdnan Abdulally
Add information around the breaking changes added and upgrade instructions for 0.17.X to 0.18.X Co-authored-by: Nick Van Doorn <nick@super.gd>
2021-03-17Rename classes that have API in their name to ApiAdnan Abdulally
This done so Zeitwerk can correctly can correctly load the class from the filename. Co-authored-by: Nick Van Doorn <nick@super.gd>
2021-03-17Rename module SolidusTaxJar to SolidusTaxjarAdnan Abdulally
In order for the Zeitwerk loader to properly identity our classes from the file names, we should remove camel casing from this name that isn't consistent with underscores in the file name itself. Co-authored-by: Nick Van Doorn <nick@super.gd>
2021-03-10Update the engine nameNoah Silvera
Once we add an install generator with migrations, having an engine name with a dash in it will cause the migration generation to fail, as migrations will be created with the engine name in it, and dashes are not allowed. Co-authored-by: Nick Van Doorn <nick@super.gd>
2021-02-25Merge pull request #41 from nvandoorn/put-plugin-name-in-headersNoah Silvera
Put plugin name in API request headers
2021-02-24Put plugin name in API request headersNicholas Van Doorn
To meet Taxjar's certification requirements, we need to supply a 'plugin' name in each API request header. As such we add this header where the API version header is supplied. Co-authored-by: Noah Silvera <noah@super.gd>
2021-02-22Add Taxjar Rails engineNoah Silvera
Upcoming work to get this extension officially certified with Taxjar will require the addition of UI components into the solidus backend. Creating a rails engine for the new rails components of this extension is a prerequisite to any UI work. Co-authored-by: Nick Van Doorn <nick@super.gd> Co-authored-by: Adam Mueller <adam@super.gd>
2021-02-08Include API version in request headersNicholas Van Doorn
TaxJar requires certified extensions to include an API version in the header of each request. This extensions wraps the official TaxJar Ruby Gem with another API client, so we make sure the version gets set in when our wrapper class is constructed. Co-authored-by: Noah Silvera <noah@super.gd>
2020-07-21Fix handling of no results for address validationAdam Mueller
According to the documentation, and some testing, the API will raise a Taxjar::Error::NotFound error if the API finds no addresses. Instead of raising this error to others, we should handle it ourselves and return nil/an empty array like we originally intended. https://developers.taxjar.com/api/reference/#post-validate-an-address
2020-07-14Add ability to fetch address possibilitiesJared Norman
2020-07-14Add convenient class for normalizing addressesJared Norman
2020-07-14Refactor API class instantiationJared Norman
This is used by any class that interacts with the TaxJar API and is meant to be able to be consumed by applications for custom needs, so let's just make it exposed at the top level.
2020-07-14Add API call to validate addressesJared Norman
This adds support to the API module for performing address validation lookups. It doesn't hook anything up to that, but you can now call: SuperGood::SolidusTaxjar.new.validate_spree_address(address) to hit the TaxJar address validation API and a list of validated addresses back.
2020-07-14Add param generation for validate_address endpointJared Norman
I'm going to add support for address validation. This is the first step, ensuring that we can take a Spree::Address and transform it into the params that TaxJar expects for the address validation endpoint.
2020-07-14Run project through standardrbJared Norman
2020-05-27v0.17.1v0.17.1Jared Norman
2020-05-26Use shipping_calculator lambda for order shipping paramandrea longhi
`APIParams#order_params` should use the `shipping_calculator` lambda instead of a hardcoded value for providing shipping costs to TaxJar.
2020-02-03v0.17.0v0.17.0Jared Norman
2020-02-03Add support for modifying order paramsJared Norman
2020-02-02v0.16.0v0.16.0Jared Norman
2020-01-22Remove unnecessay safe navigatorandrea longhi
The safe navigator is not necessary here, as all other method calls on `address` don't have it.
2020-01-22Avoid raising unnecessary errors with incomplete addressandrea longhi
When validating addresses, it may happen that the address has no country, so trying to fetch the country ISO raises an unnecessary error. Using ruby safe navigation prevents this to happen. Of course, the address will still result invalid eventually.
2020-01-14Add tax rate calculator classandrea longhi
This new calculator allows to retrieve tax rate information starting from a `Spree::Address` model. It shares some logic with the tax calculator, for example the ability to handle exceptions using `SolidusTaxJar.exception_handler` lambda.
2020-01-14Add SolidusTaxJar::API#tax_rate_forandrea longhi
When calculating tax rates, the recommended endpoint from TaxJar support for live calculations is `/v2/taxes`, the same used for calculating order taxes, as it accounts for all factors like sourcing or nexus, while the `/v2/rates` endpoint will return the full combined rate for the queried location.
2020-01-14Add SolidusTaxJar::APIParams.tax_rate_address_paramsandrea longhi
This helper converts a `Spree::Address` to address params that can be used to retrieve the tax rate for that location.
2020-01-14Add generic default cache_key procandrea longhi
`SuperGood::SolidusTaxJar.cache_key` uses different `APIParams` methods for calculating cache keys for different models.
2020-01-14Add CalculatorHelper for sharing logicandrea longhi
This module includes helper methods that can be shared among different calculators.
2019-06-26v0.15.2v0.15.2Jared Norman
2019-06-26Add order number to params loggingJared Norman
Much easier to trace a request by doing this.
2019-06-25v0.15.1v0.15.1Jared Norman
2019-06-25Add loggingJared Norman
This will log the params sent to and responses received from TaxJar in order to facilitate debugging production issues.
2019-06-25Add option to control logging behaviourJared Norman
2019-06-25v0.15.0v0.15.0Jared Norman
2019-06-25Make cache key a stringJared Norman
2019-05-28v0.14.0v0.14.0Jared Norman
2019-05-28Make use of taxable order checkJared Norman
This just uses the taxable order check configuration added in the parent commit to provide a hook to short circuit order tax checks.
2019-05-28Add configuration option for order tax checkJared Norman
This will allow apps to use properties of an order to determine whether an order is taxable.
2019-05-20v0.13.0v0.13.0Jared Norman
2019-05-13Send customer_id to TaxJar APIJared Norman
This is required to support per-customer exemptions through the TaxJar API.
2019-04-24Bump to v0.12.0v0.12.0Jared Norman
2019-04-24More hacks to handle zero dollar ordersJared Norman
I have a plan for how to handle these better in v1.0 though!
2019-04-24Report no tax collected when order zeroed outJared Norman
2019-04-11Bump to v0.11.1v0.11.1Jared Norman
2019-04-11Avoid sending negative order totalsJared Norman
If an order is adjusted to zero, we don't want to subtract the tax from it... because that don't make no sense. A better solution that properly factors in order level adjustments will be coming eventually, this is just a hack to process some orders immediately.
2019-04-11Bump to v0.11.0v0.11.0Jared Norman