I started working on magento2 since 2 months, i have payment method which was working before and suddenly it stopped. i could not able to figure out the problem.
Please find the zip file. https://drive.google.com/open?id=12IpO3fh-8MfJnMTwHlz26vY7puy5biEg
I tried to copy the module and used in new installed magento but in front-end it displayed the drop down list but order is not getting completed.
This is screen shot of back end which is not Listing out the drop down list. When I tried place order from magento backed, it is not saving the "XYZ" selected value in Database.
Back end does't display drop down values
my registration.php file at :
\app\code\K2B\PickPay\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'K2B_PickPay', DIR );
File Pickpay.php at :
\app\code\K2B\PickPay\Block\Form<?php namespace K2B\PickPay\Block\Form; class Pickpay extends \Magento\Payment\Block\Form { /** * Checkmo template * * @var string */ protected $_template = 'K2B_PickPay::form/pickpay.phtml'; }File Pickpay.php at :
\app\code\K2B\PickPay\Block\Info<?php namespace K2B\PickPay\Block\Info; class Pickpay extends \Magento\Payment\Block\Info { /** * @var string */ protected $_template = 'K2B_PickPay::info/pickpay.phtml'; /** * @return string */ public function toPdf() { $this->setTemplate('K2B_PickPay::info/pdf/pickpay.phtml'); return $this->toHtml(); } }?>Model pickpay.php in
\app\code\K2B\PickPay\Model'
- Pay In Store payment method model
*/
class Pickpay extends \Magento\Payment\Model\Method\AbstractMethod
{
const PAYMENT_METHOD_PICKPAY_CODE = 'pickpay';
/**
- Payment code *
 - @var string */ protected $_code = self::PAYMENT_METHOD_PICKPAY_CODE; /**
 - Availability option *
 - @var bool */ protected $_isOffline = true; /**
 - @var string */ protected $_formBlockType = 'K2B\PickPay\Block\Form\Pickpay'; /**
 - @var string */ protected $_infoBlockType = 'K2B\PickPay\Block\Info\Pickpay'; /**
 - Assign data to info model instance *
 - @param \Magento\Framework\DataObject|mixed $data
 - @return $this
 - @throws \Magento\Framework\Exception\LocalizedException
/
public function assignData(\Magento\Framework\DataObject $data)
{
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
if (!is_object($additionalData)) {
$additionalData = new DataObject($additionalData ?: []);
}
/$myfile = fopen("./var/log/pickpay.txt", "a");
$txt = "getPickpayLocation:".$additionalData->getPickpayLocation();
fwrite($myfile, "\n". $txt); fclose($myfile);*/ $this->getInfoInstance() ->setPickpayLocation($additionalData->getPickpayLocation()); return $this; } }' 
 
- Pay In Store payment method model
*/
class Pickpay extends \Magento\Payment\Model\Method\AbstractMethod
{
const PAYMENT_METHOD_PICKPAY_CODE = 'pickpay';
/**
 File UpgradeSchema.php in
\app\code\K2B\PickPay\Setupnamespace K2B\PickPay\Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface;
class UpgradeSchema implements UpgradeSchemaInterface {
/** * {@inheritdoc} */ public function upgrade( SchemaSetupInterface $setup, ModuleContextInterface $context ) { $installer = $setup;$installer->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $installer->getConnection()->addColumn( $installer->getTable('quote_payment'), 'pickpay_location', [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Pay and Pick Store Location' ] ); $installer->getConnection()->addColumn( $installer->getTable('sales_order_payment'), 'pickpay_location', [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Pay and Pick Store Location' ] ); } $installer->endSetup(); } }
When i tried place order from magento backed, it is not saving the "XYZ" selected value in Database, that's mean the module is working on frontend?