rubykassa 0.2.4 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6b7cea85eadf162de776c52022447cb0e016c87
4
- data.tar.gz: d3c9b7245e873830712757bbc3a0cf13c2b8136d
3
+ metadata.gz: 9853afe8fbe86ab00ff98d3dce3400f53ee12174
4
+ data.tar.gz: 749c93e75d2f6aaf75e8b53d297aebe24cb1980c
5
5
  SHA512:
6
- metadata.gz: 7981dafb420f6cd6b6f5b775278a4c84e7a12172674698a2ec85ef05f14f853416c29617fb2b54222e35271bb75840f173eacded542f5ae8e856c106e8d8823e
7
- data.tar.gz: 9257a3dab1d9471b21b6360a3335ca830174ef5dcc68fc79b50c6bcc22e2211515285d87cd6676cea940593960c2dae7d1e0fe4f5f09e6e523cd6d1ba62e9530
6
+ metadata.gz: 1e54ae545570baecfab863f0044f120fe701b5eac77c516545e07d4918095c63703fdc9594fdad9ef1d2ea0161c4b23b57208421a841851b0a09deae0ea17d96
7
+ data.tar.gz: 6890ca424c90fbe83e3dccedb894c2830a4d3ca2b54af7607691ad5bac78a4ab1926272da1bdce161ea5dbce73368bc31828f1ace981e5ec7cd791f4382f6935
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.5
2
+
3
+ * Fix bug with passing custom params
4
+
1
5
  ## 0.2.4
2
6
 
3
7
  * Fix naming issue with pay helper: rename 'link_to_pay' to 'pay_url'.
@@ -14,4 +18,4 @@
14
18
 
15
19
  * Fix description param name from `'InvDesc'` to `'Desc'`. Closes [#2][]
16
20
 
17
- [#2]: https://github.com/ZeroOneStudio/rubykassa/issues/2
21
+ [#2]: https://github.com/ZeroOneStudio/rubykassa/issues/2
data/README.md CHANGED
@@ -48,6 +48,10 @@ Additionally you may want to pass extra options. There is no problem:
48
48
 
49
49
  <%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru } %>
50
50
 
51
+ Or if you would like to pass some custom params use `custom` key in options hash:
52
+
53
+ <%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru, custom: { param1: "value1", param2: "value2" }} %>
54
+
51
55
  If you need to implement Robokassa's XML interface functionality you have to the following:
52
56
 
53
57
  xml_interface = Rubykassa::XmlInterface.new do
@@ -22,9 +22,9 @@ class RobokassaController < ApplicationController
22
22
  render text: "fail"
23
23
  end
24
24
 
25
- private
25
+ private
26
26
 
27
- def create_notification
28
- @notification = Rubykassa::Notification.new params
29
- end
27
+ def create_notification
28
+ @notification = Rubykassa::Notification.new params
29
+ end
30
30
  end
data/config/routes.rb CHANGED
@@ -3,7 +3,7 @@ Rails.application.routes.draw do
3
3
  if Rubykassa::Client.configuration
4
4
  scope '/robokassa' do
5
5
  %w(paid success fail).map do |route|
6
- method(Rubykassa.http_method).call "/#{route}" => "robokassa##{route}", as: "robokassa_#{route}".to_sym
6
+ method(Rubykassa.http_method).call "/#{route}" => "robokassa##{route}", as: "robokassa_#{route}"
7
7
  end
8
8
  end
9
9
  end
@@ -2,9 +2,10 @@
2
2
  module Rubykassa
3
3
  module ActionViewExtension
4
4
  def pay_url phrase, invoice_id, total, options = {}
5
- phrase ||= "Pay"
6
5
  total, invoice_id = total.to_s, invoice_id.to_s
7
- link_to phrase, Rubykassa.pay_url(invoice_id, total, params, options)
6
+ extra_params = options.except(:custom)
7
+ custom_params = options[:custom] ||= {}
8
+ link_to phrase, Rubykassa.pay_url(invoice_id, total, custom_params, extra_params)
8
9
  end
9
10
  end
10
11
  end
@@ -34,8 +34,12 @@ module Rubykassa
34
34
  options = options.slice(:currency, :description, :email, :culture)
35
35
 
36
36
  "#{base_url}?" + initial_options.merge(options).map do |key, value|
37
- "#{PARAMS_CONFORMITY[key.to_sym]}=#{value}" unless key =~ /^shp/
38
- end.compact!.join("&")
37
+ if key =~ /^shp/
38
+ "#{key}=#{value}"
39
+ else
40
+ "#{PARAMS_CONFORMITY[key]}=#{value}"
41
+ end
42
+ end.compact.join("&")
39
43
  end
40
44
 
41
45
  def initial_options
@@ -47,4 +51,4 @@ module Rubykassa
47
51
  }.merge(Hash[@params.sort.map {|param_name| ["shp#{param_name[0]}".to_sym, param_name[1]]}])
48
52
  end
49
53
  end
50
- end
54
+ end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Rubykassa
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
@@ -6,7 +6,7 @@ describe Rubykassa::PaymentInterface do
6
6
  @payment_interface = Rubykassa::PaymentInterface.new do
7
7
  self.invoice_id = 12
8
8
  self.total = 1200
9
- self.params = {foo: "bar"}
9
+ self.params = { foo: "bar" }
10
10
  end
11
11
 
12
12
  Rubykassa.configure do |config|
@@ -18,11 +18,11 @@ describe Rubykassa::PaymentInterface do
18
18
  end
19
19
 
20
20
  it "should return correct pay_url" do
21
- @payment_interface.pay_url.should == "http://test.robokassa.ru/Index.aspx?MrchLogin=your_login&OutSum=1200&InvId=12&SignatureValue=96c0bbd4fc8f365455e949b1fbf5e3f4"
21
+ @payment_interface.pay_url.should == "http://test.robokassa.ru/Index.aspx?MrchLogin=your_login&OutSum=1200&InvId=12&SignatureValue=96c0bbd4fc8f365455e949b1fbf5e3f4&shpfoo=bar"
22
22
  end
23
23
 
24
24
  it "should return correct pay_url when additional options passed" do
25
- @payment_interface.pay_url({description: "desc", culture: "ru", email: "foo@bar.com", currency: ""}).should == "http://test.robokassa.ru/Index.aspx?MrchLogin=your_login&OutSum=1200&InvId=12&SignatureValue=96c0bbd4fc8f365455e949b1fbf5e3f4&IncCurrLabel=&Desc=desc&Email=foo@bar.com&Culture=ru"
25
+ @payment_interface.pay_url({description: "desc", culture: "ru", email: "foo@bar.com", currency: ""}).should == "http://test.robokassa.ru/Index.aspx?MrchLogin=your_login&OutSum=1200&InvId=12&SignatureValue=96c0bbd4fc8f365455e949b1fbf5e3f4&shpfoo=bar&IncCurrLabel=&Desc=desc&Email=foo@bar.com&Culture=ru"
26
26
  end
27
27
 
28
28
  it "should return correct initial_options" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubykassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Kishenin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails