Amazon-MWS

 view release on metacpan or  search on metacpan

lib/Amazon/MWS/XML/Order.pm  view on Meta::CPAN

=cut

sub order_is_shipped {
    my $self = shift;
    my $status = $self->order_status;
    $status eq 'Shipped' ? return 1 : return;
}

=head2 order_status

Shortcut to orders' OrderStatus

=cut

sub order_status {
    return shift->order->{OrderStatus};
}

=head2 can_be_imported

Return false if the status is Pending or Canceled.

=cut

sub can_be_imported {
    my $self = shift;
    my $status = $self->order_status;
    if ($status eq 'Pending' or
        $status eq 'Canceled') {
        return;
    }
    else {
        return 1;
    }
}


=head2 shop_type

Returns C<amazon>

=head2 comments

Returns an empty string.

=head2 payment_method

Always returns C<Amazon>

=head2 shipping_method

Returns the generic ShipmentServiceLevelCategory (not the
ShipServiceLevel which is a non-typed string).

http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_Datatypes.html

Available values:

=over 4

=item Expedited

=item FreeEconomy

=item NextDay

=item SameDay

=item SecondDay

=item Scheduled

=item Standard

=back

Or the empty string if nothing is found.

=cut

sub shop_type {
    return 'amazon';
}

sub comments {
    # unclear if we have something like that
    return '';
}

sub payment_method {
    return 'Amazon';
}

sub shipping_method {
    # this should return
    my $order = shift->order;
    if (my $shipping = $order->{ShipmentServiceLevelCategory}) {
        return $shipping;
    }
    else {
        return '';
    }
}


1;



( run in 0.626 second using v1.01-cache-2.11-cpan-13bb782fe5a )