tinkoff 0.1.1 → 0.1.2

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: a4e41a7cb90dde1c23ea9e3b479421a0d0fc1770
4
- data.tar.gz: e7b4a8cf46bd057ba0ced657bdc0ee96bad5c0c4
3
+ metadata.gz: 9ec4ebb3ad6cd6a6205897175eaa607697ebf21f
4
+ data.tar.gz: 2e06cb681b00628a74a41177ed8f865a1de29e0f
5
5
  SHA512:
6
- metadata.gz: 9815634ecca48290a6490bf03d1b21d73e982a9d0072509ad5004dcc173d5979cdb1a1e52b4755b6363e88763e52870574060c4f44dc5647c368472d9c0d9b12
7
- data.tar.gz: 04267e91dcdb309e04a1a05e1d02f1c04752723a17afad8eb62e49fcb6986d7225dc2de97c07b2ecd06ea32171a1d52b325956a3f31db9de4b6268c5107c1aa4
6
+ metadata.gz: d717451fb4002a0af715eca07391d9c849e9e05b2763704ff2eabd31573cbc50ada59c2623fa26812b1d614ee66cae3e40c8a615ee82fdc778c8d8c3640b3a48
7
+ data.tar.gz: 86d4c767dacc6a0cc1d8d93dd83d22d8b3a4571e9b9167ad07f242bfcc3e3223b33aa2fa14fc887e3ef65245ae6fb36862678f544ebb287d371147dd2366e96d
data/README.md CHANGED
@@ -58,6 +58,14 @@ Tinkoff::Client.state(1)
58
58
 
59
59
  You can view all available options in the [official documentation](https://oplata.tinkoff.ru/documentation/?section=aboutMet).
60
60
 
61
+ A notification will be sent to if you provided the URL. You should use it to update the status of your payment / order.
62
+
63
+ ```ruby
64
+ notification = Tinkoff::Notification.new(params)
65
+ order = Order.find(notification.order_id)
66
+ order.update_attribute(:paid, true)
67
+ ```
68
+
61
69
  ## Development
62
70
 
63
71
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`.
@@ -1,5 +1,5 @@
1
1
  module Tinkoff
2
- class Response
2
+ class Notification
3
3
  attr_reader :success, :error_code, :message, :details, :amount,
4
4
  :merchant_email, :merchant_name, :order_id, :payment_id, :tran_date
5
5
 
@@ -15,5 +15,13 @@ module Tinkoff
15
15
  @payment_id = params['PaymentId']
16
16
  @tran_date = params['TranDate']
17
17
  end
18
+
19
+ def failure?
20
+ !@success
21
+ end
22
+
23
+ def success?
24
+ !failure?
25
+ end
18
26
  end
19
27
  end
@@ -1,3 +1,3 @@
1
1
  module Tinkoff
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/tinkoff.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'httparty'
2
2
  require 'active_support'
3
3
  require 'active_support/core_ext/hash'
4
+
4
5
  require 'tinkoff/request'
5
6
  require 'tinkoff/client'
6
7
  require 'tinkoff/payment'
8
+ require 'tinkoff/notification'
9
+
7
10
  require 'tinkoff/version'
8
11
 
9
12
  module Tinkoff
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Kim
@@ -98,9 +98,9 @@ files:
98
98
  - bin/setup
99
99
  - lib/tinkoff.rb
100
100
  - lib/tinkoff/client.rb
101
+ - lib/tinkoff/notification.rb
101
102
  - lib/tinkoff/payment.rb
102
103
  - lib/tinkoff/request.rb
103
- - lib/tinkoff/response.rb
104
104
  - lib/tinkoff/version.rb
105
105
  - tinkoff.gemspec
106
106
  homepage: https://github.com/dankimio/tinkoff