Authorize.Net transaction VOID on already voided payment does not return an error code? - authorize.net

I have just started testing the VOID feature using an AIM call for Authorize.Net. During my testing I found that if you issue a void in your application for a transaction that was previously manually voided inside the ANET interface, you will not receive an error response on your API call. Instead it will seem like you still have successfully voided the payment from your application.
Does anyone know why this is the default behavior? I guess it is okay that it doesn't throw an error, as long as the tran_id is correct. But it would be a little more correct if ANET passed back a message saying "transaction already voided" or similar.

Related

Retry on AmazonSQSClient

I'm using AmazonSQSClient to interact with the SQS service and using the default client configuration which means it already is using the DEFAULT_RETRY_POLICY.
Let's say I make a call in my Java code to the "sendMessage" method.
As per the doc, the method can throw 2 types of Exceptions: InvalidMessageContentsException & UnsupportedOperationException.
Now let's say that the SQS service was unavailable due to whatever reason, and even after retries the SQSClient could not perform the sendMessage operation. I'm trying to understand how would I get to know that in my Java code. I can catch the aforementioned exceptions but I don't think these exceptions would have the info I need. They seem more related to an invalid message or an unsupported operation.
Am I missing something? Thoughts?
This looks like the relevant Java SDK code. This section leads me to believe you'll receive a SdkClientException with the causal exception inside of it.

Python Selenium Alert Authentication Trouble

I am trying to access a website that requires a login thru an alert box such as the one below:
I have tried to look up many different ways to do this and they dont seem to work. what i have tried are listed below:
Didnt work and gave me the same login alert.
start_url = 'http://username:password#example.com'
agent.get(start_url)
Keep getting an error message saying "NoAlertPresentException: Message: no alert open"
start_url = 'http://www.example.com'
alert = agent.switch_to_alert()
alert.send_keys("username")
alert.send_keys("password")
Get an error saying webdriver has no attribute "switchTo"
start_url = 'http://www.example.com'
agent.switchTo().alert().sendKeys("username")
I have to use Chrome because of the versions of IE and Firefox I have and can get, do not support the functions in the site
I have been having this exact same issue for some time now - with my end goal being to do this headless (in the background without visually launching an instance of Chromedriver).
Non-Ideal Solution 1:
I first used a library called pynput to automatically type the credentials in to the alert box and click the ok button, it was pretty simple to get working but:
still didn't work headlessly
I had to be focused on the browser or it would type the credentials elsewhere
This worked great in the meantime as everywhere I looked online it seemed like there was nothing I could do to overcome authentication alerts headlessly...
I'm a relative beginner (started programming <1 year ago) so perhaps I just wasn't looking in the right places!
I've now solved this issue though like so:
First I logged in to the alert as normal on Chrome while monitoring the Network section of devtools to get a good look at the GET request for the protected page screencap here:
Upon seeing that the Authorization was Basic (this will work for Bearer too) I tested just copying the same request in Postman with this header and it worked! Now if only there was a way to make http requests from Selenium???
I first tried the library selenium-requests (which didn't work for me: I got the same error as this person https://github.com/cryzed/Selenium-Requests/issues/33
This library seems absolutely excellent and exactly what I needed, I just don't currently have the know-how to get past firewalls/whatever was stopping me at this stage...
What eventually worked for me was the library selenium-wire. I followed this guide https://pypi.org/project/selenium-wire/#intercepting-requests-and-responses to have the webdriver navigate to the protected page as normal, but intercept the request and add the Authorization header before sending it :) now this works for me totally headlessly. Granted, this won't work on more secure websites but I hope it helps someone having the same issue.
This is Pythoncode
Problem with alert boxes (especially sweet-alerts is that they have a
delay and Selenium is pretty much too fast)
An Option that worked for me is: (just exchange the button click in the end with whatever action you want to have)
while True:
try:
driver.find_element_by_xpath('//div[#class="sweet-alert showSweetAlert visible"]')
break
except:
wait = WebDriverWait(driver, 1000)
confirm_button = driver.find_element_by_xpath('//button[#class="confirm"]')
confirm_button.click()
Note to 2: Here is probably the error due to the alert taking more time to load than the single elements (such as username, etc.)
Note to 3.: I think it should be switch_to

Stack Empty issue on concurrent use of MVC application

We recently developed a new ASP.NET MVC 4 web application (C#/Visual Studio). After local testing and debugging we deployed it to production, and then started getting more and more health monitoring mails. These had different Exception messages:
Stack Empty.
Collection was modified; enumeration operation may not execute.
Item has already been added. Key in dictionary: 'ALL_HTTP' Key being added: 'ALL_HTTP' (other keys also mentioned).
Value does not fall within the expected range.
E.g. a whole series of error types we could not simply resolve or reproduce. The 'Stack Empty' is the one occurring most, several 100 times per day (e.g. for 1-10% of users) so we focus on this one, as the other errors seem related. Here is a partial stack trace:
Exception information:
Exception type: System.InvalidOperationException
Exception message: Stack empty.
...
Stack trace: at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Stack`1.Pop()
at System.Web.WebPages.TemplateStack.Pop(HttpContextBase httpContext)
As shown stack trace are mostly located completely in the MVC framwork (System.Web). The only place in our own code that regularly occured in some stack traces were in the views (.cshtml files) of the requested URL and then in a #Html.RenderAction() call. By now we have refactored a lot of these to RenderPartial() calls. This lead to no more views in the stack trace, though some RenderPartial now also gave some
Searching for this error indicated concurrency/parallel execution is the cause. This matches the fact that we initially could not reproduce the error locally, but it did happen on production. We have done no load testing, but by now have been able to reproduce the error on a local developer system by starting a lot of applications/requests simultaneously. However in our code NOTHING is done with explicit parallel instructions.
This seems to be related with MVC view's NOT being thread safe. However it is hard to imagine nobody else would have encountered this. We have a few thousand visitors a day, roughly 30+ active users at any moment. Sadly this number is now falling due to decreasing Google ranking (related to this problem).
Does anyone knows a solution/approach to this problem?
I am developing a ASP.NET MVC 4 application and I also came across the errors that you mention. Although they are different they seem to have the same source. After spending several hours trying to find the reason (and a lot of code changes) I have started my analysis from scratch.
Since I am using a Custom Route and there is a handler for that route that checks several things and also accesses the database I started by commenting database access. Opening several browser tabs very quickly (with IISExpress > Show All Application window or by Ctrl+Click in a link) I was happy to see that all the pages were shown properly, instead of several random error messages. Tried that a few times to be sure and concluded that something was wrong while accessing the DB.
public class MyNewRouteHandler : IRouteHandler {
IHttpHandler MvcHandler;
public IHttpHandler GetHttpHandler(RequestContext requestContext) {
MvcHandler = new MvcHandler(requestContext);
// some checkings and
// some database access code
// that was commented
return MvcHandler;
}
}
A colleague suggested that I added a small Thread sleep inside this method: GetHttpHandler. That line made the errors appear again, suggesting that the problem was not related to DB... When I did that I saw that MvcHandler object was being defined as a class property and that could be a source of what appeared to be a concurrency issue (only when multiple almost consecutive accesses were executed, the problem was shown). Moved the MvcHandler object to a local object inside the method.
public class MyNewRouteHandler : IRouteHandler {
public IHttpHandler GetHttpHandler(RequestContext requestContext) {
IHttpHandler MvcHandler = new MvcHandler(requestContext);
// some checkings and
// some database access code
// that was commented
return MvcHandler;
}
}
And after testing, no more errors. Uncommented all my code that accessed the DB (and did other checkings) and still no more errors found. Almost 3 days have gone by and everything still working properly.
This way of doing a Custom Route Handler did solve my most of my errors but I still have a few left and with new messages. One of them pointed to a code line in my Custom Route Handler and all of them had in common the fact that a Dictionary was being handled by the MVC framework, so... do I still have a concurrency problem?
I assumed so and all my method properties were moved inside the public IHttpHandler GetHttpHandler(RequestContext requestContext) method, not only the one mentioned before. One of them was the RouteData collection... Finally and after 2 days it seems that no more errors are showing.

Is a separate message file library for my native Win32 service necessary?

We've got an old legacy win32 service, developed with C++, and we've just recently noticed that when the service starts up and stops, there is an informational message in the event logs about our missing event descriptions. To be more precise, the message looks like this:
The description for Event ID 0 from source [application] cannot be
found. Either the component that raises this event is not installed on
your local computer or the installation is corrupted. You can install
or repair the component on the local computer.
So we understand what this means, basically we're missing a library which has a message table compiled into it. This way when the event ID for changing status (start/stop) arrives, it can look up the message and print it in the event logs.
The question is, for these universal messages (changing status etc) which pretty much every service is going to have, surely there are default message table that we can use, rather than having to go to the trouble of creating another project, just for this, adding registries and updating our installer.
Seems like a lot of hassle for something that should surely be a default somewhere? Like the standard win32 error messages?
I've created a number of managed services in the past, and I'm pretty sure we didn't need to do anything like this before!
So to wrap this up, I guess the answer is that the a new message table/file is always required, regardless (so no there are no default messages you can use), so I'll just have to chuck in a message table into my services resource file and add a registry entry to the installer.
Still find it baffling thought that every native service has it's own 'service has stopped/started' message...!
Thanks!

OCILogon during Grace Period - ORA-28002

when I use SQL*Plus, connecting to a user whose password entered the grace period (Oracle 11g, Oracle 8i), I get an error message but the connect is still successful:
SQL*Plus:
=====================================
SQL> connect gumiplesku
Enter password:
ERROR:
ORA-28002: the password will expire within 7 days
Connected.
SQL> select User from dual;
USER
======================================
gumiplesku
=====================================
On the other hand, in my C++ OCI code doing a OCILogon2, if I try to connect the same user, I get an OCI_ SUCCESS_ WITH_ INFO with the same "error", but if I continue, the OCISvcCtx* I got seems to be invalid (even though it's not null), since trying to do a OCIAttrGet or OCIStmtExecute on it gives me an OCI_INVALID_HANDLE error.
User should successfuly connect to database during all his grace period, until his password will be totally expired.
So how come SQL*Plus can connect OK, when I get a bad handle? Shall I be attempting to connect a different way?
Many thanks.
This is a little outside my experience, but since nobody is answering I'll give it a shot.
I recall there being some kind of error handler callback you can install. Since you are able to get the error information via OCIErrorGet (?), I assume it's triggering normal error handling mechanisms. Is it possible that there's an error handler that closes the connection when an "error" occurs without checking for this special case?
This also reminds me of a problem I had long ago, if you pass in the wrong handle type to OCI functions they can fail in odd ways. From a look at the OCIErrorGet docs, it might be that you're passing in OCI_HTYPE_ERROR and an environment handle, or OCI_HTYPE_ENV and an error handle.
Are you calling OCIErrorGet multiple times? Oracle can generate multiple errors, maybe you have to retrieve them all before continuing? But that doesn't really seem reasonable.
Beyond those long-shots, I would try a simple OCI example or any example code from Oracle to see if it has the same issue. If not, then work backwards to find what's making the difference.