function commerce_payleap_direct_submit_form_submit in Commerce Payleap 7
Payment method callback: checkout form submission - Direct.
See also
TransactServices.svc/ProcessCreditCard - Sale (Transaction API Guide)
1 call to commerce_payleap_direct_submit_form_submit()
- commerce_payleap_cof_submit_form_submit in ./
commerce_payleap.module - Payment method callback: checkout form submission - Card on file.
File
- ./
commerce_payleap.module, line 394 - Implements PayLeap payment services for use in Drupal Commerce.
Code
function commerce_payleap_direct_submit_form_submit($payment_method, $pane_form, $pane_values, $order, $charge) {
$billing_data = commerce_payleap_get_billing_info($order);
$info = array(
'CardNum' => $pane_values['credit_card']['number'],
'ExpDate' => $pane_values['credit_card']['exp_month'] . substr($pane_values['credit_card']['exp_year'], 2, 2),
);
// Define correct transaction type delayed or direct.
switch ($payment_method['settings']['txn_type']) {
case COMMERCE_CREDIT_AUTH_CAPTURE:
$payment_method['settings']['txn_payleap_type'] = PAYLEAP_TXN_TYPE_DIRECT_CAPTURE;
$info['TransType'] = 'Sale';
break;
case COMMERCE_CREDIT_AUTH_ONLY:
$payment_method['settings']['txn_payleap_type'] = PAYLEAP_TXN_TYPE_DELAYED_CAPTURE;
$info['TransType'] = 'Auth';
break;
}
if (isset($pane_values['credit_card']['code'])) {
$info['CVNum'] = $pane_values['credit_card']['code'];
}
// Build a name-value pair array for this transaction.
$info += array(
'Amount' => commerce_currency_amount_to_decimal($charge['amount'], $charge['currency_code']),
'MagData' => '',
);
// Add additional transaction information to the request array.
$info += array(
'InvNum' => $order->order_number,
);
$info += array(
'NameOnCard' => $billing_data['name_on_card'],
'Street' => $billing_data['street'],
'Zip' => $billing_data['zip'],
'ExtData' => $billing_data['ext_data'],
);
// Send the tracking code.
$info['ExtData'] = '<CertifiedVendorId>' . PAYLEAP_COMMERCE_PARTNER_ID . '</CertifiedVendorId>';
return commerce_payleap_transaction_process($payment_method, $info, $order, $charge);
}