Business-CPI-Gateway-PayPal
view release on metacpan or search on metacpan
lib/Business/CPI/Gateway/PayPal.pm view on Meta::CPAN
price => "amount_$i",
quantity => "quantity_$i",
weight => {
name => "weight_$i",
coerce => sub { $_[0] }, # think about weight_unit
},
shipping => "shipping_$i",
shipping_additional => "shipping2_$i",
}
}
sub _checkout_form_buyer_map {
{
email => 'email',
address_line1 => 'address1',
address_line2 => 'address2',
address_city => 'city',
address_state => 'state',
address_country => {
name => 'country',
coerce => sub { uc $_[0] },
},
address_zip_code => 'zip',
}
}
sub _checkout_form_cart_map {
{
discount => 'discount_amount_cart',
handling => 'handling_cart',
tax => 'tax_cart',
}
}
around _get_hidden_inputs_for_items => sub {
my ($orig, $self, $items) = @_;
my $add_weight_unit = sub {
for (@$items) {
return 1 if $_->weight;
}
return 0;
}->();
my @result = $self->$orig($items);
if ($add_weight_unit) {
push @result, ( "weight_unit" => 'kgs' );
}
return @result;
};
sub get_hidden_inputs {
my ($self, $info) = @_;
return (
# -- make paypal accept multiple items (cart)
cmd => '_ext-enter',
redirect_cmd => '_cart',
upload => 1,
# --
invoice => $info->{payment_id},
no_shipping => $info->{buyer}->address_line1 ? 0 : 1,
$self->_get_hidden_inputs_main(),
$self->_get_hidden_inputs_for_buyer($info->{buyer}),
$self->_get_hidden_inputs_for_items($info->{items}),
$self->_get_hidden_inputs_for_cart($info->{cart}),
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Business::CPI::Gateway::PayPal - Business::CPI's PayPal driver
=head1 VERSION
version 0.905
=head1 ATTRIBUTES
=head2 sandbox
Boolean attribute to set whether it's running on sandbox or not. If it is, it
will post the form to the sandbox url in PayPal.
=head2 api_username
=head2 api_password
=head2 signature
=head2 nvp
Business::PayPal::NVP object, built using the api_username, api_password and
signature attributes.
=head2 date_format
DateTime::Format::Strptime object, to format dates in a way PayPal understands.
=head1 METHODS
=head2 notify
Translate IPN information from PayPal to a standard hash, the same way other
Business::CPI gateways do.
=head2 query_transactions
Searches transactions made by this account.
( run in 0.865 second using v1.01-cache-2.11-cpan-b16cb0d3907 )