Witam wszystkich,
mam problem z integracją usługi UPS z moją aplikacją. Korzystam z gema “active_shipping” (https://github.com/Shopify/active_shipping). Stworzyłem funkcję na potrzeby testowania która wygląda tak:
def create_ups_shipment
packages = [ActiveShipping::Package.new( 1000, [20,20,20])]
origin = ActiveShipping::Location.new(
:name => "Test",
:contact_name => "TEST",
:telephone => "+48123123123",
:email => "email@address.pl",
:country => 'PL',
:city => 'Krakow',
:street => 'Makowa 14',
:addr2 => "",
:postal_code => '30650'
)
destination = ActiveShipping::Location.new(
:name => "Test test",
:contact_name => "Test sp. z o.o.",
:telephone => "+48123123123",
:email => "test@address.pl",
:country => 'PL',
:city => 'Poznan',
:street => 'Warszawska 14',
:addr2 => "",
:postal_code => '61113'
)
ups = ActiveShipping::UPS.new(:login => '[my_acount_number]', :password => '[password]', :key => '[UPS_key]', :test => true)
response = ups.create_shipment(
origin,
destination,
packages,
{
:service_code => '11',
:test => true,
}
)
return response
end
Przy wywołaniu funkcji create_shipment dostaje następujący błąd:
RuntimeError: Could not obtain shipping label. Failure: The XML document is well formed but the document is not valid.
from /home/wiking/.rvm/gems/ruby-2.1.4/bundler/gems/active_shipping-626d17c779c3/lib/active_shipping/carriers/ups.rb:167:in `rescue in create_shipment'
from /home/wiking/.rvm/gems/ruby-2.1.4/bundler/gems/active_shipping-626d17c779c3/lib/active_shipping/carriers/ups.rb:137:in `create_shipment'
from /home/wiking/magazyny/app/models/delivery.rb:115:in `create_ups_shipment'
from (irb):27
Pewien jestem tylko połączenia w trybie testowym i adresów bo poprawnie przesłało mi je jak zamiast create_shipment testowałem funkcje ups.find_rates która zwracała cenik dla takiej przesyłki.
Czy ktoś spotkał się z podobnym problemem? Może znacie jakieś dobry przykład wykorzystania tego gema? byłbym wdzięczny za każdą pomoc.