First off, I am using DPM because my understanding is that Accept.js does not support e-check and the whole reason that I am involved in making this update is to add e-check support.
I am trying to rewrite a classic ASP page for DPM in VB.Net using razor syntax. I have repeatedly received the error response:
The following errors have occurred.
(13) The merchant login ID or password is invalid or the account is inactive.
I know the default response. I am using the wrong login in or posting to the wrong URL. I am posting using the same URL that my current ASP page is posting to and I am using the same x_login value.
Also, if I go to this URL:
https://secure.authorize.net/gateway/transact.dll?x_version=3.1&x_type=AUTH_ONLY&x_amount=1.99&x_car... it returns that the credit card has expired. If I enter an invalid x_login on that url it returns "The merchant login ID or password is invalid or the account is inactive." If I enter my valid x_login and an invalid x_tran_key I receive "This transaction cannot be accepted."
So, I know that my x_login is correct and that I am posting to the correct URL.
In order to eliminate any coding issues, I put together a simple form just to post static information to the URL:
<html>
<body>
<form method="POST" action="https://secure.authorize.net/gateway/transact.dll">
<input type=hidden id="x_login" name="x_login" value='MY_LOGIN'/>
<input type=hidden id="x_cust_id" name="x_cust_id" value='106400289'/>
<input type=hidden id="x_card_num" name="x_card_num" value='5424000000000015'/>
<input type=hidden id="x_exp_date" name="x_exp_date" value='12-17'/>
<input type=hidden id="x_card_code" name="x_card_code" value='123'/>
<input type=hidden id="x_fp_hash" name="x_fp_hash" value='84EFB49E5F4A8F7CB3EEB3C6A1B2B305'/>
<input type=hidden id="x_amount" name="x_amount" value='123.60'/>
<input type=hidden id="x_fp_timestamp" name="x_fp_timestamp" value='1493038728'/>
<input type=hidden id="x_fp_sequence" name="x_fp_sequence" value='531'/>
<input type=hidden id="x_relay_url" name="x_relay_url" value='https://www.my.com/CCPayment2.vbhtml'/>
<input type=hidden id="x_relay_response" name="x_relay_response" value='Y'/>
<input type=hidden id="x_type" name="x_type" value='AUTH_CAPTURE'/>
<input type=hidden id="x_currency_code" name="x_currency_code" value='USD'/>
<input type=hidden id="x_version" name="x_version" value='3.1'/>
<input type=hidden id="x_invoice_num" name="x_invoice_num" value='2'/>
<input type="submit"/>
</form>
</body>
</html>
I verified that my hash value was correct using the link at:
http://developer.authorize.net/api/reference/responseCode99.html
This returns the error message:
(13) The merchant login ID or password is invalid or the account is inactive.
In researching I did find where one developer received that message because he used the same test card and amount and evidently that message is returned as the result of a duplicate. So I changed the amount, the card, the time stapm, and the hash and tried again with the same result. I also used both the "name" and "id" within the hidden fields since I have seen references to both of those.
I would appreciate any help that anyone can provide.
In case anyone else is looking for an answer to this in the future, the message:
(13) The merchant login ID or password is invalid or the account is inactive.
evidently appears for more reasons than supplying the wrong login id or connecting to the wrong url at least as far as DPM is concerned.
In my instance, the refresh on my link "https://www.my.com/CCPayment2.vbhtml" contained an invalid URL. Once I discovered and fixed this, everything worked fine.
Related
Trying to work out accept.js to replace a depreciated method for authorize.net payments. Not doing anything gcomplicated, but can't get past the authentication failed message when using the sandbox
Logging into the sandbox account to generate keys … they're named slightly differently than the code samples. So I MAY BE AN IDIOT.
OK, apiLoginID - obvious …
Code below calls for data-clientKey. Not 100% sure which of the two below that actually is. I've tried both. Same error with both.
API Login ID : 4CLLpD------
Transaction Key : 9628s6xCSh------
Key : ------A4D932A4AFED546DE55E4D04C16CA66549915AFDC4FBA3A1665E271A2FB48A7A34394843A47BC170FFB4A5B99EDD17B75D99942E4E7F7133C2E1------
<script type="text/javascript"
src="https://jstest.authorize.net/v3/AcceptUI.js"
charset="utf-8">
</script>
<form id="paymentForm"
method="POST"
action="mysite.com/beta-account/order-receipt.php" >
<input type="hidden" name="dataValue" id="dataValue" />
<input type="hidden" name="dataDescriptor" id="dataDescriptor" />
<button type="button"
class="AcceptUI btn-success btn-lg"
data-billingAddressOptions='{"show":true, "required":false}'
data-apiLoginID="4CLLpDX----"
data-clientKey="9628s6xCShc-----"
data-acceptUIFormBtnTxt="Submit"
data-acceptUIFormHeaderTxt="Card Information"
data-responseHandler="responseHandler">Pay
</button>
</form>
<script type="text/javascript">
function responseHandler(response) {
if (response.messages.resultCode === "Error") {
var i = 0;
while (i < response.messages.message.length) {
console.log(
response.messages.message[i].code + ": " +
response.messages.message[i].text
);
i = i + 1;
}
} else {
paymentFormUpdate(response.opaqueData);
}
}
function paymentFormUpdate(opaqueData) {
document.getElementById("dataDescriptor").value = opaqueData.dataDescriptor;
document.getElementById("dataValue").value = opaqueData.dataValue;
document.getElementById("paymentForm").submit();
}
</script>
Right now, there's not really anything on the order-receipt.php page. I'm just trying to get the post to make it that far and show me a dump of everything that post to the page, so even once I get this working, I've still got a ways to go.
When I go to the payment page, hit the "Pay" button, fill out the credit card form, hit "submit" … it doesn't go anywhere at all. It stays on the page and the console reports: "E_WC_21: User authentication failed due to invalid authentication values."
This has turned into one more frustrating thing after pulling over half my hair out over authorize.net's documentation of what I need to do about the MD5 end-of-life … of which I never could get anything to work to replace the SIM relay-response method that was being used. response.js seems fairly simple as a replacement, and I'm stuck here too.
What do I try next?
OK, I think I found the problem …
There's a difference between the API Login ID, the Transaction Key, and the Client Key.
That's not immediately obvious in some of the docs ….
For getting the data-clientKey, you should go to this place. Please see the attach screenshot.
Screenshot
I am about to learn how to automate processes with Camunda and the Camunda Modeler.
Therefore, I set up a small test process with two user tasks, a decision table and a service task. Everything works fine, except one of the user tasks.
In the mentioned user task, I want to embed a little HTML-Form which looks like this:
<form role="form" name="form">
<div class="form-group">
<label for="download">Travel request to review</label>
<a id="download" cam-variable-name="downloadRequest" cam-file-download="travelRequestDocument"></a>
</div>
<div class="form-group">
<label for="checkboxApproved">I approve this travel request.</label>
<input
id="checkboxApproved"
type="checkbox"
cam-variable-name="approved"
cam-variable-type="boolean"
class="form-control" />
</div>
</form>
I embedded it through the form key property in the Camunda Modeler:
embedded:deployment:forms/approval.html
When I go to Camunda tasklist (Camunda engine runs on local tomcat server) and open the task, it says: Form failure: Value 'on' is not of type boolean.
I searched the internet back and forth for reasons which could cause this error, but I couldn't find anything useful.
Maybe someone here has experience with this kind of problem?
I would be very thankful :)
The solution is quite simple: I just have to replace the "boolean" with "Boolean" (uppercase 'b').
I hope this answer will save others from hours of research... (like me)
I know this might be a duplicate question, but the previous one was an older question and those questions uses a form instance which doesn't really help me.
How do I keep my form data after a failed validation? I have multiple dropdowns and input fields and I hate to see my users re-do and re-type everything when they fail validation in the backend. Let's say I have this very simple form:
HTML:
<form class="" action="/register" method="post">
<label for="">First Name</label>
<input type="text" name="" value="">
<label for="">Last Name</label>
<input type="text" name="" value="">
<label for="">Password</label>
<input type="password" name="" value="">
</form>
views.py:
def register(self):
.....
if errors:
for err in errors
messages.errors(request, err)
return redirect('/')
else:
messages.success(request, "Welcome User!")
return redirect('/dashboard')
Most examples that I came across were using the form instance which uses form.save() etc. I opted out on that one. Is there a way to auto-populate my form with the data that the user submitted if they were to fail validation? Thanks!
Django form classes are the way to go. Form validation and rendering are the tasks they were build for. I would strongly recommend using them, because they also take care of security aspects, when it comes to passing user input back to the browser (all input from user land is evil!).
If you really need to achieve this without form classes, you need to add the form values to your rendering context manually - this allows you to use them in your template.
The main problem with your approach is, that you want to redirect in case of validation error. A redirect is a response to the browser that tells: I have nothing for you, please go to this location. Usually the browser does not post the data send in the first request also to the second one (which is generally a good behavior). You may work around that by answering with status code 307 instead of 302. Read e.g. Response.Redirect with POST instead of Get? for more information. Alternatively you may encode your form data into the target location using get parameters.
Again: You should have a very good reason to not just use the django approach of one view that acts on GET and POST different and handles the form properly using the form instance.
I want to redirect users to a confirmation page that will display both subject and content (if there is any) if they enter a valid subject, but stay on the same page and display an error if the subject is either blank or over three hundred characters.
Here is my backend code:
def post(self):
subject = self.request.get('subject')
content = self.request.get('content')
a, b = self.validSubject(subject)
if a == True and b == True:
self.redirect('/confirm')
else:
if a == False:
error = "Title cannot be blank!"
if b == False:
error = "Title cannot be over 300 characters."
self.render("newpost.html", subject = subject, content = content, error = error)
Here is the code for the newpost.html template:
<h2>New Question</h2>
<hr>
<form method="post">
<label>
<div>Title</div>
<input type="text" id="subject" name="subject">
</label>
<label>
<div>
<textarea name="content" id="postcontent"></textarea>
</div>
</label>
<b><div class="error">{{error}}</div></b>
<input type="submit">
</form>
I've tried adding action="/confirm" to the POST form, but that redirects to /confirm even if there is an error. I've looked at the webapp2 documentation but couldn't find anything on how to pass variables on a redirect. (https://webapp-improved.appspot.com/api/webapp2.html#webapp2.redirect)
I'm using webapp2 and jinja2. Thanks for any help in advance, I've been looking at this piece of code for quite a while :(
The pattern you're trying to write doesn't work within http, irrespective of what backend platform or language you're using. Your HTML is posting to the server and the GAE code is handling the post. At that point in the interaction, the browser has already submitted and is awaiting a response from the server. You can't stop the submission at that point since it's already happened.
You should consider validating the input in Javascript before the form is even submitted to the server. That way you can suppress the submission of the form in the first place if your data isn't valid.
Take a look at the following question to see an example of this:
JavaScript code to stop form submission
Please refer to the following code:
<cfform method="POST" action="#CGI.script_name#">
<p>Enter your Name:
<input name="name" type="text" hspace="30" maxlength="30">
<input type="Submit" name="submit" value="OK">
</cfform>
<cfscript>
function HelloFriend(Name) {
if (Name is "") WriteOutput("You forgot your name!");
else WriteOutput("Hello " & name &"!");
return "";
}
if (IsDefined("Form.submit")) HelloFriend(Form.name);
</cfscript>
Source: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=UDFs_01.html#1167055
The code runs fine even without CGI.script_name attribute of action field. May I know why it's required then? The description says "Uses the script_name CGI variable to post to this page without specifying a URL. "
The default action of an HTML form is to submit to itself when no action is specified. See this related discussion on the topic: Is it a good practice to use an empty URL for a HTML form's action attribute? (action="")
I always include an action, if for no other reason, to avoid confusion.