classes/XLite/Module/XCExample/Payment/install.yaml 0000666 00000000756 13013544314 0016262 0 ustar 00 # vim: set ts=2 sw=2 sts=2 et: # # Fixtures # # Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved. # See https://www.x-cart.com/license-agreement.html for license details. XLite\Model\Payment\Method: - service_name: DemoPayment class: Module\XCExample\Payment\Model\Payment\Processor\DemoPayment type: C translations: - code: en name: Demo Payment settings: - name: login - name: password - name: mode value: live classes/XLite/Module/XCExample/Payment/Main.php 0000666 00000002123 13013544314 0015313 0 ustar 00 getSetting('mode') != 'live'; } public function isConfigured(\XLite\Model\Payment\Method $method) { return parent::isConfigured($method) && $method->getSetting('login') && $method->getSetting('password'); } protected function getFormURL() { return \XLite::getInstance()->getShopURL() . 'payment.php'; } protected function getFormFields() { return array( 'transactionID' => $this->getTransactionId(), 'returnURL' => $this->getReturnURL(null, true), 'invoice_description' => $this->getInvoiceDescription(), ); } public function processReturn(\XLite\Model\Payment\Transaction $transaction) { parent::processReturn($transaction); $request = \XLite\Core\Request::getInstance(); $status = ''; $notes = array(); if ($request->status == 'Paid') { $status = $transaction::STATUS_SUCCESS; $this->setDetail('Status', $request->status, 'Result'); $this->setDetail('TxnNum', $request->transactionID, 'Transaction number'); } else { $status = $transaction::STATUS_FAILED; $notes[] = 'Payment Failed'; } $this->transaction->setStatus($status); $this->transaction->setNote(implode('. ', $notes)); } } skins/admin/modules/XCExample/Payment/config.twig 0000666 00000002247 13013544314 0016046 0 ustar 00