Before I did too deep into the code, I was just wondering if anyone
else has had success with International USPS and if any branches of
Spree Active Shipping exist where this already works. Also if anyone
knows off-hand of any challenges that have prevented someone from
doing this already, that would be great to know. Thanks so much in
advance!
Jennifer
First suggestion would be to run rails console and create a shipping
quote manually, step by step so you can trace exact output at each
step.
On Feb 12, 4:31 pm, jumph4x <visible....@gmail.com> wrote:
> I think at one point I tried to contributeUSPSsupport to our Active
> Shipping extension but I'm not sure if that got accepted or not as I
> was just learning github and may have pressed a bunch of wrong buttons
> and gotten nowhere.
>
> First suggestion would be to run rails console and create a shipping
> quote manually, step by step so you can trace exact output at each
> step.
>
> On Feb 12, 5:03 pm, Jennifer Maas <jenniferm...@gmail.com> wrote:
>
> > I'm using Active Shipping for Spree, and it returns $0 for
> > international addresses using theUSPScalculators. I'm guessing I
> > need to create new calculators forUSPSInternational services.
>
> > Before I did too deep into the code, I was just wondering if anyone
> > else has had success with InternationalUSPSand if any branches of
The extension basically parses the array from USPS (or whichever
service provider) and then creates a nice hash with all of the
services the service provider offers and the price for each based on
the origin address and the shipping address. It then tries to match
the name of the service to a calculator. If it can't find one, it
just returns 0. This is questionable behavior, but that's another
issue. I was able to see what USPS was sending back when I sent it an
international address by logging the returned hash:
USPS Priority Mail International Flat Rate Envelope: 1345
USPS First-Class Mail International Large Envelope: 1056
USPS USPS GXG Envelopes: 6400
USPS Express Mail International Flat Rate Envelope: 2895
USPS First-Class Mail International Package: 1076
USPS Priority Mail International Medium Flat Rate Box: 4345
USPS Priority Mail International: 2800
USPS Global Express Guaranteed Non-Document Non-Rectangular: 6400
USPS Global Express Guaranteed Non-Document Rectangular: 6400
USPS Priority Mail International Large Flat Rate Box: 5595
USPS Global Express Guaranteed (GXG): 6400
USPS Express Mail International: 3350
USPS Priority Mail International Small Flat Rate Box: 1345
I wanted to do USPS Priority Mail International, so I created a file
called
/vendor/extensions/active_shipping/app/models/usps/
priority_mail_international.rb
class Calculator::Usps::PriorityMailInternational <
Calculator::Usps::Base
def self.description
"USPS Priority Mail International"
end
end
and then added a line to the activate method in
active_shipping_extension.rb
Calculator::Usps::PriorityMailInternational
I'm still having a problem with using UPS and USPS calculators at the
same time in a sale (it only queries UPS and so USPS services don't
match a calculator and return $0), but this first problem is solved.