payr 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -137,6 +137,9 @@ The controller could look something like this for example :
137
137
  end
138
138
  ```
139
139
 
140
+
141
+
142
+
140
143
  Basically, thoses actions do :
141
144
  ```ruby
142
145
  #
@@ -178,6 +181,38 @@ payr_bills_pay_path(article_id: pack.id,
178
181
  ```
179
182
  This will call the bills#action and then redirect the user to the paybox paiement page.
180
183
 
184
+ # /!\ There is a security flaw in the above lines
185
+
186
+ While I'm correcting it, you MUST override the pay action, otherwise, someone could just make a get with the wanted amount and the wanted article.
187
+
188
+ a possible overriding would be this:
189
+
190
+ ```ruby
191
+ class Paiement::CallbacksController < Payr::BillsController
192
+ before_filter :authenticate_user!, except: [:ipn]
193
+ def pay
194
+ article = Pack.find params[:article_id]
195
+ @bill = Payr::Bill.new(buyer_id: current_user.id,
196
+ amount: article.price,
197
+ article_id: params[:article_id],
198
+ state: Payr::Bill::UNPROCESSED,
199
+ bill_reference: params[:bill_reference])
200
+ @payr = Payr::Client.new
201
+ if @bill.save
202
+ @paybox_params = @payr.get_paybox_params_from command_id: @bill.id,
203
+ buyer_email: current_recruiter.email,
204
+ total_price: article.price,
205
+ callbacks: {
206
+ paid: payr_bills_paid_url,
207
+ refused: payr_bills_refused_url,
208
+ cancelled: payr_bills_cancelled_url,
209
+ ipn: payr_bills_ipn_url
210
+ }
211
+ end
212
+ end
213
+ ```
214
+
215
+
181
216
  You can also override the views by creating the appropriate files :
182
217
  ```sh
183
218
  $ > ls app/views/paiement/callbacks
@@ -32,6 +32,7 @@ module Payr
32
32
  returned_hash.merge!(pbx_typepaiement: Payr.typepaiement,
33
33
  pbx_typepcarte: Payr.typecard) unless Payr.typepaiement.nil? || Payr.typecard.nil?
34
34
 
35
+ returned_hash.merge! params[:options] unless params[:options].blank?
35
36
  base_params = self.to_base_params(returned_hash)
36
37
 
37
38
  returned_hash.merge(pbx_hmac: self.generate_hmac(base_params))
@@ -1,3 +1,3 @@
1
1
  module Payr
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-26 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: -296478619546749009
141
+ hash: -3487819084611514497
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements:
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: -296478619546749009
150
+ hash: -3487819084611514497
151
151
  requirements: []
152
152
  rubyforge_project:
153
153
  rubygems_version: 1.8.24