pullingshots / Shipment

Perl interface into various shipping web service API's - FedEx, UPS, Purolator, Temando, Canada Post
https://metacpan.org/pod/Shipment
19 stars 19 forks source link

Errors when setting insured_value #18

Closed a-jar closed 11 years ago

a-jar commented 12 years ago

Poking around I found you could set the insured_value when creating a package... However we can't seem to set it without throwing an error.

We set it during package creation like this:

Setup the package information

my @packages = (
    Shipment::Package->new(
        weight          => "$weight",
        length          => "$dim_length0",
        width           => "$dim_width0",
        height          => "$dim_height0",
        insured_value   => "$dec_value",
    ),
);

Which throws an error like this:

Attribute (insured_value) does not pass the type constraint because: Validation failed for 'Data::Currency' with value 111.00 (not isa Data::Currency) at /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/Moose/Meta/Attribute.pm line 1275

We've tried every possible formatting for the insured value... even formatting it with Data:Currency (my $fedex_value = Data::Currency->new($dec_value);) but nothing seems to work...

pullingshots commented 11 years ago

Sorry for the slow reply on this one. I can't seem to duplicate this. If I set the insured_value with Data::Currency, I don't get the error:

use Data::Currency;
my @packages = (
  Shipment::Package->new(
    weight => 10.1,
    length => 18,
    width => 18,
    height => 24,
    insured_value => Data::Currency->new(1),
  ),
);