ya_kassa 0.1.6 → 0.1.7
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 +9 -8
- data/lib/ya_kassa/v3/concerns/validatable.rb +14 -4
- data/lib/ya_kassa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c1a705c1a1fdc2b7eedfad6e15b65458dd5339ae9efc7b187348ae399968795
|
|
4
|
+
data.tar.gz: d30b53aa5b8e06ce19982c370b0ff1e190b03440a80e7dba731421be27c00812
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 988203a9d5abb58f5d89b53a16f8cf7ff8886706e646cabbefbdd75b9062c7cbda6a772c8b3a8d4e78f29edf58c8ffcb23c96520110a79bdc03173fe4eff2701
|
|
7
|
+
data.tar.gz: b73066b8081342f1fb957f88d20e5606fe40aec91e70b43bea7421e3c20c4ba81cd5257f74222365940ca38c24bdefecadaedbf5fe32e31d837936d4e1a58d37
|
data/README.md
CHANGED
|
@@ -55,8 +55,6 @@ YaKassa::V3::PaymentStatusRequest.new('2534fac6-000f-5000-a000-105ab7c0ab90').cr
|
|
|
55
55
|
#### Payment capture
|
|
56
56
|
Works just for payments with `capture: false`
|
|
57
57
|
```ruby
|
|
58
|
-
idempotence_key = '123456'
|
|
59
|
-
|
|
60
58
|
capture_params = {
|
|
61
59
|
amount_value: 10.0,
|
|
62
60
|
payment_id: '2534fac6-000f-5000-a000-105ab7c0ab90'
|
|
@@ -65,10 +63,17 @@ YaKassa::V3::PaymentCaptureRequest.new(idempotence_key, capture_params).create
|
|
|
65
63
|
# => {"id"=>"253503ee-000f-5000-a000-1c5fb44eaf40", "status"=>"succeeded", "paid"=>true, "amount"=>{"value"=>"10.00", "currency"=>"RUB"}, "authorization_details"=>{"rrn"=>"123123272641", "auth_code"=>"21231"}, "captured_at"=>"2019-10-13T09:38:14.133Z", "created_at"=>"2019-10-13T09:37:58.019Z", "metadata"=>{}, "payment_method"=>{"type"=>"bank_card", "id"=>"253503ee-000f-5000-a000-1c5fb44eaf40", "saved"=>false, "card"=>{"first6"=>"555555", "last4"=>"4444", "expiry_month"=>"01", "expiry_year"=>"2022", "card_type"=>"MasterCard"}, "title"=>"Bank card *4444"}, "recipient"=>{"account_id"=>"45358", "gateway_id"=>"16234542"}, "refundable"=>true, "refunded_amount"=>{"value"=>"0.00", "currency"=>"RUB"}, "test"=>true}
|
|
66
64
|
```
|
|
67
65
|
|
|
66
|
+
#### Cancel
|
|
67
|
+
```
|
|
68
|
+
cancel_params = {
|
|
69
|
+
payment_id: "253503ee-000f-5000-a000-1c5fb44eaf40",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
YaKassa::V3::PaymentCancelRequest.new(idempotence_key, cancel_params).create
|
|
73
|
+
```
|
|
74
|
+
|
|
68
75
|
#### Refund
|
|
69
76
|
```ruby
|
|
70
|
-
idempotence_key = '123456'
|
|
71
|
-
|
|
72
77
|
refund_params = {
|
|
73
78
|
amount_value: 10.0,
|
|
74
79
|
payment_id: '2534fac6-000f-5000-a000-105ab7c0ab90'
|
|
@@ -79,8 +84,6 @@ YaKassa::V3::RefundRequest.new(idempotence_key, payment_params).create
|
|
|
79
84
|
|
|
80
85
|
#### Receipt
|
|
81
86
|
```ruby
|
|
82
|
-
idempotence_key = '123456'
|
|
83
|
-
|
|
84
87
|
receipt_params = {
|
|
85
88
|
full_name: 'Ivan Ivanov',
|
|
86
89
|
email: 'example@exaple.com',
|
|
@@ -96,8 +99,6 @@ YaKassa::V3::ReceiptRequest.new(idempotence_key, receipt_params).create
|
|
|
96
99
|
|
|
97
100
|
### Validation
|
|
98
101
|
```ruby
|
|
99
|
-
idempotence_key = '123456'
|
|
100
|
-
|
|
101
102
|
payment_params = {
|
|
102
103
|
payment_id: '123',
|
|
103
104
|
return_url: 'http://example.com'
|
|
@@ -11,13 +11,19 @@ module YaKassa
|
|
|
11
11
|
|
|
12
12
|
module ClassMethods
|
|
13
13
|
def validatable(name, type, params = {})
|
|
14
|
-
validators =
|
|
14
|
+
validators = get_validators
|
|
15
|
+
validators << { name: name, type: type, params: params }
|
|
16
|
+
class_variable_set(:@@validators, validators)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def get_validators
|
|
22
|
+
begin
|
|
15
23
|
class_variable_get(:@@validators)
|
|
16
24
|
rescue NameError
|
|
17
25
|
[]
|
|
18
26
|
end
|
|
19
|
-
validators << { name: name, type: type, params: params }
|
|
20
|
-
class_variable_set(:@@validators, validators)
|
|
21
27
|
end
|
|
22
28
|
end
|
|
23
29
|
|
|
@@ -51,7 +57,11 @@ module YaKassa
|
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def validators
|
|
54
|
-
|
|
60
|
+
begin
|
|
61
|
+
self.class.class_variable_get(:@@validators)
|
|
62
|
+
rescue NameError
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
55
65
|
end
|
|
56
66
|
|
|
57
67
|
def attr_value(attr_name)
|
data/lib/ya_kassa/version.rb
CHANGED