wallee-payment / ruby-sdk Goto Github PK
View Code? Open in Web Editor NEWThe ruby SDK allows an easy integration of wallee into ruby applications.
License: Apache License 2.0
The ruby SDK allows an easy integration of wallee into ruby applications.
License: Apache License 2.0
Snyk has reported vulnerability in JSON locked version, can you please update it?
https://snyk.io/vuln/SNYK-RUBY-JSON-20060
I'm not able to test the example in your Readme. I've copy and pasted it. Also I configured in the app rules that is has account admin privileges.
require 'sinatra'
require 'wallee-ruby-sdk'
# Setup userId and authenticationKey
Wallee.configure do |config|
config.debugging = true
config.user_id = '841'
config.authentication_key = '******'
end
api_instance = Wallee::AccountService.new
opts = {
filter: Wallee::EntityQueryFilter.new # EntityQueryFilter | The filter which restricts the entities which are used to calculate the count.
}
begin
#Count
result = api_instance.account_service_count(opts)
p result
rescue Wallee::ApiError => e
puts "Exception when calling AccountService->account_service_count: #{e}"
end
This is the output:
/Users/josua/.rbenv/shims/bundle exec ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/josua/projects/wallee/app.rb
D, [2017-09-26T12:31:56.718672 #77762] DEBUG -- : Calling API: AccountService.account_service_count ...
D, [2017-09-26T12:31:56.718910 #77762] DEBUG -- : HTTP request body param ~BEGIN~
{}
~END~
Trying 104.20.251.70...
Connected to app-wallee.com (104.20.251.70) port 443 (#0)
TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
Server certificate: *.app-wallee.com
Server certificate: COMODO RSA Domain Validation Secure Server CA
Server certificate: COMODO RSA Certification Authority
Server certificate: AddTrust External CA Root
POST /api/account/count HTTP/1.1
Host: app-wallee.com
User-Agent: Typhoeus
Content-Type: application/json;charset=utf-8
Accept: application/json;charset=utf-8
x-mac-version: 1
x-mac-userid: 841
x-mac-timestamp: 1506421916
x-mac-value: ******
Content-Length: 2
upload completely sent off: 2 out of 2 bytes
HTTP/1.1 401 Unauthorized
Date: Tue, 26 Sep 2017 10:31:58 GMT
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=******; expires=Wed, 26-Sep-18 10:31:57 GMT; path=/; domain=.app-wallee.com; HttpOnly
X-SVID: *******
Set-Cookie: _csrf_token_443=******;Path=/;Expires=Tue, 26-Sep-2017 11:31:58 GMT;Max-Age=3600;Secure;HttpOnly
Set-Cookie: language=en-US;Path=/;Secure;HttpOnly
X-URL: https://app-wallee.com:443/api/account/count
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Server: cloudflare-nginx
CF-RAY: 3a458e79b90d3e56-ZRH
Connection #0 to host app-wallee.com left intact
D, [2017-09-26T12:31:57.235680 #77762] DEBUG -- : HTTP response body ~BEGIN~
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Error</title>
<link rel="icon" type="image/png" href="/assets/images/favicon.png" />
<link type="text/css" rel="stylesheet" media="all" href="/error-page-assets/bootstrap.css" />
<link type="text/css" rel="stylesheet" media="all" href="/error-page-assets/layout.css" />
</head>
<body class="error">
<div class="container">
<div class="layout-header">
<div class="navbar-header">
<a class="navbar-brand" href="/"><img src="/assets/images/wallee-logo-primary.svg" /></a>
</div>
</div>
<div class="container-error">
<div class="col-sm-6 col-xs-12">
<h1>Ooops!</h1>
<h2>Sorry, something went wrong!</h2>
<span>Error code: 401</span>
<span>Please contact us and we will try to solve this issue.</span>
</div>
<div class="col-sm-6 hidden-xs">
<img src="/assets/images/error/internal-exception.svg" class="img-responsive" />
</div>
</div>
</div>
</body>
</html>
~END~
Exception when calling AccountService->account_service_count: Unauthorized
[2017-09-26 12:31:57] INFO WEBrick 1.3.1
[2017-09-26 12:31:57] INFO ruby 2.4.2 (2017-09-14) [x86_64-darwin15]
== Sinatra (v1.4.8) has taken the stage on 4567 for development with backup from WEBrick
[2017-09-26 12:31:57] INFO WEBrick::HTTPServer#start: pid=77762 port=4567
Hi @vttn after updating to 2.2.1 i have an error like
> Wallee::SubscriptionService.new
ArgumentError: wrong number of arguments (given 0, expected 2..3)
ruby-sdk-ef991e75b574/lib/wallee-ruby-sdk/api/subscription_service_api.rb:222:in `initialize'
Also can you please update it on rubygems as only 2.0.1 is available
https://rubygems.org/gems/wallee-ruby-sdk
Thanks
I come from a configuration like this:
if Rails.env.production? && ENV["SKIP_WALLEE"].blank?
Wallee.configure do |config|
config.user_id = ENV["WALLEE_APP_USER_ID"]
config.authentication_key = ENV["WALLEE_APP_AUTHENTICATION_KEY"]
end
end
I wanted to write tests and they failed because requests to the Wallee API without configuring authentication will fail in base64.rb
(str.unpack1("m")
):
NoMethodError:
undefined method `unpack1' for nil:NilClass
This was difficult to relate to the cause.
It would be nice if you could check for a valid config in Wallee::ApiClient#initialize
and raise a readable message like "Missing app user credentials!"
Hello @vttn, as mentioned here i provided outdated link, sorry.
It would be great to have updated version https://www.ruby-lang.org/en/news/2020/03/19/json-dos-cve-2020-10663/
I stumbled over this error on my macOS Sonoma 14.3 with the typheous gem (using libcurl) when calling the wallee API with the SDK:
objc[43182]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[43182]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
The solution for my local setup was to set OBJC_DISABLE_INITIALIZE_FORK_SAFETY
.
I got the hint from here: https://stackoverflow.com/a/59315607/430418
Whenever a request does not contain query params, the API client encodes the incorrect URL with an extra ?
(for example: http://app-wallee.com/api/account/create?
) in x-mac-key
which results in 401 errors. I have tried a fix locally and it works when changing
ruby-sdk/lib/wallee-ruby-sdk/api_client.rb
Line 150 in f8cec3e
completed_path = "#{base_url.path}#{path}"
completed_path += "?" + query.map{|k,v| "#{k}=#{v}"}.join('&') unless query.empty?
Here are the failed request logs if you need them:
D, [2021-01-12T12:14:41.171627 #90679] DEBUG -- : Calling API: ApplicationUserService.create ...
D, [2021-01-12T12:14:41.172147 #90679] DEBUG -- : HTTP request body param ~BEGIN~
{"name":"API User","state":"ACTIVE","primaryAccount":{"id":REDACTED}}
~END~
Found bundle for host app-wallee.com: 0x7fbe1887ea00 [can multiplex]
Re-using existing connection! (#0) with host app-wallee.com
Connected to app-wallee.com (104.20.89.191) port 443 (#0)
Using Stream ID: 3 (easy handle 0x7fbe1821e400)
POST /api/application-user/create HTTP/2
Host: app-wallee.com
User-Agent: Typhoeus
Content-Type: application/json;charset=utf-8
Accept: application/json;charset=utf-8
x-mac-version: 1
x-mac-userid: ...
x-mac-timestamp: 1610450081
x-mac-value: ...
Content-Length: 66
We are completely uploaded and fine
HTTP/2 401
date: Tue, 12 Jan 2021 11:14:41 GMT
content-type: text/html;charset=utf-8
set-cookie: ...
strict-transport-security: max-age=15552000; includeSubDomains; preload
cf-cache-status: DYNAMIC
cf-request-id: 0797e72e570000103fdea07000000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
set-cookie: language=en-US; Path=/; Secure; HttpOnly
x-content-type-options: nosniff
x-svid: 0f55a8df3c435e082
x-url: https://app-wallee.com:443/api/application-user/create
Connection #0 to host app-wallee.com left intact
D, [2021-01-12T12:14:41.451859 #90679] DEBUG -- : HTTP response body ~BEGIN~
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Error</title>
<link rel="icon" type="image/png" href="/assets/images/favicon.png" />
<link type="text/css" rel="stylesheet" media="all" href="/error-page-assets/bootstrap.css" />
<link type="text/css" rel="stylesheet" media="all" href="/error-page-assets/layout.css" />
<script>
// We need to force a reload when the back button is used in the browser.
window.addEventListener( "popstate", function ( event ) { window.location.reload(true); });
</script>
</head>
<body class="error">
<div class="container">
<div class="container-error">
<div class="col-sm-6 col-xs-12">
<h1>Ooops!</h1>
<h2>Sorry, something went wrong!</h2>
<span>Error code: 401</span>
<span>Please contact us and we will try to solve this issue.</span>
</div>
<div class="col-sm-6 hidden-xs">
<img src="/assets/images/error/internal-exception.svg" class="img-responsive" />
</div>
</div>
</div>
</body>
</html>
~END~
Test issue please ignore
#110
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.