View Single Post
  #1  
Old 02-20-2021, 02:31 AM
 
hieudm hieudm is offline
    
Join Date: Feb 2021
Posts: 1
 

Default Exception when placing order with custom payment method

I'm working on a custom payment method on X-cart 5, when placing order I got this exception in log file:


Code:
[20-Feb-2021 10:05:05] Error (code: 0): Serialization of 'SimpleXMLElement' is not allowed Server API: apache2handler; Request method: POST; URI: /?; Backtrace: #0 /public_html/var/run/classes/XLite/Model/Payment/TransactionAbstract.php(952): serialize() #1 /public_html/var/run/classes/XLite/Model/Payment/TransactionAbstract.php(443): registerTransactionInOrderHistory() #2 /public_html/var/run/classes/XLite/Controller/Customer/CheckoutAbstract.php(389): handleCheckoutAction() #3 /public_html/var/run/classes/XLite/Module/CDev/Paypal/Controller/Customer/Checkout.php(297): doPayment() #4 /public_html/var/run/classes/XLite/Module/XC/NotFinishedOrders/Controller/Customer/Checkout.php(70): doPayment() #5 /public_html/var/run/classes/XLite/Module/XC/MailChimp/Controller/Customer/Checkout.php(41): doPayment() #6 /public_html/var/run/classes/XLite/Controller/Customer/CheckoutAbstract.php(325): doPayment() #7 /public_html/var/run/classes/XLite/Module/CDev/Paypal/Controller/Customer/Checkout.php(411): doActionCheckout() #8 /public_html/var/run/classes/XLite/Controller/AControllerAbstract.php(1639): doActionCheckout() #9 /public_html/var/run/classes/XLite/Controller/Customer/CartAbstract.php(54): callAction() #10 /public_html/var/run/classes/XLite/Module/XC/MailChimp/Controller/Customer/Checkout.php(31): callAction() #11 /public_html/var/run/classes/XLite/Controller/AControllerAbstract.php(1658): callAction() #12 /public_html/var/run/classes/XLite/Module/XC/MailChimp/Controller/AController.php(21): run() #13 /public_html/var/run/classes/XLite/Controller/AControllerAbstract.php(611): run() #14 /public_html/var/run/classes/XLite/Module/QSL/CloudSearch/Controller/AController.php(48): handleRequest() #15 /public_html/var/run/classes/XLite/Controller/Customer/ACustomerAbstract.php(413): handleRequest() #16 /public_html/var/run/classes/XLite/Module/XC/CustomerAttachments/Controller/Customer/ACustomer.php(29): handleRequest() #17 /public_html/var/run/classes/XLite/Module/QSL/CallForPrice/Controller/Customer/Cart.php(66): handleRequest() #18 /public_html/var/run/classes/XLite/Controller/Customer/CheckoutAbstract.php(89): handleRequest() #19 /public_html/var/run/classes/XLiteAbstract.php(624): handleRequest() #20 /public_html/var/run/classes/XLiteAbstract.php(653): runController() #21 /public_html/var/run/classes/XLite/Module/XC/MailChimp/XLite.php(21): processRequest() #22 /public_html/var/run/classes/XLiteAbstract.php(671): processRequest() #23 /public_html/cart.php(16): runCustomerZone()


This exception happens when transaction is sucess.



Here is the simplified version of the processor:


Code:
<?php class NabXML extends \XLite\Model\Payment\Base\CreditCard { protected function doInitialPayment() { $txnID = time(); $this->transaction->setStatus($this->transaction::STATUS_SUCCESS); $this->setDetail('transId', $txnID, 'Transaction ID'); return static::COMPLETED; } }


install.yaml file:


Code:
XLite\Model\Payment\Method: - service_name: Nab XML class: Module\SydneyEcommerce\NabXML\Model\Payment\Processor\NabXML type: C ...


I have multiple questions:
- Where can I find a document about developing a custom payment method?
- How can I debug and fix above exception?
- Is there a way for dev like me get full X-Cart code for self-hosting and developing stuffs?
__________________
X-Cart version 5.4.1.23
Reply With Quote