Jump to content

Saving extra data on order payment


yaniv14

Recommended Posts

Hi,

 

I've created a new payment module and I am trying to save extra data on existing columns under ps_order_payment.

I am talking about the fields: card_number, card_brand, card_expiration & card_holder.

 

I cannot find any existing function that use those fields.

In validateOrder function I am only passing transaction_id in extra_vars, but I don't see anywhere in the function that is can use to save the columns I mentioned.

 

Help will be appreciated.

 

Using PS1.6

Link to comment
Share on other sites

Hi,

 

I've created a new payment module and I am trying to save extra data on existing columns under ps_order_payment.

I am talking about the fields: card_number, card_brand, card_expiration & card_holder.

 

I cannot find any existing function that use those fields.

In validateOrder function I am only passing transaction_id in extra_vars, but I don't see anywhere in the function that is can use to save the columns I mentioned.

 

Help will be appreciated.

 

Using PS1.6

 

hi...

 

i hope help for this link

 

http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5

 

you can use the hook display the order extra fileds.

 

thanks

Link to comment
Share on other sites

Just want to be sure that you are aware, by saving this information in your database, you are going to expose yourself to strict PCI compliance standards.  You really should avoid storing any of this information.  Instead of storing it, does your payment provider offer an API where you could obtain and display the information when required?

 

As for the actionPaymentCCAdd hook you want to use... there is no need to use a hook to add this information.  directly after you execute validateOrder, you would do something like this...

            // @since 1.5.0 Attach the Transaction ID to this Order
            if (version_compare(_PS_VERSION_, '1.5', '>='))
            {
                $new_order = new Order((int)$this->currentOrder);
                if (Validate::isLoadedObject($new_order))
                {
                    $payment = $new_order->getOrderPaymentCollection();
                    if (isset($payment[0]))
                    {
                        $payment[0]->transaction_id = pSQL($id);
                        $payment[0]->card_number = pSQL($card_number);
                        $payment[0]->card_brand = pSQL($card_brand);
                        $payment[0]->card_expiration = pSQL($card_expiration);
                        $payment[0]->card_holder = pSQL($card_holder);
                        $payment[0]->save();
                    }
                }
            }

this hook is executed when the payment record is saved to the database

  • 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...