payture-cheques 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a1650598deeda99267fcb89839eff8a4fed1cd0
4
- data.tar.gz: 3b49b35dc96a4550a5d76b8d8e03154651f1324c
3
+ metadata.gz: 2e2140551b23ffb46f17098703c5fc4428994c5d
4
+ data.tar.gz: 1d338224780734d0dc0b0c47c97e722019cebf10
5
5
  SHA512:
6
- metadata.gz: af0a1b36a2bfc8fe1f6b840e1ea63f7fdb47fb9b6c3448a88cb02a08d8ca93515bd156d686e0df26e918ae173ccecddbc9fe2a7a86f0b99c878a8d894470a353
7
- data.tar.gz: bac86af0856cce8def1f34ff8e1e7b1e634753b9fd1e1b065f5b52794073c9adc1d4cbc9aa79da43249d4dd39c3599c5977912f6bc6b657e7fc96188f929f5ff
6
+ metadata.gz: 6e9b5d024fac7fb6f7ae65725a8eb825db4fdd60b6d8c1c5d72923a81fdc3436763002811a492343139f4fdcac27f17bf671c8a8f88dc793c62c76645a2bd3aa
7
+ data.tar.gz: d2787db6314619181e8c65f913c037c4278d98c04adeaa27127357dae3b50bbd0b811fe98e9da6b6161c497c4ef695dd0b23f12dc6f7ab00cb5aca269bef5519
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Payture::Cheques
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/payture/cheques`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Обертка к API отправки чеков, предоставляемому компанией Payture.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,51 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ Создание клиента:
24
+ ```ruby
25
+ client = Payture::Cheques.client(
26
+ host: 'sandbox3.payture.com',
27
+ merchant_id: 'MyMerchantId',
28
+ password: 'MyPassword',
29
+ )
30
+ ```
31
+
32
+ отправка чека:
33
+ ```ruby
34
+
35
+ cheque = JSON.parse('{
36
+ "Message":"test",
37
+ "Type":1,
38
+ "Positions":[
39
+ {
40
+ "Quantity":1.000,
41
+ "Price":111.45,
42
+ "Tax":1,
43
+ "Text":"Булка"
44
+ }
45
+ ],
46
+ "CheckClose":{
47
+ "Payments":[
48
+ {
49
+ "Type":1,
50
+ "Amount":123.45
51
+ }
52
+ ],
53
+ "TaxationSystem":1
54
+ },
55
+ "CustomerContact":"nikita.popovsky@payture.com"
56
+ }
57
+ ')
58
+
59
+ response = client.create(
60
+ cheque_id: 'chequeid-1234',
61
+ inn: 7710140679,
62
+ content: cheque
63
+ )
64
+
65
+ response.success
66
+ ```
67
+
26
68
 
27
69
  ## Development
28
70
 
@@ -38,4 +80,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
80
  ## License
39
81
 
40
82
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -57,7 +57,7 @@ module Payture::Cheques
57
57
  raise Error, "#{e.class}: #{e.message}"
58
58
  end
59
59
 
60
- config.logger.debug(pp(body)) if config.logger
60
+ config.logger.debug(body) if config.logger
61
61
  response_class.new(body)
62
62
  end
63
63
 
@@ -15,12 +15,16 @@ module Payture::Cheques
15
15
  end
16
16
 
17
17
  def success?
18
- body['Success'] == true
18
+ body['Success'] == true && cheques.all?(&:success?)
19
19
  end
20
20
 
21
21
  def error_code
22
22
  body['ErrCode'] || ERROR_STATES[body['Status']]
23
23
  end
24
+
25
+ def status
26
+ body['Status']
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -1,5 +1,5 @@
1
1
  module Payture
2
2
  module Cheques
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -30,5 +30,4 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'simplecov', '~> 0.14'
31
31
  spec.add_development_dependency 'vcr', '~> 2.9'
32
32
  spec.add_development_dependency 'webmock', '~> 3.0'
33
- spec.add_development_dependency 'pp'
34
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payture-cheques
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Sviridov
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
- - !ruby/object:Gem::Dependency
140
- name: pp
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  description:
154
140
  email:
155
141
  - alexander.sviridov@gmail.com