afterpay 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 9ef17010e4937b9dcd9f33a9b6cb86018c5359bbc2114ec4cecf7f2496de5a4e
4
- data.tar.gz: 53371cb5b49385109d8cd97613af0820e77c4b0371304e8902a736861177db95
3
+ metadata.gz: 9c0546dacab8904577cf4598e6d6df51252708a23c2a1aaff7d60c1f89ae9fe4
4
+ data.tar.gz: d669f542377a1f1690375dc1721183eb96cc1fa911ccdb7534ca1f71ec416a01
5
5
  SHA512:
6
- metadata.gz: 8a0c9dbed40e6a784e3cedcbbca139ebd40d23e9efc65d7cb6634de25ec20588036ae5acf81d844c08aa3de65d9e930e8b90f4154bced90ae756545c3f4029a6
7
- data.tar.gz: 83e959ba698efe7f5fefbc777ee5df46a551234b846ad649e1450e4fe68fca1768de9f32f7a1906cf8cf4f836cb4a3f4eeaae5f8ee372326eb5c15bcbbb4b508
6
+ metadata.gz: e6ba4ea7c953533d03ffd0850d672be93076614d6b85c9d73beefe78a61688ce2bdedf064e300daad9d44126162090dbe69c86fd95e7fb5f473dab522d78a3e3
7
+ data.tar.gz: 9987f7c53e07053a090c221b68a4329c58944d0a0fc135b1b4012ad6a12593395a1d7326f9cd35e14e66a0b2cc45e8d9f257264122cbf86bf88a9cf65bcfa3cb
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Afterpay
4
+ module API
5
+ module Payment
6
+ class Reversal < Base
7
+ def initialize(params = {})
8
+ @token = params[:token]
9
+ end
10
+
11
+ private
12
+
13
+ attr_reader :token
14
+
15
+ def payload
16
+ {
17
+ action: :post,
18
+ endpoint: endpoint
19
+ }
20
+ end
21
+
22
+ def endpoint
23
+ "#{URL}/token:#{token}/reversal"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -43,6 +43,11 @@ module Afterpay
43
43
  # @return [String]
44
44
  # The estimated date when the order will be shipped, in YYYY-MM or YYYY-MM-DD format
45
45
  attr_accessor :estimated_shipment_date
46
+
47
+ # @attribute preorder
48
+ # @return boolean
49
+ # Should return false when the estimated_shipment_date is already passed otherwise true
50
+ attr_accessor :preorder
46
51
  end
47
52
  end
48
53
  end
@@ -37,9 +37,11 @@ module Afterpay
37
37
  end
38
38
 
39
39
  def faraday_options
40
- return {} unless ::Afterpay.user_agent
40
+ { "headers" => headers }
41
+ end
41
42
 
42
- { "headers" => { "User-Agent" => ::Afterpay.user_agent } }
43
+ def headers
44
+ { 'Content-Type' => 'application/json', 'User-Agent' => ::Afterpay.user_agent }.compact
43
45
  end
44
46
  end
45
47
  end
@@ -27,7 +27,7 @@ module Afterpay
27
27
  end
28
28
 
29
29
  def ok?
30
- (200..201).cover?(status.to_i)
30
+ (200..204).cover?(status.to_i)
31
31
  end
32
32
  end
33
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Afterpay
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/afterpay.rb CHANGED
@@ -13,6 +13,7 @@ require 'afterpay/api/payment/auth'
13
13
  require 'afterpay/api/payment/void'
14
14
  require 'afterpay/api/payment/deferred_capture'
15
15
  require 'afterpay/api/payment/find'
16
+ require 'afterpay/api/payment/reversal'
16
17
  require 'afterpay/components/base'
17
18
  require 'afterpay/components/consumer'
18
19
  require 'afterpay/components/contact'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afterpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Vygovsky
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-09-09 00:00:00.000000000 Z
14
+ date: 2021-10-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -246,6 +246,7 @@ files:
246
246
  - lib/afterpay/api/payment/deferred_capture.rb
247
247
  - lib/afterpay/api/payment/find.rb
248
248
  - lib/afterpay/api/payment/refund.rb
249
+ - lib/afterpay/api/payment/reversal.rb
249
250
  - lib/afterpay/api/payment/void.rb
250
251
  - lib/afterpay/callable.rb
251
252
  - lib/afterpay/components/base.rb