How can I extend Magento to override payment info validation? - validation

I am building a Magento extension to handle Level 3 payments through PayTrace's payment gateway. This particular payment method allows customers to select a saved credit card via Paytrace's customer info management (tokenized saved cards) instead of entering credit card information.
I can use Prototype, I understand how to add validation classes to the HTML in the template.
But the other validation is stumping me. I want to be able to submit the payment card's Paytrace id and not a credit card # and expiration date. When I add a select to the template and submit the selected card id, it pops up a javascript alert telling me "Incorrect credit card expiration date".
There is a request to "/checkout/onepage/savePayment" when I click "continue" that comes back with json {"error":"Incorrect credit card expiration date."} so this validation appears to occur via PHP on the server side.
My question here is "how do I extend Magento to override the server side one page checkout validation for payment?"

Related

Tokenising CVV for Braintree vaulted cards in hosted fields

I have integrated Braintree HostedFields and it's working fine, Now I am trying to add vault feature to it.
I managed to retrieve all the payment methods from vault using vaultManager in client-side JS.
My question is how do I just tokenize the CVV and not all other details as if a customer selects a card from the displayed option then they won't expecting to enter their card details and expiry date. And if I don't have these data how do I tokenize card.
Do I bother to ask for the CVV at all, because I tried sending the payment method token to server side and charged it by passing it to 'paymentMethodToken' in transaction()->sale()?
I am just not sure what I am supposed to do on the client side once the customer has selected the stored card to pay with.

Braintree drop in UI generate new nonce

I've integrated the braintree drop in UI in my project and have added paypal, google pay and visa payments. Everything works fine, payments are submitting to the API etc. But if I use submit a payment which fails using the values from - https://developers.braintreepayments.com/reference/general/testing/php#transaction-amounts. The nonce has then been used, amending my basket price and submitting again fails as the nonce has already been used. I've looked through the documentation and all I can find about nonces is that it can only be used once (https://developers.braintreepayments.com/guides/payment-method-nonces) and nothing around refreshing or requesting a new nonce. Ideally I'd like to avoid having to force the user to enter the payment details again.
Is there another way of automatically requesting a new nonce?

Paypal website payment hosted pro "Please select a valid card type." in iFrame

I am trying to update an existing Magento 1.9 EC site to start to use PayPal Website Payment Pro as payment method but am hitting an issue with the behaviour within the iframe.
I have created a sandbox account for both the buyer and business, the settings are working and I can make the payment if I use the "Pay with Paypal" button. The sandbox credit card also works if in the PayPal page I use it without being logged in.
But if I try to use the credit card in the iFrame I have the "Please select a valid card type." message show up. Invalid credit cards will not show that specific message.
It looks like it wants me to make an action to select Visa as the type, but the card type cannot be selected, it detects the number as a Visa card, greys out the other types and keeps the Visa one visible.
This seems to be all happening within the iFrame I use to host the result of the initial request which builds the form on the paypal site.
Also, the rest of the integration seems to be working, if we use the "Pay with Paypal" button, complete the credit card payment on that page we go back to the proper return page and the order records the payment in Magento.
Which makes me wonder why there is only an issue within that iFrame?
Is that solution not working? Should we look at some of the other options?
Log in to your developer paypal account.
choose the merchant account you have created and click the profile tab
Use the credit which is displayed under Funding Tab..
You can add more cards by logging into your sandbox.paypal.com using merchant account u created and goto profile->credit cards which is under financial information
Hope this helps

Omnipay-Stripe storing creditcard details from form to database

I'm using Omnipay-stripe in laravel 5.2 and is working fine. I want to store credit card details of customers to pre-populate stripe popup with creditcard details while making another payment.
You need to register the card against stripe using createCard which will get you back a card reference. You can then use that instead of the actual card data when making a purchase.
You should be calling create customer as well. Check the documentation in the class docblocks

Braintree : How can i select a payment method and obtain a payment method nonce using a custom UI?

I am trying to use braintree for payments in a web application. The flow i'm after is :
user registration : create a Braintree customer, associate its id with the user
first payment : show a custom UI for the credit card information, use the Braintree tutorial for adding a credit card and make the payment.
second payment : show a list of payment methods for the customer. When he/she selects one, make a payment using the selected payment method.
I am stumped at how i'm supposed to implement the second payment part. Assuming i keep payment methods info and show the client a list of payment methods, how do i obtain a payment method nonce i need to be able to execute a sale Transaction?
To clarify, i'm not using the Dropin UI because :
i need more information than it can show when entering a credit card (like cardholder)
i need to have a custom look-and-feel ui in different languages
I've read the Braintree guides and reference and i couldn't find and resource for a custom ui where i can reuse the payment method information.
Any input is highly appreciated.
I work at Braintree. If you need more help, I suggest you email our support team.
When you store a credit card (by passing a nonce to credit card or payment method create) the response you get back contains a token. You can store this token permanently and use it in the future to make payments on the same card.
You can charge the user with his payment token or customer id: https://developers.braintreepayments.com/guides/transactions/ruby#sale-with-vaulted-payment-methods
result = Braintree::Transaction.sale(
:payment_method_token => "the_token",
:amount => "10.00"
)
# or
result = Braintree::Transaction.sale(
:customer_id => "the_customer_id",
:amount => "10.00"
)

Resources