Search code examples
drupaldrupal-7payment-gatewaybillingccavenue

Drupal Auto fill billing information in cc avenue payment


I am using Drupal Commerce Cc Avenue as a payment gateway for my eCommerce site. During checkout step user enter his billing information. In the next step it verifies his/her order and redirects to Cc avenue payment gateway, there it asks user billing address again. I want to auto fill the user billing address which he/she enters in previous step. Is that possible to do?enter image description here


Solution

  • Finally found the answer with help of this issue queue https://www.drupal.org/node/2310505

    In commerce_ccavenue.module added few lines inside commerce_ccavenue_redirect_form($form, &$form_state, $order, $payment_method)

    $billing_address = $wrapper->commerce_customer_billing->commerce_customer_address->value();
      $order_data = array(
        'merchant_id' => $payment_method['settings']['merchant_id'],
        'amount' => $wrapper->commerce_order_total->amount->value() / 100,
        'order_id' => $order->order_id,
        'cancel_url' => url('checkout/' . $order->order_id . '/payment/back/' . $order->data['payment_redirect_key'], array('absolute' => TRUE)),
        'redirect_url' => url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], array('absolute' => TRUE)),
        'working_key' => $payment_method['settings']['working_key'],
        'access_code' => $payment_method['settings']['access_code'],
        'language' => 'EN',
        'currency' => $currency_code,
        'billing_name' => $billing_address['name_line'],
        'billing_address' => $billing_address['thoroughfare']. ' ' . $billing_address['premise'] . ' ' . $billing_address['sub_premise'],
        'billing_zip' => $billing_address['postal_code'],
        'billing_city' => $billing_address['locality'],
        'billing_state' => $billing_address['administrative_area'],
        'billing_country' => 'India',
      );
    

    These lines are missing inside commerce_ccavenue_redirect_form($form, &$form_state, $order, $payment_method). Works fine after adding those lines.