magento2 - Magento 2 custom payment method is not showing in front end -


i have tried create new payment method in magento2, when tried configure coming in backend, not in front end. if fixed issue please let me know fixes, not sure exact reason.

my block form quickpay.php

<?php /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ namespace magento\quickpay\block\form;  /**  * block quickpay payment method form  */ class quickpay extends \magento\quickpay\block\form\abstractinstruction {     /**      * cash on delivery template      *      * @var string      */     protected $_template = 'form/quickpay.phtml'; } 

abstractinstuction.php

<?php /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ namespace magento\quickpay\block\form;  /**  * abstract class quickpay payment method form  */ abstract class abstractinstruction extends \magento\payment\block\form {     /**      * instructions text      *      * @var string      */     protected $_instructions;      /**      * instructions text config      *      * @return null|string      */     public function getinstructions()     {         if ($this->_instructions === null) {             /** @var \magento\payment\model\method\abstractmethod $method */             $method = $this->getmethod();             $this->_instructions = $method->getconfigdata('instructions');         }         return $this->_instructions;     } } 

model quickpay.php

<?php /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ namespace magento\quickpay\model;  /**  * quickpay payment method model  *  * @method \magento\quote\api\data\paymentmethodextensioninterface getextensionattributes()  */ class quickpay extends \magento\payment\model\method\abstractmethod {     const payment_method_quickpay_code = 'quickpay';      /**      * payment method code      *      * @var string      */     protected $_code = self::payment_method_quickpay_code;      /**      * cash on delivery payment block paths      *      * @var string      */     protected $_formblocktype = 'magento\quickpay\block\form\quickpay';      /**      * info instructions block path      *      * @var string      */     protected $_infoblocktype = 'magento\payment\block\info\instructions';      /**      * availability option      *      * @var bool      */     protected $_isoffline = true;      /**      * instructions text config      *      * @return string      */     public function getinstructions()     {         return trim($this->getconfigdata('instructions'));     } } 

view adminhtml/templates/form/quickpay.html

<?php /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */  // @codingstandardsignorefile  /**  * @var $block \magento\quickpay\block\form\quickpay  */ $instructions = $block->getinstructions(); ?> <?php if ($instructions): ?>     <?php $methodcode = $block->escapehtml($block->getmethodcode());?>     <ul class="form-list checkout-agreements" id="payment_form_<?php /* @noescape */ echo $methodcode ?>" style="display:none;">         <li>             <div class="<?php /* @noescape */ echo $methodcode ?>-instructions-content checkout-agreement-item-content">                 <?php /* @noescape */ echo nl2br($block->escapehtml($instructions)) ?>             </div>         </li>     </ul> <?php endif; ?> 

view/frontend/layout/checkout_index_index.xml

<?xml version="1.0"?> <!-- /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ --> <page xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" layout="1column" xsi:nonamespaceschemalocation="urn:magento:framework:view/layout/etc/page_configuration.xsd">     <body>         <referenceblock name="checkout.root">             <arguments>                 <argument name="jslayout" xsi:type="array">                     <item name="components" xsi:type="array">                         <item name="checkout" xsi:type="array">                             <item name="children" xsi:type="array">                                 <item name="steps" xsi:type="array">                                     <item name="children" xsi:type="array">                                         <item name="billing-step" xsi:type="array">                                             <item name="children" xsi:type="array">                                                 <item name="payment" xsi:type="array">                                                     <item name="children" xsi:type="array">                                                         <item name="renders" xsi:type="array">                                                             <!-- merge payment method renders here -->                                                             <item name="children" xsi:type="array">                                                                 <item name="offline-payments" xsi:type="array">                                                                     <item name="component" xsi:type="string">magento_offlinepayments/js/view/payment/offline-payments</item>                                                                     <item name="methods" xsi:type="array">                                                                         <item name="quickpay" xsi:type="array">                                                                             <item name="isbillingaddressrequired" xsi:type="boolean">true</item>                                                                         </item>                                                                                                                                    </item>                                                                 </item>                                                             </item>                                                         </item>                                                     </item>                                                 </item>                                             </item>                                         </item>                                     </item>                                 </item>                             </item>                         </item>                     </item>                 </argument>             </arguments>         </referenceblock>     </body> </page> 

view/frontend/templates/form/quickpay.phtml

<?php /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */  // @codingstandardsignorefile  /**  * @var $block \magento\quickpay\block\form\quickpay  */ $instructions = $block->getinstructions(); ?> <?php if ($instructions): ?>     <?php $methodcode = $block->escapehtml($block->getmethodcode());?>     <div class="items <?php /* @noescape */ echo $methodcode ?> instructions agreement" id="payment_form_<?php /* @noescape */ echo $methodcode ?>" style="display: none;">         <?php /* @noescape */ echo nl2br($block->escapehtml($instructions)) ?>     </div> <?php endif; ?> 

view/frontend/web/template/payment/quickpay.html

<!-- /**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ --> <div class="payment-method" data-bind="css: {'_active': (getcode() == ischecked())}">     <div class="payment-method-title field choice">         <input type="radio"                name="payment[method]"                class="radio"                data-bind="attr: {'id': getcode()}, value: getcode(), checked: ischecked, click: selectpaymentmethod, visible: isradiobuttonvisible()"/>         <label data-bind="attr: {'for': getcode()}" class="label"><span data-bind="text: gettitle()"></span></label>     </div>      <div class="payment-method-content">         <!-- ko foreach: getregion('messages') -->         <!-- ko template: gettemplate() --><!-- /ko -->         <!--/ko-->         <div class="payment-method-billing-address">             <!-- ko foreach: $parent.getregion(getbillingaddressformname()) -->             <!-- ko template: gettemplate() --><!-- /ko -->             <!--/ko-->         </div>         <p data-bind="html: getinstructions()"></p>         <div class="checkout-agreements-block">             <!-- ko foreach: $parent.getregion('before-place-order') -->                 <!-- ko template: gettemplate() --><!-- /ko -->             <!--/ko-->         </div>         <div class="actions-toolbar">             <div class="primary">                 <button class="action primary checkout"                         type="submit"                         data-bind="                         click: placeorder,                         attr: {title: $t('place order')},                         enable: (getcode() == ischecked()),                         css: {disabled: !isplaceorderactionallowed()}                         "                         disabled>                     <span data-bind="i18n: 'place order'"></span>                 </button>             </div>         </div>      </div> </div> 

js

/**  * copyright © 2016 magento. rights reserved.  * see copying.txt license details.  */ /*browser:true*/ /*global define*/ define(     [         'uicomponent',         'magento_checkout/js/model/payment/renderer-list'     ],     function (         component,         rendererlist     ) {         'use strict';         rendererlist.push(             {                 type: 'quickpay',                 component: 'magento_quickpay/js/view/payment/method-renderer/quickpay-method'             }         );         /** add view logic here if needed */         return component.extend({});     } ); 


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -