smartpay 0.9.0 → 0.10.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: 00410e1e92eac18110d098a09a4750d33d8a6f1b06c996b2cfaab3d8894fdfd6
4
- data.tar.gz: b8efe4cb9dd735fb8b34f21a8cff1b21c19dd87994d74a2baf5b27960040e7f0
3
+ metadata.gz: 256e620407cf05ccfef77cd18d2d56624538e195e9b4117069ed393e06df1856
4
+ data.tar.gz: bae50f58eea501a61be27087be3cff2c9d9da184cdcd7feb27e5167fbe721763
5
5
  SHA512:
6
- metadata.gz: 19fce14ce1eb29e8513d9b1f7c7594a6ed822f1b9ba5f5cc7b69c657458d79af3e54ee3413182b550e91426e064b3aa683d4d0de4f47bab9f3911ff8c2accc9f
7
- data.tar.gz: 25123f86a91d9d6053e66798d5db35594c433383ec5d76728981d500e241e8b95169e3d4907305a4e1bc1fb360b3403bc2b29cc0e560e1468669816c2a6cf0fc
6
+ metadata.gz: 8320901658f0769df62e5dd8965899188f1ba7ed196d66e3b018b414e497ae99aa6312aacd310782e410b1d36ef7280f2a74f64ffaedae52d3c808c20a34ba68
7
+ data.tar.gz: 05e91447cc6485a2e654244cdbd58ef24e20fb5d4fc5cb30f5396eaebd2c738216c733acaff85d130205047126ffed58f12056974400d9e1e8af507afe717c2f
data/lib/smartpay/api.rb CHANGED
@@ -17,17 +17,25 @@ module Smartpay
17
17
  )
18
18
  end
19
19
 
20
+ def get_checkout_session(id, expand: "")
21
+ Responses::Base.new(Client.get("/checkout-sessions/%s" % id, params: { expand: expand }))
22
+ end
23
+
24
+ def get_checkout_sessions(page_token: nil, max_results: nil, expand: "")
25
+ Responses::Base.new(Client.get("/checkout-sessions", params: { pageToken: page_token, maxResults: max_results, expand: expand }))
26
+ end
27
+
20
28
  def create_order(payload, idempotency_key: nil)
21
29
  Responses::Base.new(
22
- Client.post("/orders", params:{}, payload: Requests::Order.new(payload).as_hash, idempotency_key: idempotency_key)
30
+ Client.post("/orders", params: {}, payload: Requests::Order.new(payload).as_hash, idempotency_key: idempotency_key)
23
31
  )
24
32
  end
25
33
 
26
- def get_orders(page_token: nil, max_results: nil, expand: '' )
34
+ def get_orders(page_token: nil, max_results: nil, expand: "")
27
35
  Responses::Base.new(Client.get("/orders", params: { pageToken: page_token, maxResults: max_results, expand: expand }))
28
36
  end
29
37
 
30
- def get_order(id, expand: '' )
38
+ def get_order(id, expand: "")
31
39
  Responses::Base.new(Client.get("/orders/%s" % id, params: { expand: expand }))
32
40
  end
33
41
 
@@ -39,7 +47,7 @@ module Smartpay
39
47
 
40
48
  def create_payment(payload, idempotency_key: nil)
41
49
  Responses::Base.new(
42
- Client.post("/payments", params:{}, payload: Requests::Payment.new(payload).as_hash, idempotency_key: idempotency_key)
50
+ Client.post("/payments", params: {}, payload: Requests::Payment.new(payload).as_hash, idempotency_key: idempotency_key)
43
51
  )
44
52
  end
45
53
 
@@ -47,13 +55,23 @@ module Smartpay
47
55
  create_payment(payload, idempotency_key: idempotency_key)
48
56
  end
49
57
 
50
- def get_payment(id, expand: '' )
58
+ def get_payment(id, expand: "")
51
59
  Responses::Base.new(Client.get("/payments/%s" % id, params: { expand: expand }))
52
60
  end
53
61
 
62
+ def get_payments(page_token: nil, max_results: nil, expand: "")
63
+ Responses::Base.new(Client.get("/payments", params: { pageToken: page_token, maxResults: max_results, expand: expand }))
64
+ end
65
+
66
+ def update_payment(id, payload, idempotency_key: nil)
67
+ Responses::Base.new(
68
+ Client.patch("/payments/%s" % id, payload: Requests::PaymentUpdate.new(payload).as_hash, idempotency_key: idempotency_key)
69
+ )
70
+ end
71
+
54
72
  def create_refund(payload, idempotency_key: nil)
55
73
  Responses::Base.new(
56
- Client.post("/refunds", params:{}, payload: Requests::Refund.new(payload).as_hash, idempotency_key: idempotency_key)
74
+ Client.post("/refunds", params: {}, payload: Requests::Refund.new(payload).as_hash, idempotency_key: idempotency_key)
57
75
  )
58
76
  end
59
77
 
@@ -61,10 +79,86 @@ module Smartpay
61
79
  create_refund(payload, idempotency_key: idempotency_key)
62
80
  end
63
81
 
64
- def get_refund(id, expand: '' )
82
+ def get_refund(id, expand: "")
65
83
  Responses::Base.new(Client.get("/refunds/%s" % id, params: { expand: expand }))
66
84
  end
67
85
 
86
+ def get_refunds(page_token: nil, max_results: nil, expand: "")
87
+ Responses::Base.new(Client.get("/refunds", params: { pageToken: page_token, maxResults: max_results, expand: expand }))
88
+ end
89
+
90
+ def update_refund(id, payload, idempotency_key: nil)
91
+ Responses::Base.new(
92
+ Client.patch("/refunds/%s" % id, payload: Requests::RefundUpdate.new(payload).as_hash, idempotency_key: idempotency_key)
93
+ )
94
+ end
95
+
96
+ def create_coupon(payload, idempotency_key: nil)
97
+ Responses::Base.new(
98
+ Client.post("/coupons", params: {}, payload: Requests::Coupon.new(payload).as_hash, idempotency_key: idempotency_key)
99
+ )
100
+ end
101
+
102
+ def get_coupon(id)
103
+ Responses::Base.new(Client.get("/coupons/%s" % id))
104
+ end
105
+
106
+ def get_coupons(page_token: nil, max_results: nil)
107
+ Responses::Base.new(Client.get("/coupons", params: { pageToken: page_token, maxResults: max_results }))
108
+ end
109
+
110
+ def update_coupon(id, payload, idempotency_key: nil)
111
+ Responses::Base.new(
112
+ Client.patch("/coupons/%s" % id, payload: Requests::CouponUpdate.new(payload).as_hash, idempotency_key: idempotency_key)
113
+ )
114
+ end
115
+
116
+ def create_promotion_code(payload, idempotency_key: nil)
117
+ Responses::Base.new(
118
+ Client.post("/promotion-codes", params: {}, payload: Requests::PromotionCode.new(payload).as_hash, idempotency_key: idempotency_key)
119
+ )
120
+ end
121
+
122
+ def get_promotion_code(id)
123
+ Responses::Base.new(Client.get("/promotion-codes/%s" % id))
124
+ end
125
+
126
+ def get_promotion_codes(page_token: nil, max_results: nil)
127
+ Responses::Base.new(Client.get("/promotion-codes", params: { pageToken: page_token, maxResults: max_results }))
128
+ end
129
+
130
+ def update_promotion_code(id, payload, idempotency_key: nil)
131
+ Responses::Base.new(
132
+ Client.patch("/promotion-codes/%s" % id, payload: Requests::PromotionCodeUpdate.new(payload).as_hash, idempotency_key: idempotency_key)
133
+ )
134
+ end
135
+
136
+ def create_webhook_endpoint(payload, idempotency_key: nil)
137
+ Responses::Base.new(
138
+ Client.post("/webhook-endpoints", params: {}, payload: Requests::WebhookEndpoint.new(payload).as_hash, idempotency_key: idempotency_key)
139
+ )
140
+ end
141
+
142
+ def get_webhook_endpoint(id)
143
+ Responses::Base.new(Client.get("/webhook-endpoints/%s" % id))
144
+ end
145
+
146
+ def get_webhook_endpoints(page_token: nil, max_results: nil)
147
+ Responses::Base.new(Client.get("/webhook-endpoints", params: { pageToken: page_token, maxResults: max_results }))
148
+ end
149
+
150
+ def update_webhook_endpoint(id, payload, idempotency_key: nil)
151
+ Responses::Base.new(
152
+ Client.patch("/webhook-endpoints/%s" % id, payload: Requests::WebhookEndpointUpdate.new(payload).as_hash, idempotency_key: idempotency_key)
153
+ )
154
+ end
155
+
156
+ def delete_webhook_endpoint(id)
157
+ Responses::Base.new(
158
+ Client.delete("/webhook-endpoints/%s" % id)
159
+ )
160
+ end
161
+
68
162
  def get_tokens(page_token: nil, max_results: nil)
69
163
  Responses::Base.new(Client.get("/tokens", params: { pageToken: page_token, maxResults: max_results }))
70
164
  end
@@ -81,8 +175,8 @@ module Smartpay
81
175
  Responses::Base.new(Client.put("/tokens/%s/disable" % id, idempotency_key: idempotency_key))
82
176
  end
83
177
 
84
- def delete_token(id, idempotency_key: nil)
85
- Responses::Base.new(Client.delete("/tokens/%s" % id, idempotency_key: idempotency_key))
178
+ def delete_token(id)
179
+ Responses::Base.new(Client.delete("/tokens/%s" % id))
86
180
  end
87
181
  end
88
182
  end
@@ -19,52 +19,39 @@ module Smartpay
19
19
  end
20
20
  end
21
21
 
22
-
23
22
  def post(path, params: {}, payload: {}, idempotency_key: nil)
24
- request_params = default_params.merge(params)
25
- request_payload = default_payload.merge(payload)
26
- idempotency_key ||= nonce
27
- with_retries(retry_options) do
28
- RestClient::Request.execute(
29
- method: :post,
30
- url: api_url(path),
31
- headers: headers.merge({ Idempotency_Key: idempotency_key }).merge(params: request_params),
32
- timeout: timeout,
33
- payload: request_payload.to_json
34
- )
35
- end
23
+ request(:post, path, params: params, payload: payload, idempotency_key: idempotency_key)
36
24
  end
37
25
 
38
26
  def put(path, params: {}, payload: {}, idempotency_key: nil)
39
- request_params = default_params.merge(params)
40
- request_payload = default_payload.merge(payload)
41
- idempotency_key ||= nonce
42
- with_retries(retry_options) do
43
- RestClient::Request.execute(
44
- method: :put,
45
- url: api_url(path),
46
- headers: headers.merge({ Idempotency_Key: idempotency_key }).merge(params: request_params),
47
- timeout: timeout,
48
- payload: request_payload.to_json
49
- )
50
- end
27
+ request(:put, path, params: params, payload: payload, idempotency_key: idempotency_key)
28
+ end
29
+
30
+ def patch(path, params: {}, payload: {}, idempotency_key: nil)
31
+ request(:patch, path, params: params, payload: payload, idempotency_key: idempotency_key)
51
32
  end
52
33
 
53
34
  def delete(path, params: {}, idempotency_key: nil)
35
+ request(:delete, path, params: params, idempotency_key: idempotency_key)
36
+ end
37
+
38
+ private
39
+
40
+ def request(method, path, params: {}, payload: {}, idempotency_key: nil)
54
41
  request_params = default_params.merge(params)
42
+ request_payload = default_payload.merge(payload)
55
43
  idempotency_key ||= nonce
56
44
  with_retries(retry_options) do
57
45
  RestClient::Request.execute(
58
- method: :delete,
46
+ method: method,
59
47
  url: api_url(path),
60
48
  headers: headers.merge({ Idempotency_Key: idempotency_key }).merge(params: request_params),
61
- timeout: timeout
49
+ timeout: timeout,
50
+ payload: request_payload.to_json
62
51
  )
63
52
  end
64
53
  end
65
54
 
66
- private
67
-
68
55
  def nonce
69
56
  SecureRandom.hex
70
57
  end
@@ -1,5 +1,6 @@
1
1
  module Smartpay
2
2
  module Errors
3
+ # InvalidRequestPayloadError
3
4
  class InvalidRequestPayloadError < ArgumentError
4
5
  attr_accessor :key_name
5
6
 
@@ -9,7 +10,7 @@ module Smartpay
9
10
  end
10
11
 
11
12
  def message
12
- "#{key_name} can't be blank."
13
+ "#{key_name} can't be blank or contains invalid value."
13
14
  end
14
15
  end
15
16
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # Coupon
6
+ class Coupon
7
+ include Validator
8
+
9
+ attr_accessor :payload
10
+
11
+ REQUIREMENT_KEY_NAME = %i[discountType name].freeze
12
+ AVAILABLE_DISCOUNT_TYPES = %w[percentage amount].freeze
13
+
14
+ def initialize(raw_payload)
15
+ @payload = raw_payload.transform_keys(&:to_sym)
16
+ end
17
+
18
+ def as_hash
19
+ check_requirement!(REQUIREMENT_KEY_NAME)
20
+ raise Errors::InvalidRequestPayloadError, :discountType unless AVAILABLE_DISCOUNT_TYPES.include?(payload[:discountType])
21
+ raise Errors::InvalidRequestPayloadError, :discountPercentage if payload[:discountType] == "percentage" && !payload[:discountPercentage]
22
+ raise Errors::InvalidRequestPayloadError, :discountAmount if payload[:discountType] == "amount" && !payload[:discountAmount]
23
+
24
+ normalize_payload
25
+ end
26
+
27
+ private
28
+
29
+ def normalize_payload
30
+ {
31
+ currency: payload[:currency],
32
+ discountAmount: payload[:discountAmount],
33
+ discountPercentage: payload[:discountPercentage],
34
+ discountType: payload[:discountType],
35
+ expiresAt: payload[:expiresAt],
36
+ maxRedemptionCount: payload[:maxRedemptionCount],
37
+ metadata: payload[:metadata] || {},
38
+ name: payload[:name]
39
+ }
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # CouponUpdate
6
+ class CouponUpdate
7
+ attr_accessor :payload
8
+
9
+ def initialize(raw_payload)
10
+ @payload = raw_payload.transform_keys(&:to_sym)
11
+ end
12
+
13
+ def as_hash
14
+ normalize_payload
15
+ end
16
+
17
+ private
18
+
19
+ def normalize_payload
20
+ {
21
+ active: payload[:active],
22
+ name: payload[:name],
23
+ metadata: payload[:metadata] || {}
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,28 +2,25 @@
2
2
 
3
3
  module Smartpay
4
4
  module Requests
5
+ # Payment
5
6
  class Payment
7
+ include Validator
8
+
6
9
  attr_accessor :payload
7
10
 
8
- REQUIREMENT_KEY_NAME = [:order, :amount, :currency].freeze
11
+ REQUIREMENT_KEY_NAME = %i[order amount currency].freeze
9
12
 
10
13
  def initialize(raw_payload)
11
14
  @payload = raw_payload.transform_keys(&:to_sym)
12
15
  end
13
16
 
14
17
  def as_hash
15
- check_requirement!
18
+ check_requirement!(REQUIREMENT_KEY_NAME)
16
19
  normalize_payload
17
20
  end
18
21
 
19
22
  private
20
23
 
21
- def check_requirement!
22
- REQUIREMENT_KEY_NAME.each do |key_name|
23
- raise Errors::InvalidRequestPayloadError, key_name unless payload.include?(key_name)
24
- end
25
- end
26
-
27
24
  def normalize_payload
28
25
  {
29
26
  order: payload.dig(:order),
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # PaymentUpdate
6
+ class PaymentUpdate
7
+ attr_accessor :payload
8
+
9
+ def initialize(raw_payload)
10
+ @payload = raw_payload.transform_keys(&:to_sym)
11
+ end
12
+
13
+ def as_hash
14
+ normalize_payload
15
+ end
16
+
17
+ private
18
+
19
+ def normalize_payload
20
+ {
21
+ reference: payload[:reference],
22
+ description: payload[:description],
23
+ metadata: payload[:metadata] || {}
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # PromotionCode
6
+ class PromotionCode
7
+ include Validator
8
+
9
+ attr_accessor :payload
10
+
11
+ REQUIREMENT_KEY_NAME = %i[code coupon].freeze
12
+
13
+ def initialize(raw_payload)
14
+ @payload = raw_payload.transform_keys(&:to_sym)
15
+ end
16
+
17
+ def as_hash
18
+ check_requirement!(REQUIREMENT_KEY_NAME)
19
+ normalize_payload
20
+ end
21
+
22
+ private
23
+
24
+ def normalize_payload
25
+ {
26
+ active: payload[:active],
27
+ code: payload[:code],
28
+ coupon: payload[:coupon],
29
+ currency: payload[:currency],
30
+ expiresAt: payload[:expiresAt],
31
+ firstTimeTransaction: payload[:firstTimeTransaction],
32
+ maxRedemptionCount: payload[:maxRedemptionCount],
33
+ metadata: payload[:metadata] || {},
34
+ minimumAmount: payload[:minimumAmount],
35
+ onePerCustomer: payload[:onePerCustomer]
36
+ }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # PromotionCodeUpdate
6
+ class PromotionCodeUpdate
7
+ attr_accessor :payload
8
+
9
+ def initialize(raw_payload)
10
+ @payload = raw_payload.transform_keys(&:to_sym)
11
+ end
12
+
13
+ def as_hash
14
+ normalize_payload
15
+ end
16
+
17
+ private
18
+
19
+ def normalize_payload
20
+ {
21
+ active: payload[:active],
22
+ metadata: payload[:metadata] || {}
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,37 +2,34 @@
2
2
 
3
3
  module Smartpay
4
4
  module Requests
5
+ # Refund
5
6
  class Refund
7
+ include Validator
8
+
6
9
  attr_accessor :payload
7
10
 
8
- REQUIREMENT_KEY_NAME = [:payment, :amount, :currency].freeze
11
+ REQUIREMENT_KEY_NAME = %i[payment amount currency].freeze
9
12
 
10
13
  def initialize(raw_payload)
11
14
  @payload = raw_payload.transform_keys(&:to_sym)
12
15
  end
13
16
 
14
17
  def as_hash
15
- check_requirement!
18
+ check_requirement!(REQUIREMENT_KEY_NAME)
16
19
  normalize_payload
17
20
  end
18
21
 
19
22
  private
20
23
 
21
- def check_requirement!
22
- REQUIREMENT_KEY_NAME.each do |key_name|
23
- raise Errors::InvalidRequestPayloadError, key_name unless payload.include?(key_name)
24
- end
25
- end
26
-
27
24
  def normalize_payload
28
25
  {
29
- payment: payload.dig(:payment),
30
- amount: payload.dig(:amount),
31
- currency: payload.dig(:currency),
32
- reason: payload.dig(:reason),
33
- reference: payload.dig(:reference),
34
- description: payload.dig(:description),
35
- metadata: payload.dig(:metadata) || {},
26
+ payment: payload[:payment],
27
+ amount: payload[:amount],
28
+ currency: payload[:currency],
29
+ reason: payload[:reason],
30
+ reference: payload[:reference],
31
+ description: payload[:description],
32
+ metadata: payload[:metadata] || {}
36
33
  }
37
34
  end
38
35
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # RefundUpdate
6
+ class RefundUpdate
7
+ attr_accessor :payload
8
+
9
+ def initialize(raw_payload)
10
+ @payload = raw_payload.transform_keys(&:to_sym)
11
+ end
12
+
13
+ def as_hash
14
+ normalize_payload
15
+ end
16
+
17
+ private
18
+
19
+ def normalize_payload
20
+ {
21
+ reference: payload[:reference],
22
+ description: payload[:description],
23
+ metadata: payload[:metadata] || {}
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,6 @@
1
1
  module Smartpay
2
2
  module Requests
3
+ # Validator
3
4
  module Validator
4
5
 
5
6
  private
@@ -12,4 +13,4 @@ module Smartpay
12
13
 
13
14
  end
14
15
  end
15
- end
16
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # WebhookEndpoint
6
+ class WebhookEndpoint
7
+ include Validator
8
+
9
+ attr_accessor :payload
10
+
11
+ REQUIREMENT_KEY_NAME = %i[url].freeze
12
+ ALLOWED_EVENT_SUBSCRIPTIONS_VALUES = [
13
+ "order.authorized",
14
+ "order.rejected",
15
+ "order.canceled",
16
+ "payment.created",
17
+ "refund.created",
18
+ "payout.generated",
19
+ "payout.paid",
20
+ "coupon.created",
21
+ "coupon.updated",
22
+ "promotion_code.created",
23
+ "promotion_code.updated",
24
+ "merchant_user.created",
25
+ "merchant_user.password_reset",
26
+ "token.approved",
27
+ "token.rejected",
28
+ "token.deleted",
29
+ "token.disabled",
30
+ "token.enabled",
31
+ "token.created",
32
+ "token.used"
33
+ ].freeze
34
+
35
+ def initialize(raw_payload)
36
+ @payload = raw_payload.transform_keys(&:to_sym)
37
+ end
38
+
39
+ def as_hash
40
+ check_requirement!(REQUIREMENT_KEY_NAME)
41
+ validate_event_subscription
42
+ normalize_payload
43
+ end
44
+
45
+ protected
46
+
47
+ def validate_event_subscription
48
+ return unless payload[:eventSubscriptions]
49
+
50
+ payload[:eventSubscriptions].each do |event|
51
+ unless ALLOWED_EVENT_SUBSCRIPTIONS_VALUES.include?(event)
52
+ raise Errors::InvalidRequestPayloadError, "eventSubscriptions.#{event}"
53
+ end
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def normalize_payload
60
+ {
61
+ description: payload[:description],
62
+ eventSubscriptions: payload[:eventSubscriptions],
63
+ metadata: payload[:metadata],
64
+ url: payload[:url]
65
+ }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Smartpay
4
+ module Requests
5
+ # WebhookEndpointUpdate
6
+ class WebhookEndpointUpdate < WebhookEndpoint
7
+
8
+ def as_hash
9
+ validate_event_subscription
10
+ normalize_payload
11
+ end
12
+
13
+ private
14
+
15
+ def normalize_payload
16
+ {
17
+ active: payload[:active],
18
+ description: payload[:description],
19
+ eventSubscriptions: payload[:eventSubscriptions],
20
+ metadata: payload[:metadata],
21
+ url: payload[:url]
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Smartpay
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
data/lib/smartpay.rb CHANGED
@@ -11,13 +11,22 @@ require_relative "smartpay/requests/checkout_session"
11
11
  require_relative "smartpay/requests/checkout_session_for_token"
12
12
  require_relative "smartpay/requests/order"
13
13
  require_relative "smartpay/requests/payment"
14
+ require_relative "smartpay/requests/payment_update"
14
15
  require_relative "smartpay/requests/refund"
16
+ require_relative "smartpay/requests/refund_update"
17
+ require_relative "smartpay/requests/coupon"
18
+ require_relative "smartpay/requests/coupon_update"
19
+ require_relative "smartpay/requests/promotion_code"
20
+ require_relative "smartpay/requests/promotion_code_update"
21
+ require_relative "smartpay/requests/webhook_endpoint"
22
+ require_relative "smartpay/requests/webhook_endpoint_update"
15
23
  require_relative "smartpay/responses/base"
16
24
  require_relative "smartpay/responses/checkout_session"
17
25
 
26
+ # Smartpay
18
27
  module Smartpay
19
- REJECT_REQUEST_BY_CUSTOMER = 'requested_by_customer'
20
- REJECT_FRAUDULENT = 'fraudulent'
28
+ REJECT_REQUEST_BY_CUSTOMER = "requested_by_customer"
29
+ REJECT_FRAUDULENT = "fraudulent"
21
30
 
22
31
  class << self
23
32
  attr_accessor :configuration
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smartpay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-20 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -68,11 +68,19 @@ files:
68
68
  - lib/smartpay/errors/invalid_request_payload_error.rb
69
69
  - lib/smartpay/requests/checkout_session.rb
70
70
  - lib/smartpay/requests/checkout_session_for_token.rb
71
+ - lib/smartpay/requests/coupon.rb
72
+ - lib/smartpay/requests/coupon_update.rb
71
73
  - lib/smartpay/requests/normalizer.rb
72
74
  - lib/smartpay/requests/order.rb
73
75
  - lib/smartpay/requests/payment.rb
76
+ - lib/smartpay/requests/payment_update.rb
77
+ - lib/smartpay/requests/promotion_code.rb
78
+ - lib/smartpay/requests/promotion_code_update.rb
74
79
  - lib/smartpay/requests/refund.rb
80
+ - lib/smartpay/requests/refund_update.rb
75
81
  - lib/smartpay/requests/validator.rb
82
+ - lib/smartpay/requests/webhook_endpoint.rb
83
+ - lib/smartpay/requests/webhook_endpoint_update.rb
76
84
  - lib/smartpay/responses/base.rb
77
85
  - lib/smartpay/responses/checkout_session.rb
78
86
  - lib/smartpay/version.rb