Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for shipping address #300

Merged
merged 2 commits into from Oct 7, 2016
Merged

Adds support for shipping address #300

merged 2 commits into from Oct 7, 2016

Conversation

chrissrogers
Copy link
Member

@chrissrogers chrissrogers commented Oct 6, 2016

  • Adds pricing class support for shipping address
  • Adds attachment procedure for shipping address
  • Establishes that shipping address holds precedence for billing address in tax calculations

Pricing API updates

let pricing = recurly.Pricing();
pricing.plan('basic', { quantity: 1 })
  .address({
    country: 'DE'
  })
  .shippingAddress({
    country: 'US',
    postal_code: '94129',
    vat_number: ''
  })
  .done(function (price) {
    // will calculate taxes based on shipping address and not (billing) address
  });

New pricing elements

<input data-recurly="shipping_address.country" type="text">
<input data-recurly="shipping_address.postal_code" type="text">

- Adds pricing class support for shipping address
- Adds attachment procedure for shipping address
- Establlishes that shipping address holds precedence for billing address in tax calculations

Signed-off-by: Christopher Rogers <chrissrogers@gmail.com>
Signed-off-by: Christopher Rogers <chrissrogers@gmail.com>
@@ -93,7 +95,8 @@ Calculations.prototype.tax = function (done) {
this.price.now.tax = 0;
this.price.next.tax = 0;

var taxInfo = merge({}, this.items.address);
const address = this.items.shipping_address || this.items.address;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line determines address precedence. We calculate tax from shipping address first, then address if none is present

@snodgrass23
Copy link
Contributor

👍

@snodgrass23 snodgrass23 merged commit cd1ccac into master Oct 7, 2016
@snodgrass23 snodgrass23 deleted the shipping-address branch October 7, 2016 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants