Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ccsave #16

Open
pmathbliss opened this issue Sep 22, 2015 · 2 comments
Open

Add ccsave #16

pmathbliss opened this issue Sep 22, 2015 · 2 comments

Comments

@pmathbliss
Copy link

I've added a hardcoded ccsave to the setupPaymentMethod. Could be vastly improved upon but is a good start for generallizing of some the payment methods. I was trying to get auth.net to work, but there is a second POST somewhere that does not have the credit card info and fails to create the order.

protected function setupPaymentMethod()
{
$quotePayment = $this->getQuote()->getPayment();

    if ($paymentInput = $this->_input->getOption('payment')) {

        if($paymentInput == "ccsave")
        {
            $data = array(
                    'method' => 'ccsave',
                    'cc_type' => 'MC',
                    'cc_number' => '5424000000000015',
                    'cc_exp_month' => '12',
                    'cc_exp_year' => (date('Y') + 6),
                    'cc_cid' => '444'
            );

            $quotePayment->importData($data); 

            \Mage::app()->getRequest()->setPost("payment", $data);
        }

        elseif ($ccTokenInput = $this->_input->getOption('cc_token')) {
            \Mage::app()->getRequest()->setPost('payment', array(  //works for Braintree
                'method' => $paymentInput,
                'cc_token' => $ccTokenInput
            ));
        }
    } else {
        $quotePayment->setMethod('checkmo');
    }

    $this->getQuote()->setPayment($quotePayment);

    return $this;

}
@kalenjordan
Copy link
Owner

Will try to check this out in the next week or so. Btw any idea how hard it might be to introduce some unit test coverage? Would certainly make it easier / faster to merge these types of changes with some test coverage in place.

@kalenjordan
Copy link
Owner

Taking a minute to take a peek at this here. I was under the impression this was a PR but seems that's not the case. Seems like you're saying that it's not working as expected and you're not sure why.

I'm afraid I don't have the time to help troubleshoot this right now. Sorry about that! Maybe you can see if any of the other contributors can check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants