Magento Forum

   
Page 1 of 2
Retrive Quote Information and turn it into an Order
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

I’ve modified the payment mechanism so that I can submit to a third party for CC authentication and payment, they then execute a callback script which will confirm the order.

Only issue is I’m not sure what or where to find a unique identifier with which I could pass to the processor and then get the order back with.

Any ideas, any one?

Sam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

You can see how it’s done in Mage/Paygate/Model/Authorizenet.php on line 165:

$request->setXInvoiceNum($document->getIncrementId());

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Right cool, thanks for the quick reply, been banging my head against a brick wall so so long with other areas it’s somewhat reduced my faculties.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Hi Moshe if you’re still about,

I’m having difficulties instantiating the document object, I’m attempting to pull this information into the block itself so I’ve defined the following functions in the ‘Handler’ file associated with the block.

public function getPayment()
    
{
        
if (empty($this->_payment)) {
            $this
->_payment Mage::getSingleton('sales/order/payment');
        
}
        
return $this->_payment;
    
}

    
public function getOrderID(){
        $document 
$this->getPayment()->getDocument();
        
$orderID $document->getIncrementId();

        return 
$orderID;
    
}

But I’m getting an error that I’m trying to call getIncrementId on a non object so I guess that it’s not pulling out the object I required.

Sorry if I’m doing something dumb but you have no idea how appreciated help would be at this stage.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Could you attach the whole file, i’ll take a look?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

I’ve changed it a little since I last posted I’ve got the document instantiating just trying to grab the correct object to grab the id from.

Cheers, you’re a star!

File Attachments
SecureHosting.php  (File Size: 4KB - Downloads: 292)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Ok, that’s a block to show payment information in html, your question

Only issue is I’m not sure what or where to find a unique identifier with which I could pass to the processor and then get the order back with.

Would be implemented in payment processor model.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

No, I don’t want to display payment information in my html as this is prior to payment, this is assembling all the information so I can send it via post rather than API to a payment processor.

This is in place of the final cc form, I’d rather use an API but I’ve got to deal with the constraints of this merchant account. Pulling out this information is causing me all sorts of headaches, I’m having real problems with getting the correct address info out as well, still one headache at a time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Sorry Moshe,

Do you mean I should be fetching the information in the Payment Processor module (called PaymentMethod.php in your setting up a new payment module example), setting it as data to the block and then getting it again as data from the block template?

Sam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Ok, let’s revisit the process of processing a credit card information, on example of Authorize.net

* Customer fills in credit card form in checkout (form displayed using logic in Mage_Payment_Block_Form_Cc, and template from payment/form/cc.phtml)

* Information is save in entity stored in `sales_quote_entity_*` tables and represented by Mage_Sales_Model_Quote_Payment class

* Payment information is represented to customer by Mage_Payment_Block_Info_Cc logic using payment/info/cc.phtml template.

* On order creation calls Mage_Paygate_Model_Authorizenet::onOrderCreate method, supplying as argument the instance of $payment from previous step.

* If everything is ok, Mage_Sales_Model_Order_Payment instance is created and relevant data from prevous step response is saved.

Now, a few questions:

* Are you creating a new payment method? Or just a new form for representation?

* Which step from above do you need help with?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Thanks for getting back to me, this server doesn’t have a secure cert so I’m not planning on going the whole way through the payment process.

I have created a new payment module as that ‘seemed’ the best way to be able to form a divergent path from the standard payment process. But it was never really my intention to complete the payment process within this module.

* Customer fills in credit card form in checkout (form displayed using logic in Mage_Payment_Block_Form_Cc, and template from payment/form/cc.phtml)

I am replacing that form with this form which will hopefully contain all the order information so that it can be passed to the payment provider. They will then execute a script on the magento installation which needs to be able to generate a completed order in the magento system for a passed variable, i.e. the order id (entity_id).

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

I seem to have cracked it I’ve added the code below to the createFormBlock function:

$payment $this->getPayment()->toArray();
    
$entityId $payment['parent_id'];
    
$quote Mage::getModel('sales/quote')->load($entityId, array());
    
$orderDetails $quote->toArray();

    
$block->setAttribute('orderDetails',$orderDetails);

And this to the Block itself

$orderDetails $this->getAttribute('orderDetails');

And now I seem to have all the information I need, although the address provided by this method doesn’t seem to be the same as that displayed in the progress bar on the right, any ideas?

Thanks for all your help so far!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Ok, to streamline your code in createFormBlock:

$block->setOrderDetails($this->getPayment()->getQuote());
in block itself:
$this->getOrderDetails();

I’m not sure about the progress bar, it should be same address as in quote

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Cool that worked a treat.

The progress bar seems to be calling the same object but there may be a bug in it?

On a first pass I’m getting errors retrieving the addresses but the progress bar shows them fine, if I then refresh and go through again entering different values the progress bar will show the new values but the addresses I’m getting will correspond to the values entered in the first pass.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

I still do not understand what you are trying to accomplish, an URL to example would help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam Boson
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2007-11-15
 

Sorry it’s not publicly accessible at the minute.

Ok because I don’t have a secure cert for this app I don’t want to be taking and processing CC details on it, secondly the Merchant account I’m integrating with is not API enabled so I’m assembling the order details so that they can be passed to the secure merchant account.

The Merchant account does have a reasonable back end where it can provide a fair amount of detail about the order placed which can help tie up loose ends like which payment on that system refers to which order on the e-commerce system plus a backup copy is always useful. But in order for it to save all that information it must be passed to it in the form of a POST submitted form.

In addition I need to pass the Merchant account the order id so that it can return it as a variable to a callback script allowing the e-commerce system to mark and order as paid for.

Simply put it’s a form with a lot of hidden variables to send the full order information to a third party.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2