six_saferpay 1.2.1 → 1.16.2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.test.env +1 -1
  4. data/.travis.yml +4 -2
  5. data/Gemfile.lock +70 -85
  6. data/README.md +120 -3
  7. data/lib/six_saferpay/api.rb +1 -1
  8. data/lib/six_saferpay/api/six_batch/requests/close.rb +37 -0
  9. data/lib/six_saferpay/api/six_batch/responses/close_response.rb +20 -0
  10. data/lib/six_saferpay/api/six_omni_channel/requests/acquire_transaction.rb +46 -0
  11. data/lib/six_saferpay/api/six_omni_channel/requests/insert_alias.rb +40 -0
  12. data/lib/six_saferpay/api/six_omni_channel/responses/acquire_transaction_response.rb +30 -0
  13. data/lib/six_saferpay/api/six_omni_channel/responses/insert_alias_response.rb +34 -0
  14. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +4 -0
  15. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  16. data/lib/six_saferpay/api/six_payment_page/responses/{initalize_response.rb → initialize_response.rb} +0 -0
  17. data/lib/six_saferpay/api/six_secure_card_data/requests/assert_insert.rb +37 -0
  18. data/lib/six_saferpay/api/six_secure_card_data/requests/delete.rb +37 -0
  19. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +66 -0
  20. data/lib/six_saferpay/api/six_secure_card_data/requests/insert_direct.rb +46 -0
  21. data/lib/six_saferpay/api/six_secure_card_data/requests/update.rb +42 -0
  22. data/lib/six_saferpay/api/six_secure_card_data/responses/assert_insert_response.rb +33 -0
  23. data/lib/six_saferpay/api/six_secure_card_data/responses/delete_response.rb +20 -0
  24. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_direct_response.rb +33 -0
  25. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +33 -0
  26. data/lib/six_saferpay/api/six_secure_card_data/responses/update_response.rb +29 -0
  27. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +61 -0
  28. data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
  29. data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +59 -0
  30. data/lib/six_saferpay/api/six_transaction/requests/authorize.rb +1 -1
  31. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  32. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  33. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  34. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +4 -0
  35. data/lib/six_saferpay/api/six_transaction/requests/inquire.rb +36 -0
  36. data/lib/six_saferpay/api/six_transaction/requests/multipart_finalize.rb +38 -0
  37. data/lib/six_saferpay/api/six_transaction/requests/query_alternative_payment.rb +35 -0
  38. data/lib/six_saferpay/api/six_transaction/requests/refund.rb +7 -7
  39. data/lib/six_saferpay/api/six_transaction/requests/refund_direct.rb +46 -0
  40. data/lib/six_saferpay/api/six_transaction/responses/adjust_amount_response.rb +1 -4
  41. data/lib/six_saferpay/api/six_transaction/responses/alternative_payment_response.rb +35 -0
  42. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  43. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  44. data/lib/six_saferpay/api/six_transaction/responses/cancel_response.rb +1 -1
  45. data/lib/six_saferpay/api/six_transaction/responses/inquire_response.rb +44 -0
  46. data/lib/six_saferpay/api/six_transaction/responses/multipart_finalize_response.rb +20 -0
  47. data/lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb +39 -0
  48. data/lib/six_saferpay/api/six_transaction/responses/refund_direct_response.rb +34 -0
  49. data/lib/six_saferpay/client.rb +8 -2
  50. data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
  51. data/lib/six_saferpay/models/address.rb +4 -4
  52. data/lib/six_saferpay/models/alias.rb +22 -0
  53. data/lib/six_saferpay/models/alias_card.rb +20 -0
  54. data/lib/six_saferpay/models/authentication.rb +36 -0
  55. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  56. data/lib/six_saferpay/models/bancontact.rb +20 -0
  57. data/lib/six_saferpay/models/bankcontact.rb +21 -0
  58. data/lib/six_saferpay/models/check.rb +22 -0
  59. data/lib/six_saferpay/models/check_result.rb +27 -0
  60. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  61. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  62. data/lib/six_saferpay/models/error.rb +0 -28
  63. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  64. data/lib/six_saferpay/models/ideal.rb +18 -0
  65. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  66. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  67. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  68. data/lib/six_saferpay/models/notification.rb +4 -4
  69. data/lib/six_saferpay/models/payment_method_options.rb +18 -0
  70. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  71. data/lib/six_saferpay/models/pending_notification.rb +4 -4
  72. data/lib/six_saferpay/models/processing_data.rb +18 -0
  73. data/lib/six_saferpay/models/registration_result.rb +11 -2
  74. data/lib/six_saferpay/models/request_payment_means.rb +6 -2
  75. data/lib/six_saferpay/models/response_card.rb +0 -4
  76. data/lib/six_saferpay/models/saferpay_fields.rb +18 -0
  77. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  78. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  79. data/lib/six_saferpay/models/update_alias.rb +20 -0
  80. data/lib/six_saferpay/models/update_payment_means.rb +18 -0
  81. data/lib/six_saferpay/version.rb +1 -1
  82. data/six_saferpay.gemspec +12 -14
  83. metadata +81 -28
@@ -0,0 +1,23 @@
1
+ module SixSaferpay
2
+ module SecurePayGateApi
3
+ class Client < SixSaferpay::Client
4
+
5
+ protected
6
+
7
+ def header
8
+ super.merge!(
9
+ {
10
+ 'Saferpay-ApiVersion' => SixSaferpay::API::VERSION,
11
+ 'Saferpay-RequestId' => request_id()
12
+ }
13
+ )
14
+ end
15
+
16
+ private
17
+
18
+ def request_id
19
+ @request_id ||= SecureRandom.uuid
20
+ end
21
+ end
22
+ end
23
+ end
@@ -8,7 +8,7 @@ module SixSaferpay
8
8
  :gender,
9
9
  :legal_form,
10
10
  :street,
11
- :street_2,
11
+ :street2,
12
12
  :zip,
13
13
  :city,
14
14
  :country_subdevision_code,
@@ -25,7 +25,7 @@ module SixSaferpay
25
25
  gender: nil,
26
26
  legal_form: nil,
27
27
  street: nil,
28
- street_2: nil,
28
+ street2: nil,
29
29
  zip: nil,
30
30
  city: nil,
31
31
  country_subdevision_code: nil,
@@ -40,7 +40,7 @@ module SixSaferpay
40
40
  @gender = gender
41
41
  @legal_form = legal_form
42
42
  @street = street
43
- @street_2 = street_2
43
+ @street2 = street2
44
44
  @zip = zip
45
45
  @city = city
46
46
  @country_subdevision_code = country_subdevision_code
@@ -58,7 +58,7 @@ module SixSaferpay
58
58
  hash.merge!(gender: @gender) if @gender
59
59
  hash.merge!(legal_form: @legal_form) if @legal_form
60
60
  hash.merge!(street: @street) if @street
61
- hash.merge!(street_2: @street_2) if @street_2
61
+ hash.merge!(street2: @street2) if @street2.present?
62
62
  hash.merge!(zip: @zip) if @zip
63
63
  hash.merge!(city: @city) if @city
64
64
  hash.merge!(country_subdevision_code: @country_subdevision_code) if @country_subdevision_code
@@ -0,0 +1,22 @@
1
+ module SixSaferpay
2
+ class Alias
3
+
4
+ attr_accessor(:id,
5
+ :lifetime)
6
+
7
+ def initialize(id:,
8
+ lifetime: )
9
+ @id = id
10
+ @lifetime = lifetime
11
+ end
12
+
13
+ def to_hash
14
+ hash = Hash.new
15
+ hash.merge!(id: @id) if @id
16
+ hash.merge!(lifetime: @lifetime) if @lifetime
17
+ hash
18
+ end
19
+ alias_method :to_h, :to_hash
20
+
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class AliasCard
3
+
4
+ attr_accessor(:exp_year, :exp_month)
5
+
6
+ def initialize(exp_year:, exp_month:)
7
+ @exp_year = exp_year
8
+ @exp_month = exp_month
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(exp_year: @exp_year)
14
+ hash.merge!(exp_month: @exp_month)
15
+ hash
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end
@@ -0,0 +1,36 @@
1
+ module SixSaferpay
2
+ class Authentication
3
+
4
+ attr_accessor(
5
+ :result,
6
+ :message,
7
+ :xid,
8
+ :exemption,
9
+ :three_ds_challenge
10
+ )
11
+
12
+ def initialize(result: nil, # ATTENTION: This is in some case mandatory
13
+ message: nil, # ATTENTION: This is in some case mandatory
14
+ xid: nil,
15
+ exemption: nil,
16
+ three_ds_challenge: nil)
17
+ @result = result
18
+ @message = message
19
+ @xid = xid
20
+ @exemption = exemption
21
+ @three_ds_challenge = three_ds_challenge
22
+ end
23
+
24
+ def to_hash
25
+ hash = Hash.new
26
+ hash.merge!(result: @result) if @result
27
+ hash.merge!(message: @message) if @message
28
+ hash.merge!(xid: @xid) if @xid
29
+ hash.merge!(exemption: @exemption) if @exemption
30
+ hash.merge!(three_ds_challenge: @three_ds_challenge) if @three_ds_challenge
31
+ hash
32
+ end
33
+ alias_method :to_h, :to_hash
34
+
35
+ end
36
+ end
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class AuthenticationResult
3
+
4
+ attr_accessor :result, :message
5
+
6
+ def initialize(result:, message:)
7
+ @result = result
8
+ @message = message
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(result: @result)
14
+ hash.merge!(message: @message)
15
+ hash
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class Bancontact
3
+
4
+ attr_accessor :qr_code_data, :intent_url
5
+
6
+ def initialize(qr_code_data: nil, intent_url: nil)
7
+ @qr_code_data = qr_code_data
8
+ @intent_url = intent_url
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(qr_code_data: @qr_code_data) if @qr_code_data
14
+ hash.merge!(intent_url: @intent_url) if @intent_url
15
+ hash
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ module SixSaferpay
2
+ class Bankcontact
3
+
4
+ attr_accessor(:app_default_redirect_url,
5
+ :app_completion_redirect_url)
6
+
7
+ def initialize(app_default_redirect_url: nil, app_completion_redirect_url: nil)
8
+ @app_default_redirect_url = app_default_redirect_url
9
+ @app_completion_redirect_url = app_completion_redirect_url
10
+ end
11
+
12
+ def to_hash
13
+ hash = Hash.new
14
+ hash.merge!(app_default_redirect_url: @app_default_redirect_url) if @app_default_redirect_url
15
+ hash.merge!(app_completion_redirect_url: @app_completion_redirect_url) if @app_completion_redirect_url
16
+ hash
17
+ end
18
+ alias_method :to_h, :to_hash
19
+
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ module SixSaferpay
2
+ class Check
3
+
4
+ attr_accessor(:type,
5
+ :terminal_id
6
+ )
7
+
8
+ def initialize(type:, terminal_id:)
9
+ @type = type
10
+ @terminal_id = terminal_id
11
+ end
12
+
13
+ def to_hash
14
+ hash = Hash.new
15
+ hash.merge!(type: @type) if @type
16
+ hash.merge!(terminal_id: @terminal_id) if @terminal_id
17
+ hash
18
+ end
19
+ alias_method :to_h, :to_hash
20
+
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ module SixSaferpay
2
+ class CheckResult
3
+
4
+ attr_accessor(:result,
5
+ :message,
6
+ :authentication
7
+ )
8
+
9
+ def initialize(result:,
10
+ message: ,
11
+ authentication: nil)
12
+ @result = result
13
+ @message = message
14
+ @authentication = authentication
15
+ end
16
+
17
+ def to_hash
18
+ hash = Hash.new
19
+ hash.merge!(result: @result) if @result
20
+ hash.merge!(message: @message) if @message
21
+ hash.merge!(authentication: @authentication.to_h) if @authentication
22
+ hash
23
+ end
24
+ alias_method :to_h, :to_hash
25
+
26
+ end
27
+ end
@@ -0,0 +1,62 @@
1
+ module SixSaferpay
2
+ class ChosenPlan
3
+
4
+ attr_accessor(
5
+ :minimum_number_of_installments,
6
+ :maximum_number_of_installments,
7
+ :interest_rate,
8
+ :installment_fee,
9
+ :annual_percentage_rate,
10
+ :total_amount_due,
11
+ )
12
+
13
+ def initialize(
14
+ minimum_number_of_installments: ,
15
+ maximum_number_of_installments: ,
16
+ interest_rate: nil,
17
+ installment_fee: nil,
18
+ annual_percentage_rate: nil,
19
+ total_amount_due: nil
20
+ )
21
+ @minimum_number_of_installments =
22
+ minimum_number_of_installments
23
+ @maximum_number_of_installments =
24
+ maximum_number_of_installments
25
+ @interest_rate = interest_rate
26
+ if installment_fee
27
+ @installment_fee = SixSaferpay::InstallmentFee
28
+ .new(installment_fee.to_h)
29
+ end
30
+ if annual_percentage_rate
31
+ @annual_percentage_rate = annual_percentage_rate
32
+ end
33
+ if total_amount_due
34
+ @total_amount_due = SixSaferpay::TotalAmountDue
35
+ .new(total_amount_due.to_h)
36
+ end
37
+ end
38
+
39
+ def to_hash
40
+ hash = Hash.new
41
+ hash.merge!(minimum_number_of_installments:
42
+ @minimum_number_of_installments)
43
+ hash.merge!(maximum_number_of_installments:
44
+ @maximum_number_of_installments)
45
+ if @interest_rate
46
+ hash.merge!(interest_rate: @interest_rate)
47
+ end
48
+ if @installment_fee
49
+ hash.merge!(installment_fee: @installment_fee.to_h)
50
+ end
51
+ if @annual_percentage_rate
52
+ hash.merge!(annual_percentage_rate: @annual_percentage_rate)
53
+ end
54
+ if @total_amount_due
55
+ hash.merge!(total_amount_due: @total_amount_due.to_h)
56
+ end
57
+ hash
58
+ end
59
+ alias_method :to_h, :to_hash
60
+
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module SixSaferpay
2
+ class CustomPlan < ChosenPlan
3
+ end
4
+ end
@@ -1,28 +0,0 @@
1
- module SixSaferpay
2
- class RegistrationError
3
-
4
- attr_accessor(:success,
5
- :fd_alias,
6
- :error
7
- )
8
-
9
-
10
- def initialize(success:,
11
- fd_alias: nil,
12
- error: nil)
13
-
14
- binding.pry
15
- @success = success
16
- @fd_alias = SixSaferpay::RegistrationAlias.new(fd_alias.to_h) if fd_alias
17
- @error = SixSaferpay::RegistrationError.new(error.to_h) if error
18
- end
19
-
20
- def to_hash
21
- hash = Hash.new
22
- hash.merge!(sucess: @sucess) if @success
23
- hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
24
- hash.merge!(error: @error.to_h) if @error
25
- end
26
-
27
- end
28
- end
@@ -0,0 +1,4 @@
1
+ module SixSaferpay
2
+ class FirstInstallmentAmount < Amount
3
+ end
4
+ end
@@ -0,0 +1,18 @@
1
+ module SixSaferpay
2
+ class Ideal
3
+
4
+ attr_accessor(:issuer_id)
5
+
6
+ def initialize(issuer_id:)
7
+ @issuer_id = issuer_id
8
+ end
9
+
10
+ def to_hash
11
+ hash = Hash.new
12
+ hash.merge!(issuer_id: @issuer_id) if @issuer_id
13
+ hash
14
+ end
15
+ alias_method :to_h, :to_hash
16
+
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ module SixSaferpay
2
+ class InstallmentFee < Amount
3
+ end
4
+ end
@@ -0,0 +1,73 @@
1
+ module SixSaferpay
2
+ class InstallmentPlans
3
+
4
+ attr_accessor(
5
+ :number_of_installments,
6
+ :interest_rate,
7
+ :installment_fee,
8
+ :annual_percentage_rate,
9
+ :first_installment_amount,
10
+ :subsequent_installment_amount,
11
+ :total_amount_due
12
+ )
13
+
14
+ def initialize(
15
+ number_of_installments: ,
16
+ interest_rate: nil,
17
+ installment_fee: nil,
18
+ annual_percentage_rate: nil,
19
+ first_installment_amount: nil,
20
+ subsequent_installment_amount: nil,
21
+ total_amount_due: nil
22
+ )
23
+ @number_of_installments = number_of_installments
24
+ @interest_rate = interest_rate
25
+ if installment_fee
26
+ @installment_fee = SixSaferpay::InstallmentFee
27
+ .new(installment_fee.to_h)
28
+ end
29
+ if annual_percentage_rate
30
+ @annual_percentage_rate = annual_percentage_rate
31
+ end
32
+ if first_installment_amount
33
+ @first_installment_amount = SixSaferpay::FirstInstallmentAmount
34
+ .new(first_installment_amount.to_h)
35
+ end
36
+ if subsequent_installment_amount
37
+ @subsequent_installment_amount = SixSaferpay::SubsequentInstallmentAmount
38
+ .new(subsequent_installment_amount.to_h)
39
+ end
40
+ if total_amount_due
41
+ @total_amount_due = SixSaferpay::TotalAmountDue
42
+ .new(total_amount_due.to_h)
43
+ end
44
+ end
45
+
46
+ def to_hash
47
+ hash = Hash.new
48
+ hash.merge!(number_of_installments: @number_of_installments)
49
+ if @interest_rate
50
+ hash.merge!(interest_rate: @interest_rate)
51
+ end
52
+ if @installment_fee
53
+ hash.merge!(installment_fee: @installment_fee.to_h)
54
+ end
55
+ if @annual_percentage_rate
56
+ hash.merge!(annual_percentage_rate: @annual_percentage_rate)
57
+ end
58
+ if @first_installment_amount
59
+ hash.merge!(first_installment_amount: @first_installment_amount.to_h)
60
+ end
61
+ if @subsequent_installment_amount
62
+ hash.merge!(subsequent_installment_amount: @subsequent_installment_amount.to_h)
63
+ end
64
+ if @total_amount_due
65
+ hash.merge!(total_amount_due: @total_amount_due.to_h)
66
+ end
67
+ hash
68
+ end
69
+ alias_method :to_h, :to_hash
70
+
71
+ end
72
+ end
73
+