You are here

function commerce_worldpay_bg_convert_wppr_to_record in Commerce Worldpay 7

This maps the posted data from WorldPay to the local record structure.

Parameters

$wppr: WorldPay payment response post data.

Return value

array

1 call to commerce_worldpay_bg_convert_wppr_to_record()
commerce_worldpay_bg_response_page in includes/commerce_worldpay_bg.page.inc
Page callback that listens for transaction information from WorldPay.

File

./commerce_worldpay_bg.module, line 1015
Provides a Worldpay Business Gateway payment method for Drupal Commerce.

Code

function commerce_worldpay_bg_convert_wppr_to_record($wppr) {
  return array(
    'wp_txn_id' => (int) $wppr['transId'],
    'authmode' => $wppr['authMode'],
    'transaction_status' => $wppr['transStatus'],
    'name' => $wppr['name'],
    'shoppers_email' => $wppr['email'],
    'company_name' => isset($wppr['companyName']) ? $wppr['companyName'] : '',
    'currency' => $wppr['currency'],
    'amount' => $wppr['amount'],
    'auth_amount' => $wppr['authAmount'],
    'auth_currency' => $wppr['authCurrency'],
    'raw_auth_message' => $wppr['rawAuthMessage'],
    'waf_merch_message' => isset($wppr['wafMerchMessage']) ? $wppr['wafMerchMessage'] : '',
    'avs' => $wppr['AVS'],
    'authentication' => isset($wppr['authentication']) ? $wppr['authentication'] : '',
    'ip_address' => $wppr['ipAddress'],
    'transaction_time' => round($wppr['transTime'] / 1000),
    'test_mode' => isset($wppr['testMode']) && $wppr['testMode'] > 0 ? 1 : 0,
  );
}