Ruby - "Certificate Verify Failed" Error on WePay Embedded Checkout - iframe

I am attempting to set up the WePay API to accept payments on my website via the Embedded Checkout, and I am running into some issues. The website is currently hosted on my local machine for testing and was created in Ruby on Rails (ruby 1.9.3p545 and Rails 3.2.13). I have my own shopping cart system in place, so when the user clicks on the “Checkout” button in the cart, I added the following code in the next controller action:
# set _use_stage to false for live environments
wepay = WePay.new(CLIENT_ID, CLIENT_SECRET, USE_STAGE)
# create the checkout
response = wepay.call('/checkout/create', ACCESS_TOKEN, {
:account_id => ACCOUNT_ID,
:amount => '24.95',
:short_description => 'Software',
:type => 'SERVICE'
})
I have done this because the page that loads after the user clicks on “Checkout” will show the WePay iframe, and I need to receive a checkout_id and a checkout_uri before showing the iframe. All of the variables in capital letters are defined in the config\environments\development.rb file and are based on their respective values from my WePay account. Upon clicking the “Checkout” button, I found that the call to /checkout/create fails. I receive the following error message:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
The WePay calls and objects are recognized since I have included the correct WePay gem in my Gemfile.
For reference, the official documentation for WePay's Embedded Checkout can be found here: https://www.wepay.com/developer/process_payments/iframe-checkout
EDIT:
I resolved the issue by following the instructions on the first answer at the following link: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed on WINDOWS

To recap the fix here-added the 'certified' gem to the Gemfile fixed the problem.

Related

Drupal 7 - View xxx could not be found (using services module)

I am new to Drupal 7 Services (API creation). I read a post from https://www.ostraining.com/blog/drupal/services/
I have installed the required modules and configured all as they said however, I did not integrate any authentication under structure > Services
Thus under Authentication tab, its saying:
No authentication modules are enabled, all requests will be anonymous.
Also, I did not checked the following under "EDIT" tab:
Session authentication
OAuth authentication
However, when I want to access the API through http://localhost/project-name/myrestapi/views/myrestapi
It is saying that ["View myrestapi could not be found"]
Please note, the view is showing the below result from the admin panel:
array (
0 =>
stdClass::__set_state(array(
'title' => 'About Us',
)),
)
May be it was the services_views module(7.x-1.4) I was previously installed. I uninstalled the module and install the previous version of services_views 7.x-1.3. Then I created another view e.g. Rest with another Services and renamed the path (Path:/rest).
Now, I can accessing the path like:
http://localhost/drupal767/myrestapi/views/rest.json?display_id=services_1
http://localhost/drupal767/myrestapi/rest.json
The result looks like:
[{"node_title":"About Us"}]

Can't reset user's password in Google Identity Toolkit: "CAPTCHA_CHECK_FAILED"

I'm trying to setup my Google Identity Toolkit so users can reset their passwords. I'm following the documentation here: https://developers.google.com/identity/toolkit/web/required-endpoints#send_email_url
I'm using the PHP Gitkit Client outlined here: https://github.com/google/identity-toolkit-php-client/blob/master/src/GitkitClient.php
Specifically the function getOobResults() on line 307 seems to be unhappy for some reason. Here's where I'm at:
User sets up account and logs in successfully
User then logs out and starts to log back in, enters email in and clicks "Forgot password"
reCaptcha is shown, click check box and then hit continue
At this point my 'Send Email URL' endpoint (gitkitEmail.php) is successfully called and the following POST is set to it (dropping the full '&response' param since it goes on for a while):
action=resetPassword&email=xodfebefa%40nada.ltd&challenge&response=03ACgFB9tGlNt2KAGhrVY....
I then take that string and parse it using parse_str(); since getOobResults() is looking for an array. However, response I get back is always:
{
"response_body": {
"error": "CAPTCHA_CHECK_FAILED"
}
}
I searched around but can't find any details on this error. Any help would be appreciated. I don't have a reCaptcha setup anywhere on my site, unsure if this is expecting me to do that and that's why it's failing? Also, I did bump all my code to a production environment and got the same error there as I did on my localhost.

Google push notifications - DOMException: Registration failed - permission denied

I'm following the (getting started with push locations guide) but am running into an error on step 6:
undefined:1 Uncaught (in promise) DOMException: Registration failed - permission denied
My manifest.json file is loading correctly based on the Network tab.
I have entered my correct project number into manifest.json. I have tried adding other settings not mentioned in the guide:
{
"name": "Push Notifications codelab",
"gcm_sender_id": "123456789",
"gcm_user_visible_only": true,
"permissions": [
"gcm"
]
}
I am running my server on localhost as per the guide.
If you're using Brave(the browser) and having the same issue, you have to enable Use Google Services for Push Messaging in the settings.
In order to enable it:
Brave settings > Privacy and Security > Use Google Services for Push Messaging
or use brave://settings/privacy shortcut.
My problem was actually in my settings for Chrome. Under Content Settings, Notifications was set to Do not allow any site to show notifications. Changing this setting to Ask when a site wants to show notifications resolved the issue for me.
DOMException occurs when an operation is impossible to perform, either for logical reasons, because data is lost, or because the implementation has become unstable. You got your error DOMException: Registration failed - permission denied maybe because the manifest was loaded from a different domain than the main page. Suggested from this thread, try to use <link rel="manifest" href="/manifest.json"> if your page is not located at the root of the website. You can also check on this related SO question.

Integrate twitter in drupal 7 website

I am trying to get the twitter module (7.x-5.4) running on my local drupal 7.19 website. Already installed Oauth and registered a twitter app. I am using the keys of that twitter app.
Callback URL
http://localhost/drupal-7.19/twitter/oauth
twitter host
http://twitter.com
Twitter API
https://api.twitter.com
Twitter search
http://search.twitter.com
TinyURL
http://tinyurl.com
when I want to add at least my own twitter account so that the site can display my tweets. when I want to add this account, an error occurs:
Notice: Undefined property: stdClass::$data in Twitter->request() (line 131 of root\modules\twitter\twitter.lib.php).
Could not obtain a valid token from the Twitter API. Please review the configuration.
any ideas? thanks in advance.
In my case, uncommenting the line
extension=php_openssl.dll
in php.ini resolved the error.
I'm not sure this will work for you, but this worked for me. I had the same exact error, even though I had followed the documentation. Here's the test: go to admin/reports/status. If you see the following warning: "HTTP request status Fails" this means your drupal/LAMP stack is unable to use DNS to callback to itself. In my case I used my machines's IP to access my Drupal instance. So, rather that use "localhost" use your machine's IP address (you can use ipconfig on MSWin or ifconfig on Mac/Linux) and use that for finishing the twitter account setup process.
Again, not
http://localhost/drupal-7.19/twitter/oauth
but
http://10.0.1.9/drupal-7.19/twitter/oauth
(substituting your machine's IP address)
I was getting the exact same error which i fixed by adding appropriate proxy server details.
Notice: Undefined property: stdClass::$data in Twitter->request() (line 131 of C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.lib.php
The problem was due to proxy-settings. I added values for $conf['proxy_server'] and $conf['proxy_port'] in settings.php and this error vanished.
I also verified that if i remove the proxy settings, this error is reproduced again.
Install oauth_common and twitter on your Drupal site
Check that both Oauth and the Twitter modules are enabled. I didn't use any of the other Twitter modules to do this
Go to the twitter module in Drupal
Go to the Configure (button) -> settings (Tab)
(note that the Callback URL is http://localhost/yourwebsite/twitter/oauth i.e. it doesn’t have to be 127.0.0.1)
Click on the link that says register your application
Go to twitter and sign in to be a developer
Add a new application, making a distinct feed name
Enter your site details
For localhost use: http://127.0.0.1:8000/twitter/oauth for both the website and callback URLs
Press save when you've done
Next go to the Test OAuth button - this will give you your illusive consumer key and consumer secret key
Back to the Drupal website and and to the twitter module to configure (button) -> settings (Tab)
Copy and paste these consumer and consumer secret keys you just got
Press Save configuration
Hopefully no errors.
Go to the twitter tab in the module and hopefully your twitter avatar has appeared
Read the top of the page where it says "Tweets are pulled from Twitter by running cron. You can view the full list of tweets at the Tweets view."
Select the View Tweets checkbox and click view - Chances are your tweets won’t show up in the next window - yet
Go to your drupal Configuration screen and to [System] Cron and press the "Run cron"
Now go back to view tweets from the twitter module and they should all appear
[This was a pig to figure out]

Post to page at any time (offline access)

I'm trying to make a app that integrates into the WHMCS that will allows admins to set posts that will be put on their FB page's wall at a certain time.
I am using a piece of code that allows me to post to the page ok but when trying to run the PHP script from a CLI (Shell):
root#golf [~]# php -q /home/host/public_html/modules/addons/social/cron.php
I receive the following message:
Please check Facebook API settings, OAuthException: (#803) Some of the
aliases you requested do not exist: 0
Could someone please tell me what this message means and how I can get this working.
Also if I have not access the app from the web interface for a while the following message is displayed:
Exception: 102: parameters uid or session key required
A popup then appears on that page and it refreshes, the message is no longer there (until I come back a little later)
Would be great for as much help as I can get.
Daniel Collins.

Resources