cloudpayments 0.3.0 → 0.4.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 +4 -4
- data/README.md +58 -0
- data/lib/cloudpayments/client/request/receipts/get.rb +19 -0
- data/lib/cloudpayments/connection.rb +3 -3
- data/lib/cloudpayments.rb +1 -0
- metadata +23 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 349f89dbce1afcabbca53d53b85ecde1c3bede1b5cc6612fa25535e6c8798740
|
|
4
|
+
data.tar.gz: '091e48f95944de49a2c2b799e9b7f050bfb58450d1a63f6d28a85b3673ec2f76'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 110a916c702106ca175b24323fe5b6c385d319215dc0aa9b0136864494c5b17cf7a3aad3d4d729f8456e548b18bb41f9553f707418dd91d05285f5c7d197edfd
|
|
7
|
+
data.tar.gz: e0d212362982353f35f5d180c7d88c9e60feceb8d1604117db2291d5617086cdbb26918286ce5eb64882a394bcba2b0bf8f74043b23a4b967ac7402fd78c6828
|
data/README.md
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Cloudpayments
|
|
2
|
+
|
|
3
|
+
A Ruby wrapper for cloudpayments
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```rb
|
|
8
|
+
# Gemfile
|
|
9
|
+
gem "cloudpayments", "~> 0.4.0"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$ bundle install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage:
|
|
17
|
+
|
|
18
|
+
```rb
|
|
19
|
+
# config/initializers/cloudpayments.rb
|
|
20
|
+
require "cloudpayments"
|
|
21
|
+
|
|
22
|
+
Cloudpayments.configure do |config|
|
|
23
|
+
config.login = "login"
|
|
24
|
+
config.password = "password"
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```rb
|
|
29
|
+
request_params = {
|
|
30
|
+
"Inn" => inn,
|
|
31
|
+
"Type" => format_receipt_type,
|
|
32
|
+
"CustomerReceipt" => {
|
|
33
|
+
"Items" => [{
|
|
34
|
+
"Label" => label,
|
|
35
|
+
"Quantity" => 1,
|
|
36
|
+
"Amount" => amount,
|
|
37
|
+
"Price" => amount,
|
|
38
|
+
"Vat" => "",
|
|
39
|
+
"Method" => 1,
|
|
40
|
+
"Object" => 10
|
|
41
|
+
}],
|
|
42
|
+
"calculationPlace" => calculation_place,
|
|
43
|
+
"TaxationSystem" => 0,
|
|
44
|
+
"Email" => email,
|
|
45
|
+
"Amounts" => {
|
|
46
|
+
"Electronic" => amount
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
response = Cloudpayments::Client::Request::Receipts::Create.call(request_params)
|
|
52
|
+
response.success?
|
|
53
|
+
|
|
54
|
+
receipt_ofd_id = response.body.model_id
|
|
55
|
+
|
|
56
|
+
response = Cloudpayments::Client::Request::Receipts::GetStatus.call(receipt_ofd_id)
|
|
57
|
+
status = response.body.model
|
|
58
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Cloudpayments
|
|
2
|
+
module Client
|
|
3
|
+
module Request
|
|
4
|
+
module Receipts
|
|
5
|
+
class Get < Cloudpayments::Client::Request::Base
|
|
6
|
+
attr_reader :id
|
|
7
|
+
|
|
8
|
+
def initialize(id)
|
|
9
|
+
@id = id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
post("kkt/receipt/get", { Id: id })
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -15,9 +15,9 @@ module Cloudpayments
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def connection
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
Faraday.new(config.base_url) do |conn|
|
|
19
|
+
conn.request :authorization, :basic, config.login, config.password
|
|
20
|
+
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def config
|
data/lib/cloudpayments.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative "cloudpayments/client/response/body"
|
|
|
7
7
|
require_relative "cloudpayments/client/request/base"
|
|
8
8
|
require_relative "cloudpayments/client/request/receipts/create"
|
|
9
9
|
require_relative "cloudpayments/client/request/receipts/get_status"
|
|
10
|
+
require_relative "cloudpayments/client/request/receipts/get"
|
|
10
11
|
|
|
11
12
|
module Cloudpayments
|
|
12
13
|
class << self
|
metadata
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudpayments
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexey Spiridonov
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2019-11-19 00:00:00.000000000 Z
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: faraday
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.7.10
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 2.7.10
|
|
27
|
+
description:
|
|
14
28
|
email: alex9spiridonov@gmail.com
|
|
15
29
|
executables: []
|
|
16
30
|
extensions: []
|
|
@@ -20,16 +34,17 @@ files:
|
|
|
20
34
|
- lib/cloudpayments.rb
|
|
21
35
|
- lib/cloudpayments/client/request/base.rb
|
|
22
36
|
- lib/cloudpayments/client/request/receipts/create.rb
|
|
37
|
+
- lib/cloudpayments/client/request/receipts/get.rb
|
|
23
38
|
- lib/cloudpayments/client/request/receipts/get_status.rb
|
|
24
39
|
- lib/cloudpayments/client/response/base.rb
|
|
25
40
|
- lib/cloudpayments/client/response/body.rb
|
|
26
41
|
- lib/cloudpayments/configuration.rb
|
|
27
42
|
- lib/cloudpayments/connection.rb
|
|
28
|
-
homepage: https://
|
|
43
|
+
homepage: https://github.com/alex9spiridonov/cloudpayments
|
|
29
44
|
licenses:
|
|
30
45
|
- MIT
|
|
31
46
|
metadata: {}
|
|
32
|
-
post_install_message:
|
|
47
|
+
post_install_message:
|
|
33
48
|
rdoc_options: []
|
|
34
49
|
require_paths:
|
|
35
50
|
- lib
|
|
@@ -44,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
44
59
|
- !ruby/object:Gem::Version
|
|
45
60
|
version: '0'
|
|
46
61
|
requirements: []
|
|
47
|
-
rubygems_version: 3.
|
|
48
|
-
signing_key:
|
|
62
|
+
rubygems_version: 3.2.22
|
|
63
|
+
signing_key:
|
|
49
64
|
specification_version: 4
|
|
50
65
|
summary: Сloudpayments API wrapper
|
|
51
66
|
test_files: []
|