Jump to content

Authorize.net transaction details is not store in database


kirubanidhi

Recommended Posts

Im using prestashop version 1.5.6. 

 

I've installed and configured the free Authorize.net module from Prestashop, and have the module in test mode.

 

I placed one order in my shop then received mail about my transaction details.

 

Check In prestashop back-office > Orders page. 

 

Ex: i attached my order image screenshot,


 

I checked ps_order_payment table inside transaction_id, Cart_number,Card_brand, card_expiration and Card_holder is getting empty value.

 

How to store that all transaction value to database.

 

Link to comment
Share on other sites

In prestashop order list view page.

 

If it is possible to store authorize.net details information such as transaction_id, car_number, card_brand, cart_type.

 

I refered below link but i could not find out any solution?

 

 

https://stackoverflow.com/questions/34987880/php-how-to-save-transaction-details-into-database-after-successful-payment-in

 

https://www.prestashop.com/forums/topic/450618-authorizenet-transaction-details-not-being-saved/

 

https://www.prestashop.com/forums/topic/348990-authorizenet-module-not-storing-transaction-details/

Edited by kirubanidhi (see edit history)
Link to comment
Share on other sites

Authorize.net transaction details is stored in database. I did resolved my problem.

 

I followed below steps to complete my problem.

 

Step 1:

 

Authorizeaim/validation.php:

Remove old case 1: code then add below code in validation.php line number 120

case 1: // Payment accepted

// $authorizeaim->setTransactionDetail($response);

$transaction_id = (string)$response[6];

 

// 50 => Card number (XXXX0000)

$card_number = (string)substr($response[50], -4);

 

// 51 => Card Mark (Visa, Master card)

$card_brand = (string)$response[51];

 

$card_expiration = Tools::safeOutput($_POST['x_exp_date_m'].'/'.$_POST['x_exp_date_y']);

// Card holder name

$card_holder = Tools::safeOutput($_POST['name']);

$transact_details=array($transaction_id,$card_number,$card_brand,$card_expiration,$card_holder);

 

 $authorizeaim->validateOrder((int)$cart->id,
            Configuration::get('PS_OS_PAYMENT'), (float)$response[9],
            $payment_method, $message, NULL, NULL, false, $customer->secure_key,$transact_details);

break ;

 

Step 2:

 

Add below code in Classes/PaymentModule.php file line number 130

public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
        $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
        $secure_key = false, $transact_details, Shop $shop = null)

 

replaced code null to $transaction_id line number 312,

 

if (isset($extra_vars['transaction_id'])) {
                    $transaction_id = $extra_vars['transaction_id'];
                } else if(isset($transact_details)){
                    $transaction_id=$transact_details[0];
                }

 

line number 318,

/*OrderPaymentFunction() is used to fill the transaction details in the orderpayment table and filled these details (such as transaction_id, Card number, Card Brand, Card expiration date and cardholder name) in backoffice Orders page.*/

           

            if(isset($transact_details)){
                $orderPayment=new OrderPayment();
                $order_payment= $orderPayment->OrderPaymentFunction($transact_details);
            } 

 

Step 3:

 

Add code in Override/Classes/PaymentModule.php file follow step 2 process in step 3

 

Step 4:

 

Add below code in classes/order/Orderpayment.php file end of the line 140

/*OrderPaymentFunction() is used to fill the transaction details in the orderpayment table and filled these details (such as transaction_id, Card number, Card Brand, Card expiration date and cardholder name) in backoffice Orders page.*/

 

    public function OrderPaymentFunction($transact_details){
        if(isset($transact_details)){
            $update="UPDATE `ps_order_payment` SET `card_number`='$transact_details[1]',
                                                    `card_brand`='$transact_details[2]',
                                                    `card_expiration`='$transact_details[3]',
                                                    `card_holder`='$transact_details[4]'
                                                    WHERE `transaction_id`=".(int)$transact_details[0];

            return Db::getInstance()->execute($update);
        }
    }

Edited by kirubanidhi (see edit history)
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...