Google Checkout Sandbox not working - google-checkout

I have created sanbox merchant account in google checkout but when i have submitted this form i got this error message
" Oops!
Bilal has sent Google a shopping cart with errors in it. We'll contact them to ask that they fix this problem. As this could be a temporary issue, you can go back in your browser to try checking out again.
Debugging information
If you are acting on behalf of the merchant, more information about this error has been made available in the Integration Console under the Tools section. You can access the details of this error directly by logging into your merchant account and then pasting the following url:
https://sandbox.google.com/checkout/sell/settings?section=IntegrationConsole&returnURL=https%3A%2F%2Fsandbox.google.com%2Fcheckout%2Fsell%2Fsettings%3Fsection%3DIntegrationConsole&serialNumber=523b617a-106c-4c87-a2cc-135e20c983eb "
The Form that i have created as follows:
var output_data1 = <form id ="GC" name="GC" method="POST" action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/ 922635804601464" accept-charset="utf-8">';
output_data1 += "Please wait while we are redirecting to the Payment Gateway.";
output_data1 += '<input type="hidden" name="item_name_1" value="'+monument_name+'">';
output_data1 +='<input type="hidden" name="item_description_1" value="'+monument_color+'">';
output_data1 += '<input type="hidden" name="item_quantity_1" value="1">';
output_data1 += '<input type="hidden" name="item_price_1" value="'+AMOUNT+'">';
output_data1 += '<input type="hidden" name="item_currency_1" value="USD">';
output_data1 += '<input type="hidden" name="ship_method_name_1" value="UPS Ground">';
output_data1 += '<input type="hidden" name="ship_method_price_1" value="0.0">';
output_data1 +=
'<input type="hidden" name="ship_method_currency_1" value="USD">';
//output_data1 += '<input type="hidden" name="tax_rate" value="0.0875">';
output_data1 += '<input type="hidden" name="tax_us_state" value="CA">';
output_data1 += '<input type="hidden" name="checkout-flow-support.merchant-checkout-flow-support.continue-shopping-url" value="http://www.thegranitemonumentcompany.com/p/Main">';
output_data1 += '<input type="hidden" name="_charset_">';
output_data1 += '</form>'

It's hard to tell from your description where the problem is. I'm including two Checkout error troubleshooting articles, hope it helps.
Google Checkout - Cart Post Oops Error Troubleshooting:
http://code.google.com/apis/checkout/articles/Google_Checkout_Cart_Post_Troubleshooting.html
Troubleshooting Integration Console Errors:
http://code.google.com/apis/checkout/articles/Troubleshoot_Integration_Console_Errors.html

Related

Dynamically created DOM elements on ajax success method

i have a little error with my ajax success method DOM elements creation. on the success method i have created an html table row and inside that row i have created a form but this form not work ass expected.
this is a code on ajax success
success: function(data) {
html='';
for (i = 0; i < data['qoutations'].length; i++) {
html+='<tr><form method="post" action="index.php?route=catalog/product/getForm&user_token={{ user_token }}">';
html+='<td class="text-center"><input type="checkbox" name="selected[]" value="'+data['qoutations'][i]['qoutation_id']+'" /></td>';
html+='<td class="text-left">'+data['qoutations'][i]['customer_id'];
html+='<input type="hidden" id="customer_id" value="'+data['qoutations'][i]['qoutation_id']+'"/></td>';
html+='<td class="text-left">'+data['qoutations'][i]['description']+'</td>';
html+='<td class="text-left"> <div class="form-group">';
html+='<textarea class="form-control" rows="2" id="qouted"></textarea>';
html+='</div></td>';
html+='<td class="text-left">';
var customer_id1=data['qoutations'][i]['customer_id'];
var qoutation_id1=data['qoutations'][i]['qoutation_id'];
html+='<input class="btn btn-info" type="submit" id="createproduct" value="Create Product" onClick="createProduct(\'' + customer_id1 + '\',\''+qoutation_id1+'\')"/></td>';
html+='<td class="text-left">'+data['qoutations'][i]['qouted']+'</td>';
html+='<td class="text-left">'+data['qoutations'][i]['status']+'</td>';
html+='<td class="text-left">'+data['qoutations'][i]['date'];
html+='<input type="hidden" id="date" value="'+data['qoutations'][i]['date']+'"/></td>';
html+='<td class="text-left">';
html+='<input class="btn btn-danger" type="button" id="cancel" value="cancel"/></td>';
html+='</tr>';
}
$('#detail').html(html);
}
and this picture elaborate my error. as this picture shows form element open and close immediately.
DOM screenshot
please help, thanks in advance.
The problem with your code is that you are actually not following the standard to create html in your ajax callback.
You can't have a form inside a table row. Only way to do this is to divide your table row into sub form. Please take a look at this question.
HTML: Is it possible to have a FORM tag in each TABLE ROW in a XHTML valid way?

Form Does not update database sinatra

I am facing issues with the connection of a form with the database, when I am trying to update a record using Sinatra.
I created a route and a form in a view.
At first the form connects to the get route and brings the relevant data. However, when I modify the fields and press the submit button to update the database, the record does not updated.
get'/users/:id/edit'do
# see the User we want to edit
#user = User.find_by_id(params[:id])
#Assign the values to all properties
#user.username = #user.username
#user.password = #user.password
#user.description =#user.description
#user.city = #user.city
#user.save
erb:edit
end
put 'users/:id/edit' do
#user = User.find_by_id(params[:id])
#Assign the values to all properties
#user.username = #user.username
#user.password = #user.password
#user.description =#user.description
#user.city = #user.city
#user.save
end
My form looks like this:
<form action="users/:id/edit" method="post" id="edit">
<input type="hidden" name="_method" value="put">
User ID : :<%=#user.id%> <br>
Username:<input type="text" name="username" value=
<%=#user.username%>"><br>
Password:<input type="password" name="password" value="
<%=#user.password%>"><br>
City:<input type="text" name="city" value="<%=#user.city%>">
<br>
Tell us more about you:<input type="text" name="description"
value="<%=#user.description%>"><br>
<input type="submit" name="Update" class="btn btn-primary " >
</form>
Can you please assist?
The form was passing the record id to the route, thus I modified the form to:
<form action="/users/edit/<%=#user.id%>" method="post"
id="edit">
and the route to:
put '/users/edit/:id' do
#user = User.find_by_id(params[:id])
#user.city= params[:city]
# rest of the fields need to be modified
end

Browser-Based Uploads Using POST

I'm trying to create a client side uploads using POST with Signature Version 4 of AWS.
According to the documents
When i'm generating the signature on the server side I get an exact match with AWS signature mentioned in this example page.
However when I use it to upload the page I get this error:
SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method
This is the code I've used:
OpenSSL::HMAC.hexdigest('sha256', signing_key(string_to_sign), string_to_sign)
# step 2 in the aws documentation
def signing_key(encoded_policy)
# generate the correct date
date = extract_encoded_policy_date(encoded_policy)
date = time_adjust(date)
# encode all the fields by the algorithm
date_key = OpenSSL::HMAC.digest('sha256',"AWS4#{#secret_access_key}", date.strftime("%Y%m%d"))
date_region_key = OpenSSL::HMAC.digest('sha256',date_key, #region)
date_region_service_key = OpenSSL::HMAC.digest('sha256',date_region_key, #service)
signing_key = OpenSSL::HMAC.digest('sha256',date_region_service_key, 'aws4_request')
signing_key
end
def time_adjust(date)
time = Time.parse(date)
time += time.utc_offset
time.utc
end
After a little search in the net, i've encountered this article. Iv'e implemented this code and the upload succeeded.
signature = OpenSSL::HMAC.digest( OpenSSL::Digest::Digest.new('sha1'), #secret_access_key, string_to_sign)
Base64.encode64(signature).gsub("\n","")```
This is a small Demo for the client side code.
here is some literature I've found useful:
General description
Some code snippets from AWS
What is the differences between the two?
How can I get the first option to work and upload my files?
Is the example in the AWS page no longer valid?
After a research and comparing the AWS post example i found out that there were some redundant fields in the form that made AWS think i'm using SHA1.
After removing the AWSAccessKeyId field from the form and renaming some other fields I managed to make the AWS4 work.
This is the updated Demo
<form id="myForm" action="http://yourbucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
<input type="hidden" id="key" name="key" value="uploads/${filename}"/>
<input type="hidden" id="acl" name="acl" value="YOUR_ACL_OPTION"/>
<input type="hidden" name="success_action_redirect" value="http://google.com" />
<input type="hidden" id="type" name="Content-Type" value="MIME_TYPE"/>
<input type="hidden" name="x-amz-meta-uuid" value="14365123651274" />
<input type="hidden" name="X-Amz-Credential" value="YOUR_CREDENTIALS" />
<input type="hidden" name="X-Amz-Algorithm" value="AWS4-HMAC-SHA256" />
<input type="hidden" id="date" name="X-Amz-Date" value="" />
<input type="hidden" name="x-amz-meta-tag" value="" />
<input type="hidden" id="policy" name="Policy" value="YOUR_POLICY_DOCUMENT_BASE64_ENCODED"/>
<input type="hidden" id="signature" name="X-Amz-Signature" value="YOUR_CALCULATED_SIGNATURE"/>
<input name="file" id="file" type="file"/>
<input id="btn_submit" class="btn btn-warning" type="submit" value="Upload File to S3">
</form>

How do I programmatically download a file behind Oracle's OTN login page?

I'm trying to create a Chocolatey package for the Oracle WebLogic Server binaries. I know that I must pass a special cookie for the "license acceptance". But, I'm getting stuck trying to get past the login form. I've been researching how to get it done with wget or curl and I'm trying to map that to System.Net.WebClient, where applicable.
I have the following so far, which works for other Oracle downloads with license acceptance (like the JDK).
$url = "http://download.oracle.com/otn/nt/middleware/12c/wls/1212/wls1212_dev.zip"
$temp = Join-Path $ENV:TEMP "oracle-weblogic-server.zip"
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
$client.Headers.Add("Cookie", "gpw_e24=http://www.oracle.com")
$client = New-Object System.Net.WebClient
$client.DownloadFile($url, $temp)
I've read in a few places that the Oracle download page supports "basic" authentication. Which should mean setting a NetworkCredential. So, I set this before downloading...
$client.Credentials = New-Object System.Net.NetworkCredential("username", "password")
But, the response seems to contain a login page! (here is a fragment of the form). UPDATE: I think only the Oracle support portal supports basic authentication :(
<form action="https://login.oracle.com/mysso/signon.jsp" method="post" name="myForm">
<input type="hidden" name="v" value="v1.4">
<input type="hidden" name="p_submit_url" value="https://login.oracle.com:443/sso/auth">
<input type="hidden" name="p_cancel_url" value="https://edelivery.oracle.com">
<input type="hidden" name="p_error_code" value="">
<input type="hidden" name="ssousername" value="">
<input type="hidden" name="subscribername" value="">
<input type="hidden" name="authn_try_count" value="0">
<input type="hidden" name="contextType" value="external">
<input type="hidden" name="username" value="string">
<input type="hidden" name="contextValue" value="/oam">
<input type="hidden" name="password" value="sercure_string">
<input type="hidden" name="challenge_url" value="https://login.oracle.com/mysso/signon.jsp">
<input type="hidden" name="request_id" value="903089276773533395">
</form>
I also tried writing the authorization header directly, but I got the same result.
$client.Headers.Add("Authorization", "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}")))
I stumbled on an old message about OTN not allowing command-line authentication. I don't know how to verify that, but other sites are saying the same thing (they might be parroting one source, though). But, I swear I've seen people POSTing credentials with wget and --post-data, I can't find it now.
I played with the WebClient.UploadValues to no avail. Maybe I'm picking the wrong names or the wrong URL? I have noticed some redirects in the responses and when I'm manually watching the traffic (Inspect Element | Network in Chrome). But, I don't know what do with this information!
$login = "https://login.oracle.com/mysso/signon.jsp"
$data = New-Object System.Collections.Specialized.NameValueCollection
$data.Add("username", "username")
$data.Add("password", "password")
$client.UploadValues($login, "POST", $data)
So, first, and most importantly, is there any way to login to OTN from the command line. Second, how do I do it with WebClient?
This method could possibly get you into trouble as it seems like the required login is there to specifically ensure it's a human on the other end.

ajax contact form Id, bugged

i have a contact form on http://daniloportal.com/NPC2/contact.html
Now this ajax script works very well, but i have other contact forms that i would like to use the same script for. so when i tried to create mulitple instances of the script, i noticed it stopped working because the ID name is not specifically ajax-contact-form. take a look at the code:
<form id="ajax-contact-form" action="">
<input type="text" name="name" value="Name *" title="Name *" />
<input type="text" name="email" value="Email " title="Email *" />
<input type="text" name="email" value="Email *" title="Email *" />
<textarea name="message" id="message" title="Message *">Message *</textarea>
<div class="clear"></div>
<input type="reset" class="btn btn_clear" value="Clear form" />
<input type="submit" class="btn btn_blue btn_send" value="Send message!" />
<div class="clear"></div>
</form>
and heres the JS
$("#ajax-contact-form").submit(function() {
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "contact_form/contact_process.php",
data: str,
success: function(msg) {
// Message Sent - Show the 'Thank You' message and hide the form
if(msg == 'OK') {
result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
$("#fields").hide();
} else {
result = msg;
}
$('#note').html(result);
}
});
return false;
});
Now if i were to switch that ID name on both and MATCH them, the script stops working- Theoretically it should work- not sure whats wrong with this.
as always any help is appreciated, thanks!
If you are trying to access two elements with the same id with jQuery - nothing gonna happen. Each element must have a unique identifier, otherwise you should use classes.
However, can you give us the markup of another form?

Resources