0

Magento 2.3.5 version application using custom payment method module. This module refer from code here

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

    <!-- Render the native credit card form. -->
    <form class="form" data-bind="attr: {'id': getCode() + '-form'}">
        <!-- ko template: 'Magento_Payment/payment/cc-form' --><!-- /ko -->
    </form>

    <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 data-role="review-save"
                    type="submit"
                    data-bind="
                    attr: {title: $t('Place Order')},
                    enable: (getCode() == isChecked()),
                    click: placeOrder,
                    css: {disabled: !isPlaceOrderActionAllowed()}
                    "
                    class="action primary checkout"
                    disabled>
                <span data-bind="i18n: 'Place Order'"></span>
            </button>
        </div>
    </div>

full code html file here

view/frontend/web/js/view/payment/method-renderer/llamacoin.js

define([
        'jquery',
        'Magento_Payment/js/view/payment/cc-form'
    ],
    function ($, Component) {
        'use strict';

        return Component.extend({
            defaults: {
                template: 'ClassyLlama_LlamaCoin/payment/llamacoin'
            },

            context: function() {
                return this;
            },

            getCode: function() {
                return 'classyllama_llamacoin';
            },

            isActive: function() {
                return true;
            }
        });
    }
);

Checkout page show Payment method look like enter image description here

This knockout js calling input field to html

 <!-- ko template: 'Magento_Payment/payment/cc-form' --><!-- /ko -->

exception.log error show when click "Place Order"

[2021-07-07 12:14:50] main.CRITICAL: Notice: Only variables should be passed by reference in /mnt/BLOCKSTORAGE/home/mydomain.com/applicationame/public_html/app/code/Pay360/Pay360payment/Model/Pay360.php on line 117 {"exception":"[object] (Exception(code: 0): Notice: Only variables should be passed by reference in /mnt/BLOCKSTORAGE/home/mydomain.com/applicationame/public_html/app/code/Pay360/Pay360payment/Model/Pay360.php on line 117 at /mnt/BLOCKSTORAGE/home/mydomain.com/applicationame/public_html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

Pay360.php line number 117 is

catch (\Exception $e) {
            $this->debug($payment->getData(), $e->getMessage());
        }  

Pay360payment\Model\Pay360.php (= LlamaCoin/Model/LlamaCoin.php )

public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
    {
        try {
            //check if payment has been authorized
            if (is_null($payment->getParentTransactionId())) {
                $this->authorize($payment, $amount);
            }

            //build array of payment data for API request.
            $request = [
                'capture_amount' => $amount,
                //any other fields, api key, etc.
            ];

            //make API request to credit card processor.
            $response = $this->makeCaptureRequest($request);

            //todo handle response

            //transaction is done.
            $payment->setIsTransactionClosed(1);
        } catch (\Exception $e) {
            $this->debug($payment->getData(), $e->getMessage());
        }

        return $this;
    }

Sample Model file Full code here enter link description here

My main issue : incorrect data with "payment credit card number", "Card Verification Number" First time click "Place order" show validation error "an error occurred on the server. please try to place the order again after press next order place"

After again click Place order order succesfully place with incorrect data

Where will get input field ("payment credit card number","Card Verification Number" "expiration date") data customize with validation?

How can I validate and show error message using frontend or backend technology "payment credit card number", "expiration date" when customer click "Place Order" ?

if you provide any custom module or extension solve this issue,Please let me know,

Thanks for advance

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.