mandarin_pay 1.0.0 → 1.1.0

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: c6aa66899bf036fe36b6d408f2a7f123ed8036d6
4
- data.tar.gz: 13e097421df68143d2c77129e9d697835104dd8e
3
+ metadata.gz: 621f5679074f8bd32baac048b534b33e7ad0945f
4
+ data.tar.gz: 8efb0d1d68f75be18023fa6612acd1d7d48642e0
5
5
  SHA512:
6
- metadata.gz: 782885f15b6a4286a390003e57910a855d00d6250f9d168abd44199395fb29d4269d0f6bb5d788eb57d68f49bf0611b3d36a7c5400f0a505fdabbea6fdf0aa6b
7
- data.tar.gz: db5859cb85061582a8dfeba7855ce168dd20c34bbde686c5a45286db883f3ea60668f984d325064f46500bf31c86e3b9bb8e065946a3bf693db5a2549fadb638
6
+ metadata.gz: 06e57bc17a355b0b0e229273e11efafe326a01f13840d9dc2e9da55f0c39965b878904c4772a7c2360a3ad24aaffe484a66532cfc7332c6228403ce74a07e09c
7
+ data.tar.gz: 74ae510f75c4edc31afb896a55a7d046466d0111a55a6d3f4b55ec981dd90470040635b711847c9089d08b28b4007d0141c1f678e0e9c556e45cd7a61bb355e0
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem "rails", "~> 4.2.0"
4
4
 
5
5
  group :test do
6
6
  gem "coveralls", require: false
7
+ gem "pry", require: false
7
8
  end
8
9
 
9
10
  gemspec
data/README.md CHANGED
@@ -4,7 +4,7 @@ by [Drakmail][]
4
4
 
5
5
  [Drakmail]: http://drakmail.ru
6
6
 
7
- Ruby wrapper for [Mandarin Pay API][]. Make Mandarin Pay to work with your Rails project without pain. MandarinPay took the best from [rubykassa gem][] and [Active Merchant Robokassa integration] but easier to use and setup.
7
+ Ruby wrapper for [MandarinPay API][]. Make Mandarin Pay to work with your Rails project without pain. MandarinPay took the best from [rubykassa gem][] and [Active Merchant Robokassa integration] but easier to use and setup.
8
8
 
9
9
  [MandarinPay API]: http://mandarin_pay.com/sites/default/files/protokol_integracii_v0.5.5_0.pdf
10
10
  [rubykassa gem]: https://github.com/ZeroOneStudio/rubykassa
@@ -1,8 +1,9 @@
1
1
  class MandarinPayController < ApplicationController
2
2
  before_action :create_notification
3
+ skip_before_action :verify_authenticity_token
3
4
 
4
5
  def paid
5
- if @notification.valid_result_signature?
6
+ if @notification.valid_transaction_signature?
6
7
  instance_exec @notification, &MandarinPay.result_callback
7
8
  else
8
9
  instance_exec @notification, &MandarinPay.fail_callback
@@ -10,11 +11,7 @@ class MandarinPayController < ApplicationController
10
11
  end
11
12
 
12
13
  def success
13
- if @notification.valid_success_signature?
14
- instance_exec @notification, &MandarinPay.success_callback
15
- else
16
- instance_exec @notification, &MandarinPay.fail_callback
17
- end
14
+ instance_exec @notification, &MandarinPay.success_callback
18
15
  end
19
16
 
20
17
  def fail
data/bin/bundler CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/cdiff CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/coderay ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'coderay' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("coderay", "coderay")
data/bin/colortab CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/coveralls CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/decolor CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/erubis CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/htmldiff CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/ldiff CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/nokogiri CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/pry ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'pry' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("pry", "pry")
data/bin/rackup CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/rails CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/rake CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/rspec CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/sprockets CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/term_display CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/term_mandel CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/thor CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
@@ -2,7 +2,7 @@ module MandarinPay
2
2
  module SignatureGenerator
3
3
  def generate_signature_for(kind, extra_params = {})
4
4
  unless [:card_binding, :payment, :transaction].include? kind
5
- raise ArgumentError, "Available kinds are only :payment, :result or :success"
5
+ raise ArgumentError, "Available kinds are only :payment, :card_binding or :transaction"
6
6
  end
7
7
  Digest::SHA256.hexdigest(params_string(kind, extra_params))
8
8
  end
@@ -10,11 +10,9 @@ module MandarinPay
10
10
  def params_string(kind, extra_params)
11
11
  case kind
12
12
  when :payment
13
- Hash[conformity_params(extra_params).sort].values.join("-") + "-" + MandarinPay.sharedsec
14
- when :card_binding
15
- Hash[conformity_params(extra_params).sort].values.join("-") + "-" + MandarinPay.sharedsec
16
- when :transaction
17
- Hash[conformity_params(extra_params).sort].values.join("-") + "-" + MandarinPay.sharedsec
13
+ Hash[conformity_params(extra_params).sort_by { |(key, _v)| key }].values.join("-") + "-" + MandarinPay.sharedsec
14
+ else
15
+ Hash[@params.except("sign").sort_by { |(key, _v)| key }].values.join("-") + "-" + MandarinPay.sharedsec
18
16
  end
19
17
  end
20
18
 
@@ -1,3 +1,3 @@
1
1
  module MandarinPay
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0".freeze
3
3
  end
@@ -11,7 +11,7 @@ describe MandarinPay::Notification do
11
11
  data = {
12
12
  "orderId" => "12",
13
13
  "price" => "1200",
14
- "sign" => "dd00e1d8e77ae1b62e5c05a9023ebda218d94955202ad323563046fc10f19a98"
14
+ "sign" => "e3daf8ea5021343c455853a27901a2355a5db5d3c29b9c3f0ce9869a040ce593"
15
15
  }
16
16
  notification = MandarinPay::Notification.new(data)
17
17
  expect(notification.valid_card_binding_signature?).to eq true
@@ -31,7 +31,7 @@ describe MandarinPay::Notification do
31
31
  data = {
32
32
  "orderId" => "12",
33
33
  "price" => "1200",
34
- "sign" => "dd00e1d8e77ae1b62e5c05a9023ebda218d94955202ad323563046fc10f19a98"
34
+ "sign" => "e3daf8ea5021343c455853a27901a2355a5db5d3c29b9c3f0ce9869a040ce593"
35
35
  }
36
36
  notification = MandarinPay::Notification.new(data)
37
37
  expect(notification.valid_transaction_signature?).to eq true
@@ -46,6 +46,6 @@ describe MandarinPay::Notification do
46
46
  expect do
47
47
  notification = MandarinPay::Notification.new({})
48
48
  notification.generate_signature_for(:bullshit)
49
- end.to raise_error(ArgumentError, "Available kinds are only :payment, :result or :success")
49
+ end.to raise_error(ArgumentError, "Available kinds are only :payment, :card_binding or :transaction")
50
50
  end
51
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandarin_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Maslov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-08 00:00:00.000000000 Z
11
+ date: 2016-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -84,6 +84,7 @@ files:
84
84
  - app/controllers/mandarin_pay_controller.rb
85
85
  - bin/bundler
86
86
  - bin/cdiff
87
+ - bin/coderay
87
88
  - bin/colortab
88
89
  - bin/coveralls
89
90
  - bin/decolor
@@ -91,6 +92,7 @@ files:
91
92
  - bin/htmldiff
92
93
  - bin/ldiff
93
94
  - bin/nokogiri
95
+ - bin/pry
94
96
  - bin/rackup
95
97
  - bin/rails
96
98
  - bin/rake