Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PayflowPro: send discounted item prices; don't send IP if admin order
  • Loading branch information
Josh Lavin committed Mar 13, 2014
1 parent 06aded9 commit 8cf1f55
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lib/Vend/Payment/PayflowPro.pm
Expand Up @@ -615,25 +615,32 @@ sub payflowpro {
if($tender eq 'P') {
@query{keys %paypal_query} = values %paypal_query;
my $i = 0;
for my $it (@{$::Carts->{main}}) {
$query{'L_PAYMENTREQUEST_0_NAME' .$i} = $it->{description} || Vend::Data::item_description($it);
$query{'L_PAYMENTREQUEST_0_NUMBER' .$i} = $it->{code};
$query{'L_PAYMENTREQUEST_0_DESC' .$i} = Vend::Data::item_description($it);
$query{'L_PAYMENTREQUEST_0_AMT' .$i} = Vend::Data::item_price($it);
$query{'L_PAYMENTREQUEST_0_QTY' .$i} = $it->{quantity};
##$query{'L_PAYMENTREQUEST_0_TAXAMT'.$i} = (Vend::Data::item_price($it)/$itemTotal * $taxTotal);
$i++;
if ($action ne 'D') {
for my $it ( @{ $::Carts->{main} } ) {
my $it_price = Vend::Data::item_price($it);
my $disc_price = Vend::Interpolate::discount_price( $it, $it_price, $it->{quantity} );
#::logDebug("payflowpro: prices for $it->{code}: it_price=$it_price, disc_price=$disc_price");
$query{ 'L_PAYMENTREQUEST_0_NAME' . $i } = $it->{description} || Vend::Data::item_description($it);
$query{ 'L_PAYMENTREQUEST_0_NUMBER' . $i } = $it->{code};
$query{ 'L_PAYMENTREQUEST_0_DESC' . $i } = Vend::Data::item_description($it);
$query{ 'L_PAYMENTREQUEST_0_AMT' . $i } = $disc_price;
$query{ 'L_PAYMENTREQUEST_0_QTY' . $i } = $it->{quantity};
##$query{'L_PAYMENTREQUEST_0_TAXAMT' .$i} = ($disc_price/$itemTotal * $taxTotal);
$i++;
}
}
$opt->{check_sub} = undef;
}
else {
my $i = 1;
for my $it (@{$::Carts->{main}}) {
my $it_price = Vend::Data::item_price($it);
my $disc_price = Vend::Interpolate::discount_price($it, $it_price, $it->{quantity});
$query{'L_NAME' . $i} = $it->{description} || Vend::Data::item_description($it);
$query{'L_COST' . $i} = Vend::Data::item_price($it);
$query{'L_COST' . $i} = $disc_price;
$query{'L_QTY' . $i} = $it->{quantity};
$query{'L_SKU' . $i} = $it->{code};
##$query{'L_TAXAMT'.$i} = (Vend::Data::item_price($it)/$itemTotal * $taxTotal);
##$query{'L_TAXAMT'.$i} = ($disc_price/$itemTotal * $taxTotal);
$i++;
}
}
Expand All @@ -655,6 +662,9 @@ sub payflowpro {
}
}
else {
if ( $Vend::Session->{admin} and $::Values->{order_desk_entry} ) {
delete $query{CUSTIP}; # prevent 'IP/Address Mismatch' fraud reports for UI orders
}
## these not for PayPal authorizations, only capture/void (and credit cards):
$query{ORIGID} = $order_id;
$query{EXPDATE} = $exp;
Expand Down

0 comments on commit 8cf1f55

Please sign in to comment.