Cypress with Checkout.com payments - cypress

I'm having some trouble getting Cypress to work with Checkout.com.
I can fill out my payment form, but when I submit the data, it looks like I get a response object back with a website to get a token:
http://3ds2-sandbox.ckotech.co/....
Then with that token, it seems that I need to send it to another URL in order for my payment to be accepted.
This all seems a big headache so I'm thinking that it's best that I simply mock the responses to test at least the functionality is working.
Has anyone done this previously? Or working with Checkout.com & Cypress?

Related

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?

Using parse.com to receive Trello webhooks

1. Goal
I want to use parse.com to receive Trello webhook.
1a. Why?: Because I want to monitor my trello model and receive say a push notification on my android device and do neat things from the push notficiation (I'm an Android Dev)
2. What I've tried
2a. Setup on parse.com
I've created an app on parse.com
Obtained the keys (REST keys for the REST api)
Checked the above endpoint with Postman, works perfectly.
2b. Setup on trello.com
I've obtained an api appkey and secret; with full write on all boards, never expires
Tested the above with Postman, works perfectly fine.
PROBLEM: Posted to the following using Postman (of course with proper details for key, token, model, etc.
Request=
$.post("https://trello.com/1/tokens/[USER_TOKEN]/webhooks/?key=[APPLICATION_KEY]", {
description: "My first webhook",
callbackURL: "https://api.parse.com/1/functions/webhookReceiverTrello",
idModel: "4d5ea62fd76aa1136000000c",
});
Response Try=
URL (https://api.parse.com/1/functions/webhookReceiverTrello) did not return 200 status code, got 401
3. What is the problem?
Parse.com expects auth keys, etc as header. AFAIK Trello can NOT DO that.
How do I get a trello webhook to call a parse.com cloud function ?
Use a proxy (a simple web app will do)
This is how I did it:
Receive the webhook on a simple web app and make the necessary post call to parse.com
I used heroku for hosting
I used MeteorJS for the web app
Note: An issue you could encounter:
Trello.com sends calls to webhooks in proper order i.e. a card was created, the same card was updated, etc.
When you receive the webhook and make (proper) post calls, they will be received out of order at parse.com i.e. a card was updated and then it was created. This is just due to the way internet works, if you need an explanation, it's another SO question. ;)
This took me a while to figure out; mentioning so that you don't also spend your time with this.
A Fix: I don't know a simple/efficient way to fix this. Please let me know if you do. One possible solution is to queue all POST calls i.e. make POST call 1 and when a successful callback is gotten do the next one. Trello.com seems to do this in a more quicker fashion, it doesn't seem like they wait for a callback given how quick successive calls are received.

Ajax & ASP Classic Notification Display

I'm doing some updates for an intranet i created few years ago using ASP Classic. What i've been ask to do is to ALERT all users when news on intranet is added. Basically i need to check on database when news is added and than trigger an action to all intranet users saying you have New Message
I'have done a lot of research on this and i could't really find a good example for it.
Your help will be much appreciated.
Cheers
Vullnet
Basically to need to poll the server using AJAX and check for new messages.
I suppose you have a messages table with and ID that counts up. You need to track each user's last message pointer, and send this as part of your AJAX request ad a parameter. If the server's ID is higher thsn the user's then they have a new message.
Based on the AJAX response you then alert the user.
You need to make an ASP that responds to your AJAX call, Pass it a number and it responds with "OK" (not new) or "NEW".
IT works the same way, regardless of the server-side language. Use jQuery to perform your AJAX calls.

Sagepay API - Simulate rejected payments?

I'm testing an app which accepts payments through Sagepay.
It all seems to be working OK but I would like to test various types of non-successful responses in the Sagepay sandbox.
For example, each test I have done so far has returned a status of OK. It is also possible to receive statuses like REJECTED, NOTAUTHED, INVALID etc
Is it possible to simulate these responses in some way?
Entering incorrect details repeatedly just returns me to the failure URL I specify in the API settings.
If you login to your simulator account on Sagepay via https://test.sagepay.com/simulator/ you can tell it which responses to return. You can instruct it to return random responses, or MALFORMED, INVALID, ERROR, NOTAUTHED, REJECTED, 3DAUTH.
Unfortunately you have to change these through the admin panel and then they apply for each transaction rather than using different details to trigger different responses.
In addition to Steve's answer, if you use the SERVER integration you can click different buttons to SIMUALATE (on the SIMULATOR server) a reply from SagePay gateway.

Why is Authorize.net throwing an error when my relay response URL points to a CodeIgniter controller and not otherwise?

I'm not typically a web developer, but I'm a decent enough coder that I felt comfortable accepting a proposal from a friend to develop his brother's small business website. I'm nearly finished and I've been using CodeIgniter, which has been a huge help and was easy to jump into.
They have a handful of products they'd like available for purchase via the site, their preference was Auth.net (which I have no previous experience with), and their host does not support SSL (nearlyfreespeech.net), so I decided that Auth.net's SIM was appropriate. If I test SIM outside of the CI application with a relay response page which simply spits out the available transaction details, everything goes as expected. If I try it with the relay response page set to a CI controller/method which simply echoes a string, Auth.net displays the following 'error':
An error occurred while trying to
report this transaction to the
merchant. An e-mail has been sent to
the merchant informing them of the
error. The following is the result of
the attempt to charge your credit
card.
This transaction has been approved.
It is advisable for you to contact the
merchant to verify that you will
receive the product or service.
My initial thought was that perhaps the rewrite rule I set up to circumvent having to include the index.php front controller was the issue, so I tried including it in the relay response URL with no change. I should also note that the controller in question implements a _remap() method, but the relay response method shouldn't be affected by it as it doesn't match it's regex.
Any insight(s) would be greatly appreciated.
This error occurs when your script doesn't respond within a specified amount of time. It also is displayed if anything other then a 200 success message is returned. So basically there is an error in your relay response URL.
You need to test this first by pulling up the page directly to see if it works and returns the proper header response. Then you can test it by sending a simulated POST response to it and see if it also responds properly. If those work make sure the script isn't taking too long to respond. If it is there probably are ways to optimize the slow page to give the response in the appropriate amount.

Resources