I noticed our reps were making a couple partial payments for an order, whoever we were charging the full order balance for each payment. Ubercart would only show that we charged a partial payment. After looking at some code in uc_payflowpro.module when in the function _uc_payflowpro_cc_sale_xml() when _uc_payflowpro_invoice_xml($order) is called it doesn't pass in $amount. I changed that line to _uc_payflowpro_invoice_xml($order, $amount) and then i changed function _uc_payflowpro_invoice_xml($order) { to function _uc_payflowpro_invoice_xml($order,$amount = NULL){

Then where $xml gets set I made it:
$xml = '
' . intval($order->order_id) . '
' . check_plain(_uc_get_skus($order)) . '

' . trim(check_plain($order->billing_first_name . ' ' . $order->billing_last_name)) . '
' . check_plain($order->billing_phone) . '
' . check_plain($order->primary_email) . '
' . $order->uid . '

' .trim(check_plain($order->billing_street1 . ' ' . $order->billing_street2)) . '
' . check_plain($order->billing_city) . '
' . check_plain(uc_get_zone_code($order->billing_zone)) . '
' . check_plain($order->billing_postal_code) . '
' . check_plain($billing_country[0]['country_iso_code_2']) . '



' . check_plain($order->delivery_first_name . ' ' . $order->delivery_last_name) . '
' . check_plain($order->delivery_phone) . '
' . check_plain($order->primary_email) . '

' .trim(check_plain($order->delivery_street1 . ' ' . $order->delivery_street2)) . '
' . check_plain($order->delivery_city) . '
' . check_plain(uc_get_zone_code($order->delivery_zone)) . '
' . check_plain($order->delivery_postal_code) . '
' . check_plain($delivery_country[0]['country_iso_code_2']) . '


' . _uc_payflowpro_items_xml($order) . '
' . uc_currency_format($shipping, FALSE, FALSE, '.') . '
' . uc_currency_format($tax, FALSE, FALSE, '.') . '';
if ($amount){
$xml .= '' . uc_currency_format($amount, FALSE, FALSE, '.') . '';
} else {
$xml .= '' . uc_currency_format($order->order_total, FALSE, FALSE, '.') . '';
}
$xml .= '';

That way if its not a full amount getting charged it only passes in what was entered in the "Charge Amount:" box

Comments

marcusahle’s picture

Status: Fixed » Needs review
kwinters’s picture

That seems reasonable with a quick look, but I'll have to dive into the code to make sure.

Any chance you can provide the change as a patch file? It will be easier to review / apply, and the issue system strips out the xml. http://drupal.org/patch/create