From 6f552762c02eb882e6915abd12937cd351bad752 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Fri, 3 Jun 2016 16:49:19 +0200 Subject: [PATCH 01/18] improve readme --- README.md | 76 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 49b4c8a..807a443 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,20 @@ Or install it yourself as: ## Usage -1. Initialization : `LemonWay::Client.new(api_params, client_config_options, &client_config_block)` - - `api_options` (Hash) : mandatory hash where are passed the api param you want to reapeat every client query + the `:wsdl` uri - - `client_config_options` (Hash) : optional hash passed to savon to build its [global options](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) used by the client on every query - - `client_config_block` (Block) : optional block to customize the savon client, takes a [savon global options](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) instance as param +1. Initialization : `LemonWay::Client.new(api_params, client_config_options, &client_config_block)` + - `api_options` (Hash) : mandatory hash where are passed the api param you want to reapeat every client query + the `:wsdl` uri + - `client_config_options` (Hash) : optional hash passed to savon to build its [global options](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) used by the client on every query + - `client_config_block` (Block) : optional block to customize the savon client, takes a [savon global options](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) instance as param ```ruby client = LemonWay::Client.new({wsdl: "https://ws.lemonway.fr/[...]/service.asmx?wsdl"}, {ssl_verify_mode: :none}) #is the same as client = LemonWay::Client.new wsdl: "https://ws.lemonway.fr/[...]/service.asmx?wsdl" do |opts| opts.ssl_verify_mode(:none) -end +end ``` - + 2. Query the API directly calling the method on the client instance : `client.api_method_name(params, client_config_override, &client_block_config_override)` - - `api_method_name` : Lemonway underscorized mehtod name (refer to the Lemonway doc or to `client.operations` to list them + - `api_method_name` : Lemonway underscorized mehtod name (refer to the Lemonway doc or to `client.operations` to list them - `params` (Hash) : params sent to the api, keys will be camelcased to comply with the SOAP convention used by Lemonway - `client_config_override` (Hash) : A hash of config transmitted to the savon client, which overrides the [savon global config](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) for the current api call only - `client_block_config_override` (Block) : A Block taking a [savon global options](https://github.com/savonrb/savon/blob/master/lib/savon/options.rb) instance as param, to override the client call configuration options @@ -44,36 +44,60 @@ end ```ruby # initialize the client -client = LemonWay::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/directkit/service.asmx?wsdl", + # at the end of url the `?wsdl` is realy important +# config/initializers/lemonway.rb +CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/directkit/service.asmx?wsdl", wl_login: "test", wl_pass: "test", language: "fr", version: "1.1", wallet_ip: "127.0.0.1" -# list the available operations as follow : -resp = client.operations -=> [:register_wallet, - :update_wallet_details, - :update_wallet_status, - :register_iban, - :register_sdd_mandate, - :register_card, - ... - ] +# list the available operations as follow : + CLIENT_LEMON = client.operations + => [:register_wallet, + :update_wallet_details, + :update_wallet_status, + :register_iban, + :register_sdd_mandate, + :register_card, + ... + ] + + # requests takes underscored names, and undescored (or camelcased) options, some hash with indifferent access are returned -resp = client.register_wallet, wallet: "123", - client_mail: "nico@las.com", - client_first_name: "nicolas", - client_last_name: "nicolas", - wallet_ip: "127.0.0.1" -=> {id: '123', lwid: "98098"} -resp[:id] == resp['id'] == '123' + +# models/user + after_create :create_lw_account + + private + def create_lw_account + CLIENT_LEMON = client.register_wallet(wallet: "123", + clientMail: "nico@las.com", + clientFirstName: "nicolas", + clientLastName: "nicolas", + wallet_ip: "127.0.0.1") + => {id: '123', lwid: "98098"} + + # Save the lwid in database + create[:id] == create['id'] == '123' + user = self.update(lwid: create[:id]) + end + ``` -Please refer to the Lemonway documentation for the complete list of methods and their parameters, or query https://ws.lemonway.fr/mb/[YOUR_LEMONWAY_NAME]/dev/directkitxml/service.asmx if Lemonway has provided you a development account +``` +# Wallet option : + CLIENT_LEMON.get_wallet_details(wallet: 'string', email:"string") + + +``` + + + +Please refer to the Lemonway documentation for the complete list of methods and their parameters, or query https://ws.lemonway.fr/mb/[YOUR_LEMONWAY_NAME]/dev/directkitxml/service.asmx if Lemonway has provided you a development account ## Contributing From 78e8e740ca7ac6ea60cb48b8dba4a1673aeb401f Mon Sep 17 00:00:00 2001 From: thibault finot Date: Fri, 3 Jun 2016 16:50:43 +0200 Subject: [PATCH 02/18] ok it was not a fail here --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 807a443..f5ad740 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d private def create_lw_account - CLIENT_LEMON = client.register_wallet(wallet: "123", + resp = CLIENT_LEMON = client.register_wallet(wallet: "123", clientMail: "nico@las.com", clientFirstName: "nicolas", clientLastName: "nicolas", @@ -81,8 +81,8 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d => {id: '123', lwid: "98098"} # Save the lwid in database - create[:id] == create['id'] == '123' - user = self.update(lwid: create[:id]) + resp[:id] == resp['id'] == '123' + user = self.update(lwid: resp[:id]) end From b31fa4f429688590ad8ff1570fe75d01c3a8ca06 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Wed, 15 Jun 2016 11:29:11 +0200 Subject: [PATCH 03/18] improve the readme --- README.md | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f5ad740..5f7a19c 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,7 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d wl_login: "test", wl_pass: "test", language: "fr", - version: "1.1", - wallet_ip: "127.0.0.1" + version: "1.1" # list the available operations as follow : CLIENT_LEMON = client.operations @@ -68,6 +67,16 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d # requests takes underscored names, and undescored (or camelcased) options, some hash with indifferent access are returned +# You need to send the IP of your client, to have it available everywhere do : + # application_controller + + before_filter :get_request + + def get_request + $request = request + end + + # models/user after_create :create_lw_account @@ -77,12 +86,17 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d clientMail: "nico@las.com", clientFirstName: "nicolas", clientLastName: "nicolas", - wallet_ip: "127.0.0.1") + payerOrBeneficiary: 1, + wallet_ip: $request.remote_ip, + ) => {id: '123', lwid: "98098"} # Save the lwid in database resp[:id] == resp['id'] == '123' user = self.update(lwid: resp[:id]) + ######################## + # Save the :id and not the :lwid, because it's this one that you need for the call after # + ########################## end @@ -90,13 +104,25 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d ``` # Wallet option : - CLIENT_LEMON.get_wallet_details(wallet: 'string', email:"string") + # Get wallet details + CLIENT_LEMON.get_wallet_details(wallet: 'id(string)', email:"email(string)") + + +``` + +``` + # For crowdfunding + # Create like classic user, but add need option, exemple : Debtor, (value = 1 if debtor) (example for project) + + # First credit the user wallet. + ``` + Please refer to the Lemonway documentation for the complete list of methods and their parameters, or query https://ws.lemonway.fr/mb/[YOUR_LEMONWAY_NAME]/dev/directkitxml/service.asmx if Lemonway has provided you a development account From d4dc3ad5b7ff4e72513001e050071def17a793f1 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Wed, 15 Jun 2016 11:31:23 +0200 Subject: [PATCH 04/18] try something with @ before result --- lib/lemonway/client.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 329ab56..c439619 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -39,16 +39,16 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = resp.body.fetch(:"#{method_name}_response").fetch(:"#{method_name}_result") result = with_custom_parser_options { Hash.from_xml(result) } unless result.is_a? Hash - result = result.underscore_keys(true).with_indifferent_access - - if result.key?(:e) - raise Error, [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') - elsif result.key?(:trans) - result[:trans].fetch(:hpay, result[:trans]) - elsif result.key?(:wallet) - result[:wallet] + @result = result.underscore_keys(true).with_indifferent_access + + if @result.key?(:e) + raise Error, [@result.fetch(:e).try(:fetch, :code), @result.fetch(:e).try(:fetch, :msg)].join(' : ') + elsif @result.key?(:trans) + @result[:trans].fetch(:hpay, @result[:trans]) + elsif @result.key?(:wallet) + @result[:wallet] else - result + @result end rescue KeyError => e From ec36449bda89194987c0b49664b02a6aea293f7d Mon Sep 17 00:00:00 2001 From: thibault finot Date: Wed, 15 Jun 2016 11:52:36 +0200 Subject: [PATCH 05/18] thats not working --- lib/lemonway/client.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index c439619..329ab56 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -39,16 +39,16 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = resp.body.fetch(:"#{method_name}_response").fetch(:"#{method_name}_result") result = with_custom_parser_options { Hash.from_xml(result) } unless result.is_a? Hash - @result = result.underscore_keys(true).with_indifferent_access - - if @result.key?(:e) - raise Error, [@result.fetch(:e).try(:fetch, :code), @result.fetch(:e).try(:fetch, :msg)].join(' : ') - elsif @result.key?(:trans) - @result[:trans].fetch(:hpay, @result[:trans]) - elsif @result.key?(:wallet) - @result[:wallet] + result = result.underscore_keys(true).with_indifferent_access + + if result.key?(:e) + raise Error, [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') + elsif result.key?(:trans) + result[:trans].fetch(:hpay, result[:trans]) + elsif result.key?(:wallet) + result[:wallet] else - @result + result end rescue KeyError => e From d94d5dd7e362ebe9b56c9a6c02ffb1c09dd07506 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Wed, 15 Jun 2016 12:00:06 +0200 Subject: [PATCH 06/18] try to remove raise --- lib/lemonway/client.rb | 2 +- lib/lemonway/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 329ab56..e415904 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') + [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) diff --git a/lib/lemonway/version.rb b/lib/lemonway/version.rb index 9cc407d..ff9a2e0 100644 --- a/lib/lemonway/version.rb +++ b/lib/lemonway/version.rb @@ -1,4 +1,4 @@ module Lemonway - VERSION = "1.0.1" + VERSION = "1.0.2" end From 3faf21ee5ac72f0985682737aa0de8a9ca00b987 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Wed, 15 Jun 2016 12:08:39 +0200 Subject: [PATCH 07/18] try other thing --- lib/lemonway/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index e415904..ecbed1e 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') + {error: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg) } elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) From c9172300910eec43cc69ef8728311aa6c0741484 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 10:19:34 +0200 Subject: [PATCH 08/18] back to raise error --- lib/lemonway/client.rb | 2 +- lib/lemonway/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index ecbed1e..329ab56 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - {error: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg) } + raise Error, [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) diff --git a/lib/lemonway/version.rb b/lib/lemonway/version.rb index ff9a2e0..9cc407d 100644 --- a/lib/lemonway/version.rb +++ b/lib/lemonway/version.rb @@ -1,4 +1,4 @@ module Lemonway - VERSION = "1.0.2" + VERSION = "1.0.1" end From 1d99caca20d5d59a157b01073b9a6c3d0d7a244e Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 11:09:06 +0200 Subject: [PATCH 09/18] raise hash error --- lib/lemonway/client.rb | 2 +- lib/lemonway/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 329ab56..2bbd35f 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, [result.fetch(:e).try(:fetch, :code), result.fetch(:e).try(:fetch, :msg)].join(' : ') + raise Error, {error: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) diff --git a/lib/lemonway/version.rb b/lib/lemonway/version.rb index 9cc407d..ff9a2e0 100644 --- a/lib/lemonway/version.rb +++ b/lib/lemonway/version.rb @@ -1,4 +1,4 @@ module Lemonway - VERSION = "1.0.1" + VERSION = "1.0.2" end From 405a6f6997e63872fce522253df89cc21a7bba89 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 11:10:38 +0200 Subject: [PATCH 10/18] number and message --- lib/lemonway/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 2bbd35f..6661003 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, {error: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} + raise Error, {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) From ea70bd46934caa4201b2baff15efad776e3692a0 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 11:15:39 +0200 Subject: [PATCH 11/18] try --- lib/lemonway/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 6661003..1310e35 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} + raise {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) From c43826b9ee10e056a994bc2c9156a72258419525 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 11:22:04 +0200 Subject: [PATCH 12/18] back to error --- lib/lemonway/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 1310e35..6661003 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} + raise Error, {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) From 0a6f069e0d41dbb972ab9a9d8faf500125741b41 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Thu, 16 Jun 2016 11:24:55 +0200 Subject: [PATCH 13/18] without hash --- lib/lemonway/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 6661003..2285645 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -42,7 +42,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, {number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg)} + raise Error, number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg) elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) From c2646d396204cd11fd837557f7d92dd5d99bedbe Mon Sep 17 00:00:00 2001 From: Armand Niampa Date: Sat, 23 Jul 2016 13:22:15 +0200 Subject: [PATCH 14/18] Change exception raising method --- lib/lemonway/client.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/lemonway/client.rb b/lib/lemonway/client.rb index 2285645..70edf37 100644 --- a/lib/lemonway/client.rb +++ b/lib/lemonway/client.rb @@ -5,15 +5,22 @@ module Lemonway class Client - class Error < StandardError; end + class Error < StandardError + attr_reader :code + + def initialize(code: nil, message:) + super(message) + @code = code + end + end attr_accessor :instance def initialize api_opts={}, client_opts={}, &block [api_opts, client_opts].each(&:symbolize_keys!) - @xml_mini_backend = client_opts.delete(:xml_mini_backend) || ActiveSupport::XmlMini_REXML - @entity_expansion_text_limit = client_opts.delete(:entity_expansion_text_limit) || 10**20 + @xml_mini_backend = client_opts.delete(:xml_mini_backend) || ActiveSupport::XmlMini_REXML + @entity_expansion_text_limit = client_opts.delete(:entity_expansion_text_limit) || 10**20 @instance = Savon.client client_opts.update(wsdl: api_opts.delete(:wsdl)), &block @@ -42,7 +49,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block result = result.underscore_keys(true).with_indifferent_access if result.key?(:e) - raise Error, number: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg) + raise Error, code: result.fetch(:e).try(:fetch, :code), message: result.fetch(:e).try(:fetch, :msg) elsif result.key?(:trans) result[:trans].fetch(:hpay, result[:trans]) elsif result.key?(:wallet) @@ -53,7 +60,7 @@ def client_call method_name, message_opts = {}, client_opts = {}, &block rescue KeyError => e #todo improve this message - raise Error, "#{e.message}, expected `#{method_name}_response.#{method_name}_result` but got : #{resp.body.inspect}" + raise Error, message: "#{e.message}, expected `#{method_name}_response.#{method_name}_result` but got : #{resp.body.inspect}" end # work around for From 354333c79b15458094bb067a36d6ea62527e2983 Mon Sep 17 00:00:00 2001 From: thibault finot Date: Tue, 26 Jul 2016 12:29:56 +0200 Subject: [PATCH 15/18] error in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f7a19c..6bf3b58 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d version: "1.1" # list the available operations as follow : - CLIENT_LEMON = client.operations + CLIENT_LEMON.operations => [:register_wallet, :update_wallet_details, :update_wallet_status, From 70a408c64f604e9aa03f4dfb44b20b9357f9e5d1 Mon Sep 17 00:00:00 2001 From: Thibault Finot Date: Thu, 28 Jul 2016 11:04:20 +0200 Subject: [PATCH 16/18] change version --- lib/lemonway/version.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lemonway/version.rb b/lib/lemonway/version.rb index ff9a2e0..76b4499 100644 --- a/lib/lemonway/version.rb +++ b/lib/lemonway/version.rb @@ -1,4 +1,3 @@ module Lemonway - VERSION = "1.0.2" - + VERSION = "1.0.3" end From 309434eda8ff40bbf32d1acfd677b38e79a3b29a Mon Sep 17 00:00:00 2001 From: Thibault Finot Date: Thu, 28 Jul 2016 15:41:27 +0200 Subject: [PATCH 17/18] improve the readme for crowdfunding application --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bf3b58..635101b 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,34 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d # For crowdfunding # Create like classic user, but add need option, exemple : Debtor, (value = 1 if debtor) (example for project) - # First credit the user wallet. + def contribution + # First initialise the webkit + + fill_user_wallet = CLIENT_LEMON.money_in_web_init( + wallet: current_user.lwid, + amountTot: @contribution.amount.to_f, + wkToken: @contribution.id, + returnUrl: after_payment_url, + errorUrl: after_payment_url, + cancelUrl: after_payment_url, + autoCommission: 0, + wallet_ip: $request.remote_ip) + + # define in your routes.rb the root of after_payment + + # Then call the webkit : + + redirect_to(ENV['LW_WEBKIT'] + "?moneyInToken=#{fill_user_wallet[:moneyinweb][:token]}") + end + + # And after_payment : + + def after_payment + CLIENT_LEMON.get_money_in_trans_details(transactionMerchantToken: params[:response_wkToken], wallet_ip: $request.remote_ip) + + # redirect where you want + end ``` From be9e4f4a25557081ff7b2d53c59abc51cec13fc5 Mon Sep 17 00:00:00 2001 From: Thibault Finot Date: Thu, 28 Jul 2016 15:44:15 +0200 Subject: [PATCH 18/18] add ruby before comment --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 635101b..cc0dddb 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d ``` -``` +```ruby # Wallet option : # Get wallet details CLIENT_LEMON.get_wallet_details(wallet: 'id(string)', email:"email(string)") @@ -110,7 +110,7 @@ CLIENT_LEMON = Lemonway::Client.new wsdl: "https://ws.lemonway.fr/mb/ioio/dev/d ``` -``` +```ruby # For crowdfunding # Create like classic user, but add need option, exemple : Debtor, (value = 1 if debtor) (example for project)