0

I'm not pretty sure how to ask. But I'm gonna describe my scenario.

I'm integrating a new payment module that gets the credit card info and sends it to my bank to do a validation, then the bank return me some values and according to that I have to send it to another validation and after that send it to do the payment.

For the first validation I got the data in my controller with

$this->getRequest()->getPost()

and use it in my model for the first redirect. And after that I need to use that data again to do another redirect.

So my question is what can I do to preserve some data, is sensitive data like number of the credit card so I can't store it in the database.

Hope to be clear. Thank you.

EDIT:

PaymentController.php

public function redirectvalidationAction(){
        $session = Mage::getSingleton('checkout/session');
        $session->setPayworksQuoteId($session->getQuoteId());

        $payURL = Mage::getModel('payworks/payworkspay')->doValidationCybersource($this->getRequest()->getPost());
        $this->getResponse()->setRedirect($payURL);//*/
    }


    public function responsecybersourceAction()
    {
        $data = $this->getRequest()->getQuery();
        /*This will be the next redirection to the bank*/
        $payURL = Mage::getModel('payworks/payworkspay')->doValidationSecure();
    }

In the Model I set the parameters for the redirection.

6
  • Are these literal redirects - as in HTTP redirect headers being sent? Or do you just mean that in the same PHP thread you are sending to endpoint A, getting a response, then sending to endpoint B, getting a response, then send out for final payment processing? Commented Nov 25, 2014 at 22:01
  • I'm sending to endpoint A literal redirects, getting a response, then sending to endpoint B (including variables sent to endpoint A), getting response and sending the final payment (that includes responses from A and B, and variables from the first post)
    – Natalie
    Commented Nov 25, 2014 at 22:23
  • hmm ... well, PCI compliance if it applies to you will affect the way you approach this. As you said, you don't want to store on the DB. But because you are needing to persist the data across multiple requests, you have no choice but to store that information. Can you just chain all of this validation into a single request? Or does the user need to interact in between these points? Commented Nov 25, 2014 at 22:27
  • Just in the first step there's a user interaction: 1. the user enter credit card number. 2. in the controller do the redirection to the model to set the parameters and redirect to A. 3. controller: response from A, and there do the redirection to the model again to redirect to B.
    – Natalie
    Commented Nov 25, 2014 at 22:34
  • I think we're confusing some terminology. Please post your controller code at the relevant points. Commented Nov 25, 2014 at 22:40

1 Answer 1

0

Is $payURL set in redirectvalidationAction just pointing to responsecybersourceAction? eg:

$payURL = 'http://url.com/module/payment/responsecybersource';

If so, then don't set the response redirect on the first action. Instead, either call $this->_forward('responsecybersource') or just call that method directly to continue with your validation steps.

When you finish the last step, then set your response body or redirect. This way, your POST data (including CC info) will persist across each method.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.