stone-ruby 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +21 -0
  3. data/.rubocop.yml +28 -0
  4. data/Gemfile +4 -2
  5. data/Gemfile.lock +56 -2
  6. data/Rakefile +5 -3
  7. data/bin/console +4 -3
  8. data/lib/stone-ruby.rb +3 -1
  9. data/lib/stone.rb +7 -2
  10. data/lib/stone/conciliation.rb +3 -1
  11. data/lib/stone/conciliation/client.rb +5 -6
  12. data/lib/stone/conciliation/client/access_authorization.rb +3 -3
  13. data/lib/stone/conciliation/error.rb +2 -0
  14. data/lib/stone/siclos.rb +4 -1
  15. data/lib/stone/siclos/client.rb +40 -39
  16. data/lib/stone/siclos/client/claim_check.rb +8 -8
  17. data/lib/stone/siclos/client/danfe.rb +8 -8
  18. data/lib/stone/siclos/client/establishment.rb +7 -7
  19. data/lib/stone/siclos/client/finance.rb +3 -3
  20. data/lib/stone/siclos/client/pos.rb +10 -10
  21. data/lib/stone/siclos/client/pre_transaction.rb +8 -8
  22. data/lib/stone/siclos/client/recipient.rb +7 -7
  23. data/lib/stone/siclos/client/token.rb +2 -0
  24. data/lib/stone/siclos/client/transaction.rb +7 -7
  25. data/lib/stone/siclos/client/webhook.rb +15 -15
  26. data/lib/stone/siclos/entity.rb +25 -0
  27. data/lib/stone/siclos/entity/address.rb +17 -0
  28. data/lib/stone/siclos/entity/anticipation.rb +13 -0
  29. data/lib/stone/siclos/entity/bank.rb +16 -0
  30. data/lib/stone/siclos/entity/capture_method.rb +14 -0
  31. data/lib/stone/siclos/entity/card_rate.rb +16 -0
  32. data/lib/stone/siclos/entity/contact.rb +13 -0
  33. data/lib/stone/siclos/entity/contact_recipient.rb +11 -0
  34. data/lib/stone/siclos/entity/create_establishment.rb +28 -0
  35. data/lib/stone/siclos/entity/create_establishment_existing.rb +17 -0
  36. data/lib/stone/siclos/entity/create_recipient.rb +24 -0
  37. data/lib/stone/siclos/entity/create_recipient_existing.rb +18 -0
  38. data/lib/stone/siclos/entity/responsible.rb +12 -0
  39. data/lib/stone/siclos/entity/responsible_recipient.rb +14 -0
  40. data/lib/stone/siclos/error.rb +2 -0
  41. data/lib/stone/types.rb +15 -0
  42. data/lib/stone/version.rb +4 -2
  43. data/stone-ruby.gemspec +8 -4
  44. metadata +64 -5
@@ -1,19 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class ClaimCheck < Base
4
-
5
- def create data
6
- request(:post, "/claim-check/create", data)
6
+ def create(data)
7
+ request(:post, '/claim-check/create', data)
7
8
  end
8
9
 
9
- def consult claim_check_id
10
- request(:get, "/claim-check/consult", claim_check_id)
10
+ def consult(claim_check_id)
11
+ request(:get, '/claim-check/consult', claim_check_id)
11
12
  end
12
13
 
13
- def delete claim_check_id
14
- request(:delete, "/claim-check/delete", claim_check_id)
14
+ def delete(claim_check_id)
15
+ request(:delete, '/claim-check/delete', claim_check_id)
15
16
  end
16
-
17
17
  end
18
18
  end
19
19
  end
@@ -1,19 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Danfe < Base
4
-
5
- def create data
6
- request(:post, "/danfe/create", data)
6
+ def create(data)
7
+ request(:post, '/danfe/create', data)
7
8
  end
8
9
 
9
- def consult danfe_id
10
- request(:get, "/danfe/consult", danfe_id)
10
+ def consult(danfe_id)
11
+ request(:get, '/danfe/consult', danfe_id)
11
12
  end
12
13
 
13
- def delete danfe_id
14
- request(:delete, "/danfe/delete", danfe_id)
14
+ def delete(danfe_id)
15
+ request(:delete, '/danfe/delete', danfe_id)
15
16
  end
16
-
17
17
  end
18
18
  end
19
19
  end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Establishment < Base
4
-
5
- def create data
6
- request(:post, "/establishment/create", data)
6
+ def create(data)
7
+ request(:post, '/establishment/create', data)
7
8
  end
8
9
 
9
- def create_existing_stone data
10
- request(:post, "/establishment/create-existing-stone", data)
10
+ def create_existing_stone(data)
11
+ request(:post, '/establishment/create-existing-stone', data)
11
12
  end
12
13
 
13
14
  def deactivate_establishment(id)
@@ -15,7 +16,7 @@ module Stone::Siclos
15
16
  end
16
17
 
17
18
  def reactivate_establishment(data)
18
- request(:put, "/establishment/reactivate-establishment/", data)
19
+ request(:put, '/establishment/reactivate-establishment/', data)
19
20
  end
20
21
 
21
22
  def get_all
@@ -25,7 +26,6 @@ module Stone::Siclos
25
26
  def get_single(id)
26
27
  request(:get, "/establishment/get-single/#{id}")
27
28
  end
28
-
29
29
  end
30
30
  end
31
31
  end
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Finance < Base
4
-
5
- def extract data
6
+ def extract(data)
6
7
  request :post, '/finance/extract', data
7
8
  end
8
-
9
9
  end
10
10
  end
11
11
  end
@@ -1,27 +1,27 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Pos < Base
4
-
5
- def control_configuration data
6
- request(:post, "/pos/control-configuration", data)
6
+ def control_configuration(data)
7
+ request(:post, '/pos/control-configuration', data)
7
8
  end
8
9
 
9
- def get_control_configuration establishment_id
10
+ def get_control_configuration(establishment_id)
10
11
  request(:get, "/pos/control-configuration/#{establishment_id}")
11
12
  end
12
13
 
13
- def get_available_pos establishment_id
14
+ def get_available_pos(establishment_id)
14
15
  request(:get, "/pos/get-available-pos/#{establishment_id}")
15
16
  end
16
17
 
17
- def activate_pos_link data
18
- request(:post, "/pos/active-pos-link", data)
18
+ def activate_pos_link(data)
19
+ request(:post, '/pos/active-pos-link', data)
19
20
  end
20
21
 
21
- def deactivate_pos_link pos_reference_id
22
- request(:put, "/pos/deactivate-pos-link", pos_reference_id)
22
+ def deactivate_pos_link(pos_reference_id)
23
+ request(:put, '/pos/deactivate-pos-link', pos_reference_id)
23
24
  end
24
-
25
25
  end
26
26
  end
27
27
  end
@@ -1,23 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class PreTransaction < Base
4
-
5
- def create data
6
- request(:post, "/pre-transaction/create", data)
6
+ def create(data)
7
+ request(:post, '/pre-transaction/create', data)
7
8
  end
8
9
 
9
- def single pre_transaction_id
10
+ def single(pre_transaction_id)
10
11
  request(:get, "/pre-transaction/single/#{pre_transaction_id}")
11
12
  end
12
13
 
13
- def date data
14
- request(:post, "/pre-transaction/date", data)
14
+ def date(data)
15
+ request(:post, '/pre-transaction/date', data)
15
16
  end
16
17
 
17
- def delete pre_transaction_id
18
+ def delete(pre_transaction_id)
18
19
  request(:delete, "/pre-transaction/delete/#{pre_transaction_id}")
19
20
  end
20
-
21
21
  end
22
22
  end
23
23
  end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Recipient < Base
4
-
5
- def create data
6
- request(:post, "/recipient/create", data)
6
+ def create(data)
7
+ request(:post, '/recipient/create', data)
7
8
  end
8
9
 
9
- def create_existing_stone data
10
- request(:post, "/recipient/create-existing-stone", data)
10
+ def create_existing_stone(data)
11
+ request(:post, '/recipient/create-existing-stone', data)
11
12
  end
12
13
 
13
14
  def deactivate_recipient(recipient_id)
@@ -15,7 +16,7 @@ module Stone::Siclos
15
16
  end
16
17
 
17
18
  def reactivate_recipient(data)
18
- request(:put, "/recipient/reactivate-recipient/", data)
19
+ request(:put, '/recipient/reactivate-recipient/', data)
19
20
  end
20
21
 
21
22
  def get_all_establishment_recipients
@@ -25,7 +26,6 @@ module Stone::Siclos
25
26
  def get_single(recipient_id)
26
27
  request(:get, "/recipient/get-single/#{recipient_id}")
27
28
  end
28
-
29
29
  end
30
30
  end
31
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Token < Base
@@ -1,23 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Transaction < Base
4
-
5
- def single_siclos siclos_transaction_id
6
+ def single_siclos(siclos_transaction_id)
6
7
  request(:get, "/transactions/single/siclos/#{siclos_transaction_id}")
7
8
  end
8
9
 
9
- def single_stone stone_transaction_id
10
+ def single_stone(stone_transaction_id)
10
11
  request(:get, "/transactions/single/stone/#{stone_transaction_id}")
11
12
  end
12
13
 
13
- def single_pre_transaction pre_transaction_id
14
+ def single_pre_transaction(pre_transaction_id)
14
15
  request(:get, "/transactions/single/pre-transaction/#{pre_transaction_id}")
15
16
  end
16
17
 
17
- def list_provider data
18
- request(:post, "/transactions/list/provider", data)
18
+ def list_provider(data)
19
+ request(:post, '/transactions/list/provider', data)
19
20
  end
20
-
21
21
  end
22
22
  end
23
23
  end
@@ -1,35 +1,35 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stone::Siclos
2
4
  module Client
3
5
  class Webhook < Base
4
-
5
- def pre_transaction_status data
6
- request(:post, "/webhook/pre-transaction-status", data)
6
+ def pre_transaction_status(data)
7
+ request(:post, '/webhook/pre-transaction-status', data)
7
8
  end
8
9
 
9
- def processed_transaction data
10
- request(:post, "/webhook/processed-transaction", data)
10
+ def processed_transaction(data)
11
+ request(:post, '/webhook/processed-transaction', data)
11
12
  end
12
13
 
13
- def status_split data
14
- request(:post, "/webhook/status-split", data)
14
+ def status_split(data)
15
+ request(:post, '/webhook/status-split', data)
15
16
  end
16
17
 
17
- def print_note_status data
18
- request(:post, "/webhook/print-note-status", data)
18
+ def print_note_status(data)
19
+ request(:post, '/webhook/print-note-status', data)
19
20
  end
20
21
 
21
- def enabled_split data
22
- request(:post, "/webhook/enabled-split", data)
22
+ def enabled_split(data)
23
+ request(:post, '/webhook/enabled-split', data)
23
24
  end
24
25
 
25
- def pos_application data
26
- request(:post, "/webhook/pos-application", data)
26
+ def pos_application(data)
27
+ request(:post, '/webhook/pos-application', data)
27
28
  end
28
29
 
29
30
  def webhook
30
- request(:get, "/webhook")
31
+ request(:get, '/webhook')
31
32
  end
32
-
33
33
  end
34
34
  end
35
35
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ autoload :Address, 'stone/siclos/entity/address'
7
+ autoload :Anticipation, 'stone/siclos/entity/anticipation'
8
+ autoload :Bank, 'stone/siclos/entity/bank'
9
+ autoload :CaptureMethod, 'stone/siclos/entity/capture_method'
10
+ autoload :CardRate, 'stone/siclos/entity/card_rate'
11
+ autoload :Contact, 'stone/siclos/entity/contact'
12
+ autoload :CreateEstablishment, 'stone/siclos/entity/create_establishment'
13
+ autoload :CreateEstablishmentExisting, 'stone/siclos/entity/create_establishment_existing'
14
+ autoload :Responsible, 'stone/siclos/entity/responsible'
15
+ autoload :ResponsibleRecipient, 'stone/siclos/entity/responsible_recipient'
16
+ autoload :ContactRecipient, 'stone/siclos/entity/contact_recipient'
17
+ autoload :CreateRecipient, 'stone/siclos/entity/create_recipient'
18
+ autoload :CreateRecipientExisting, 'stone/siclos/entity/create_recipient_existing'
19
+
20
+ class Base < Dry::Struct
21
+ transform_keys(&:to_sym)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class Address < Base
7
+ attribute :street_name, Types::Coercible::String.optional.default(nil)
8
+ attribute :number, Types::Coercible::String.optional.default(nil)
9
+ attribute :complement, Types::Coercible::String.optional.default(nil)
10
+ attribute :neighborhood, Types::Coercible::String.optional.default(nil)
11
+ attribute :zip_code, Types::OnlyNumbersString.optional.default(nil)
12
+ attribute :city, Types::Coercible::String.optional.default(nil)
13
+ attribute :state, Types::Coercible::String.optional.default(nil)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class Anticipation < Base
7
+ attribute :is_automatic, Types::Params::Bool.optional.default(false)
8
+ attribute :automatic_rate, Types::Coercible::Float.optional.default(0)
9
+ attribute :spot_rate, Types::Coercible::Float.optional.default(0)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class Bank < Base
7
+ attribute :bank_code, Types::Coercible::String.optional.default(nil)
8
+ attribute :agency, Types::Coercible::String.optional.default(nil)
9
+ attribute :agency_dv, Types::Coercible::String.optional.default(nil)
10
+ attribute :account, Types::Coercible::String.optional.default(nil)
11
+ attribute :account_dv, Types::Coercible::String.optional.default(nil)
12
+ attribute :account_type, Types::Coercible::String.optional.default(nil)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CaptureMethod < Base
7
+ attribute :amount_of_s920, Types::AmountFormatted.optional.default(nil)
8
+ attribute :mobile_carrier_id, Types::Coercible::Integer.optional.default(nil)
9
+ attribute :monthly_fee, Types::AmountFormatted.optional.default(nil)
10
+ attribute :initial_exemption_days, Types::Coercible::Integer.optional.default(nil)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class CardRate < Base
7
+ attribute :type_id, Types::Coercible::Float.optional.default(nil)
8
+ attribute :visa, Types::Coercible::Float.optional.default(nil)
9
+ attribute :master, Types::Coercible::Float.optional.default(nil)
10
+ attribute :elo, Types::Coercible::Float.optional.default(nil)
11
+ attribute :hiper, Types::Coercible::Float.optional.default(nil)
12
+ attribute :amex, Types::Coercible::Float.optional.default(nil)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class Contact < Base
7
+ attribute :name, Types::Coercible::String.optional.default(nil)
8
+ attribute :cell_phone, Types::OnlyNumbersString.optional.default(nil)
9
+ attribute :phone, Types::OnlyNumbersString.optional.default(nil)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stone
4
+ module Siclos
5
+ module Entity
6
+ class ContactRecipient < Base
7
+ attribute :phone_number, Types::OnlyNumbersString.optional.default(nil)
8
+ end
9
+ end
10
+ end
11
+ end