wayforpay 0.1.4 → 0.1.5

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
- SHA256:
3
- metadata.gz: 2adbbe1ca90b1aa25771c2ee305f84f3112a6891c79d279eb268571c63fdd61e
4
- data.tar.gz: 34ed34e8ad3fea99bfb2a8845d81d0017522fd524189828daa8b031a3e29d5ed
2
+ SHA1:
3
+ metadata.gz: 79b84cca8666a23a081ec417499bf3bd404fd171
4
+ data.tar.gz: 792553879e96ceb677d8fc8290456c941e597d30
5
5
  SHA512:
6
- metadata.gz: f3d15bc943581f3cc9298fa8f7b2ba53e9e06b52ae73531ea2f526f93a2ae0340aa1377ba133c0808b49354faf5a45215bbdcc6222ba811697c87985fdae4617
7
- data.tar.gz: ca2abee893f88cb941e5a0f0d215d230adb27586def6da7ee4e1934ceec291e9452426285e92fe2549dc4baab870d47b4d4e529c823c8dc17ffb31dcfb781064
6
+ metadata.gz: c3954623a31b41cc4c977f354de8e39f052240368d9730c54c33f6e9e2936cf11affe96b28f9c616aa27a9a095b30aac699b84f38f2ecdba1f80e9de66dd9451
7
+ data.tar.gz: 32a0429b7572a96e93a832d382895d4bb6429a63763c6046e4d472dd750c3f60da26ba98deeebb55e832fa4c7552774e3f7699e3836c25f8d0cd06c716d9dd6f
data/README.md CHANGED
@@ -129,6 +129,48 @@
129
129
  "currency": "UAH"
130
130
  }
131
131
  ```
132
+
133
+ ### Creating invoices to the clients for payment for goods/services. ([Invoice](https://wiki.wayforpay.com/display/WADE/Invoice))
134
+
135
+ ```ruby
136
+ Wayforpay::Payments.create_invoice(parameters)
137
+ ```
138
+
139
+ Required parameters:
140
+
141
+ | Parameter | Description |
142
+ | ----------------- | ------------------------------------------------------ |
143
+ | orderReference | Unique number of the order in merchant’s system |
144
+ | orderDate | Date of order placing |
145
+ | amount | Amount of refund |
146
+ | currency | Currency of order: UAH (USD, EUR) |
147
+ | productName[] | Array with the names of ordered products |
148
+ | productPrice[] | Array with the prices per product unit |
149
+ | productCount[] | Array with the quantity of ordered goods by each item |
150
+
151
+ An example of request:
152
+
153
+ ```ruby
154
+ {
155
+ "orderReference": "myOrder1",
156
+ "orderDate": 1421412898,
157
+ "amount": 0.13,
158
+ "currency": "UAH",
159
+ "productName": ["Samsung WB1100F","Samsung Galaxy Tab 4 7.0 8GB 3G Black"],
160
+ "productPrice": [21.1,30.99],
161
+ "productCount": [1,2]
162
+ }
163
+ ```
164
+
165
+ An example of response:
166
+
167
+ ```ruby
168
+ {
169
+ "reason": "1100",
170
+ "reasonCode": "Ok",
171
+ "invoiceUrl": "https://secure.wayforpay.com/invoice/i99edb6518fb5"
172
+ }
173
+ ```
132
174
  ## Contributing
133
175
 
134
176
  1. Fork it
@@ -8,6 +8,7 @@ module Wayforpay
8
8
  REFUND_ENCRYPT_FIELDS = %i[merchantAccount orderReference amount currency].freeze
9
9
  SETTLE_ENCRYPT_FIELDS = %i[merchantAccount orderReference amount currency].freeze
10
10
  VERIFY_ENCRYPT_FIELDS = %i[merchantAccount merchantDomainName orderReference amount currency].freeze
11
+ CREATE_INVOICE_ENCRYPT_FIELDS = %i[merchantAccount merchantDomainName orderReference orderDate amount currency productName productCount productPrice].freeze
11
12
 
12
13
  HOLD_ATTRS = {
13
14
  transactionType: 'CHARGE',
@@ -32,6 +33,14 @@ module Wayforpay
32
33
  apiVersion: 1
33
34
  }.freeze
34
35
 
36
+ CREATE_INVOICE_ATTRS = {
37
+ transactionType: 'CREATE_INVOICE',
38
+ authorizationType: 'SimpleSignature',
39
+ merchantTransactionType: 'AUTH',
40
+ merchantTransactionSecureType: 'NON3DS',
41
+ apiVersion: 1
42
+ }.freeze
43
+
35
44
  def self.hold_params
36
45
  HOLD_ATTRS.merge(
37
46
  merchantAccount: Wayforpay.merchant_account,
@@ -53,5 +62,12 @@ module Wayforpay
53
62
  merchantDomainName: Wayforpay.merchant_domain_name
54
63
  )
55
64
  end
65
+
66
+ def self.create_invoice_params
67
+ CREATE_INVOICE_ATTRS.merge(
68
+ merchantAccount: Wayforpay.merchant_account,
69
+ merchantDomainName: Wayforpay.merchant_domain_name
70
+ )
71
+ end
56
72
  end
57
73
  end
@@ -25,5 +25,12 @@ module Wayforpay
25
25
  request_params = Constants.verify_params.merge(attrs)
26
26
  Wayforpay::Request.(Constants::VERIFY_ENCRYPT_FIELDS, request_params)
27
27
  end
28
+
29
+ # required attrs: orderReference, amount, currency, orderDate,
30
+ # productName[], productPrice[], productCount[]
31
+ def self.create_invoice(attrs = {})
32
+ request_params = Constants.create_invoice_params.merge(attrs)
33
+ Wayforpay::Request.(Constants::CREATE_INVOICE_ENCRYPT_FIELDS, request_params)
34
+ end
28
35
  end
29
36
  end
@@ -1,3 +1,3 @@
1
1
  module Wayforpay
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wayforpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhii Savenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-01-08 00:00:00.000000000 Z
12
+ date: 2020-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.7.7
116
+ rubygems_version: 2.5.2.3
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Wayforpay API