[interchange] PayflowPro: send discounted item prices; don't send IP if admin order

Josh Lavin <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit 8cf1f55e7c17f9569ae70e9632a66183e4ebca69
Author: Josh Lavin <[email protected]>
Date:   Thu Mar 13 11:51:25 2014 -0700

    PayflowPro: send discounted item prices; don't send IP if admin order

 lib/Vend/Payment/PayflowPro.pm |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/lib/Vend/Payment/PayflowPro.pm b/lib/Vend/Payment/PayflowPro.pm
index 568f6d4..50845ff 100644
--- a/lib/Vend/Payment/PayflowPro.pm
+++ b/lib/Vend/Payment/PayflowPro.pm
@@ -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++;
         }
     }
@@ -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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.