billimatic-client 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDdmMjNmYTFhYzJjYWQzZGFmYzhiMjg1MjEyM2JlMzYyYzgxNzZmZA==
4
+ MGUyM2ZjNDY5NjVhODlmMTRiMGExMDkyY2EyYTY0ZmJiN2E4NzE0MQ==
5
5
  data.tar.gz: !binary |-
6
- MDRjMWZkN2ZlNjIxMWE1ZGNmZTdmNzZlNDEwMmE2NzYwMDM3MzNjMg==
6
+ ODZkZDMxMTRkNWZkNzJjZTk5YzRlODE5NTM4NGQ5YzFiYzNlMmEwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWM1ODY1ZDIzYmQwZTg1MjlkMDBhOWVkYTI4ZjFiMmUyNTczNmQxYmJiMDdh
10
- MTc5MzJmODNjOTg1NTQ5OTAwZjJmNmE5M2I4ZDEyNGYxOGU3YTQzY2IyYTY5
11
- MDQ5OWY0MjkyODJhMzU5MDQ1YjcwNGY0YzA1NzU4MjU1YjIzZDA=
9
+ NGNmOTNlNWU0MDY0ZTE0MGNjZmQ2NDZlYTVhNDc3ODA4MGIyNmYxMGY2Y2I4
10
+ ZmIxNzFlYTZhMWEyMzBlMDFmZDgxNWFkNjZhZWIwMzBkMzM0ZDNmOWFlOWUz
11
+ Njk2MWVhODIyOTU5NmU2YmZiNzczYjc3MTJkMzI3MDNkYmRiYWM=
12
12
  data.tar.gz: !binary |-
13
- MTAwNzIzZDUwZTRjNGU5ZWIwYjMzZWIzYzhjMzhjYzlkNTJjYzlhYmI0MjM4
14
- YmM5MjA1NjM5ZjdiYmJiMTJhYTJmMmRhODI2MjI1ZjM1MDJjYTdkOTBkZDhh
15
- YjlhMTUxNThlYWFiODI5NzQxM2IzZGNmODA3M2RiM2I4ODk3NzM=
13
+ Mzc3ZmUwMDk5ZGJmMjJjOGJkM2M3ODczNjA3NzMwZGYxOWVlY2RiN2FhODcz
14
+ MTFjNDE2YmJlZmEzYjUzYjllMGY5MWY3NDM3MGM3NzNjNWU2MTliZjM3YTQ2
15
+ OWVmM2U1ODhhYWRlNjgzODNkMDIwOTMzN2NlMDkyNjRlNGY2NWI=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- billimatic-client (0.8.0)
4
+ billimatic-client (0.9.0)
5
5
  multi_json (~> 1.11)
6
6
  typhoeus (~> 0.8)
7
7
  virtus (~> 1.0.5)
data/README.md CHANGED
@@ -218,6 +218,28 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
218
218
  <code>client.subscriptions.change_plan(token: token, new_plan_id: id)</code>
219
219
  </td>
220
220
  </tr>
221
+ <tr>
222
+ <td><code>PATCH</code></td>
223
+ <td>
224
+ <a href="https://app.billimatic.com.br/docs/api#!/payment_gateway/API_V1_Subscription_PaymentGateway_retry_patch_0" target="_blank">
225
+ /api/v1/subscriptions/:token/:invoice_id/retry
226
+ </a>
227
+ </td>
228
+ <td>
229
+ <code>client.subscriptions.retry_charge(attributes_hash, token: token, invoice_id: id)</code>
230
+ </td>
231
+ </tr>
232
+ <tr>
233
+ <td><code>PATCH</code></td>
234
+ <td>
235
+ <a href="https://app.billimatic.com.br/docs/api#!/payment_informations/API_V1_Subscription_PaymentInformations_update_patch_0" target="_blank">
236
+ /api/v1/subscriptions/:token/update_payment_information
237
+ </a>
238
+ </td>
239
+ <td>
240
+ <code>client.subscriptions.update_payment_information(attributes_hash, token: token)</code>
241
+ </td>
242
+ </tr>
221
243
  <tr>
222
244
  <td><code>PATCH</code></td>
223
245
  <td>
@@ -24,6 +24,7 @@ require 'billimatic/entities/organization'
24
24
  require 'billimatic/entities/contract'
25
25
  require 'billimatic/entities/invoice'
26
26
  require 'billimatic/entities/invoice_rule'
27
+ require 'billimatic/entities/payment_information'
27
28
  require 'billimatic/entities/subscription'
28
29
  require 'billimatic/entities/webhook'
29
30
 
@@ -0,0 +1,12 @@
1
+ module Billimatic
2
+ module Entities
3
+ class PaymentInformation < Base
4
+ attribute :id, Integer
5
+ attribute :payment_method, String
6
+ attribute :cobrato_card_id, Integer
7
+ attribute :card_expiration_month, Integer
8
+ attribute :card_expiration_year, Integer
9
+ attribute :created_at, DateTime
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,8 @@
1
1
  module Billimatic
2
2
  module Entities
3
3
  class Subscription < Contract
4
+ attribute :payment_information, PaymentInformation
5
+
4
6
  def checkout_url
5
7
  # TODO should this come from the JSON from Billimatic?
6
8
  fake_http = nil
@@ -26,6 +26,24 @@ module Billimatic
26
26
  end
27
27
  end
28
28
 
29
+ def retry_charge(params, token:, invoice_id:)
30
+ http.patch(
31
+ "#{resource_base_path}/#{token}/#{invoice_id}/retry",
32
+ body: { subscription: params }
33
+ ) do |response|
34
+ respond_with_entity response
35
+ end
36
+ end
37
+
38
+ def update_payment_information(params, token:)
39
+ http.patch(
40
+ "#{resource_base_path}/#{token}/update_payment_information",
41
+ body: { subscription: params }
42
+ ) do |response|
43
+ respond_with_entity response
44
+ end
45
+ end
46
+
29
47
  def cancel(token:)
30
48
  http.patch("#{resource_base_path}/#{token}/cancel") do |response|
31
49
  respond_with_entity response
@@ -1,3 +1,3 @@
1
1
  module Billimatic
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billimatic-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-10-28 00:00:00.000000000 Z
13
+ date: 2016-11-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
@@ -230,6 +230,7 @@ files:
230
230
  - lib/billimatic/entities/invoice.rb
231
231
  - lib/billimatic/entities/invoice_rule.rb
232
232
  - lib/billimatic/entities/organization.rb
233
+ - lib/billimatic/entities/payment_information.rb
233
234
  - lib/billimatic/entities/plan.rb
234
235
  - lib/billimatic/entities/plan_feature.rb
235
236
  - lib/billimatic/entities/product.rb