Required field for shipment purchase missing for Canada Post
Closed this issue · 1 comments
cknoxrun commented
Sorry for submitting so many issues in a row like this, but I seem to be hitting one after another as I try to get return shipments working.
As I can't use return shipments using Canada Post (see #24), I was just going to purchase a label directly with the appropriate to and from addresses. However, I get the following response:
EasyPost::Error: (Status 400) Contract Number is a required field.
from /Users/knox/omx/kbase/vendor/ruby/2.2.0/gems/easypost-2.1.0/lib/easypost.rb:125:in `rescue in rescue in request'
The code looks like this:
from_address = EasyPost::Address.create(
name: order.name,
street1: order.street1,
street2: order.street2,
city: order.city,
state: order.province_state,
zip: order.postal_zip,
country: order.country,
email: order.email,
phone: order.phone
)
return_address = EasyPost::Address.create(
company: 'The Canadian BioSample Repository',
street1: 'The University of Alberta',
street2: 'Blah',
city: 'Edmonton',
state: 'AB',
zip: '...',
country: 'Canada',
email: '...',
phone: '...'
)
shipment = EasyPost::Shipment.create(
to_address: return_address,
from_address: from_address,
parcel: parcel
)
shipment.buy(rate: shipment.lowest_rate)
I've tried filling in invoice_number and tried add "contract_number" with an arbitrary number in case that would work around the issue but no dice.
Thanks a lot!
Craig
cknoxrun commented
This looks like it's a general issue with CanadaPost-EasyPost integration, I've emailed support so I'm going to close this issue as it isn't specific to the Ruby integration.