six_saferpay 2.2.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +4 -2
  4. data/Gemfile.lock +77 -82
  5. data/README.md +3 -2
  6. data/Thorfile +1 -0
  7. data/lib/generators/models.rb +100 -0
  8. data/lib/generators/templates/fabric.erb +13 -0
  9. data/lib/generators/templates/model.erb +64 -0
  10. data/lib/generators/templates/spec.erb +24 -0
  11. data/lib/six_saferpay.rb +5 -0
  12. data/lib/six_saferpay/api.rb +1 -1
  13. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +14 -2
  14. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  15. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
  16. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
  17. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +6 -2
  18. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  19. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  20. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  21. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +14 -2
  22. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  23. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  24. data/lib/six_saferpay/models/authentication.rb +36 -0
  25. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  26. data/lib/six_saferpay/models/card_form.rb +11 -2
  27. data/lib/six_saferpay/models/check_result.rb +6 -2
  28. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  29. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  30. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  31. data/lib/six_saferpay/models/ideal.rb +18 -0
  32. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  33. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  34. data/lib/six_saferpay/models/items.rb +84 -0
  35. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  36. data/lib/six_saferpay/models/order.rb +27 -0
  37. data/lib/six_saferpay/models/payer.rb +8 -2
  38. data/lib/six_saferpay/models/payer_profile.rb +105 -0
  39. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  40. data/lib/six_saferpay/models/phone.rb +36 -0
  41. data/lib/six_saferpay/models/registration_result.rb +11 -2
  42. data/lib/six_saferpay/models/risk_factors.rb +39 -0
  43. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  44. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  45. data/lib/six_saferpay/version.rb +1 -1
  46. data/six_saferpay.gemspec +9 -8
  47. metadata +58 -24
@@ -8,7 +8,8 @@ module SixSaferpay
8
8
  :payer,
9
9
  :registration_result,
10
10
  :liability,
11
- :dcc
11
+ :dcc,
12
+ :mastercard_issuer_installments
12
13
  )
13
14
 
14
15
 
@@ -18,8 +19,8 @@ module SixSaferpay
18
19
  payer: nil,
19
20
  registration_result: nil,
20
21
  liability: nil,
21
- dcc: nil
22
-
22
+ dcc: nil,
23
+ mastercard_issuer_installments: nil
23
24
  )
24
25
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
25
26
  @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
@@ -28,6 +29,10 @@ module SixSaferpay
28
29
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
29
30
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
30
31
  @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
32
+ if mastercard_issuer_installments
33
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
34
+ .new(mastercard_issuer_installments.to_h)
35
+ end
31
36
  end
32
37
 
33
38
  def to_hash
@@ -39,6 +44,9 @@ module SixSaferpay
39
44
  hash.merge!(registration_result: @registration_result.to_h) if @registration_result
40
45
  hash.merge!(liability: @liability.to_h) if @liability
41
46
  hash.merge!(dcc: @dcc.to_h) if @dcc
47
+ if @mastercard_issuer_installments
48
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
49
+ end
42
50
  hash
43
51
  end
44
52
  alias_method :to_h, :to_hash
@@ -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
@@ -1,15 +1,24 @@
1
1
  module SixSaferpay
2
2
  class CardForm
3
3
 
4
- attr_accessor(:holder_name)
4
+ attr_accessor(
5
+ :holder_name,
6
+ :verification_code
7
+ )
5
8
 
6
- def initialize(holder_name: nil)
9
+ def initialize(
10
+ holder_name: nil,
11
+ verification_code: nil
12
+ )
7
13
  @holder_name = holder_name
14
+ @verification_code = verification_code
15
+
8
16
  end
9
17
 
10
18
  def to_hash
11
19
  hash = Hash.new
12
20
  hash.merge!(holder_name: @holder_name) if @holder_name
21
+ hash.merge!(verification_code: @verification_code) if @verification_code
13
22
  hash
14
23
  end
15
24
  alias_method :to_h, :to_hash
@@ -2,19 +2,23 @@ module SixSaferpay
2
2
  class CheckResult
3
3
 
4
4
  attr_accessor(:result,
5
- :message
5
+ :message,
6
+ :authentication
6
7
  )
7
8
 
8
9
  def initialize(result:,
9
- message: )
10
+ message: ,
11
+ authentication: nil)
10
12
  @result = result
11
13
  @message = message
14
+ @authentication = authentication
12
15
  end
13
16
 
14
17
  def to_hash
15
18
  hash = Hash.new
16
19
  hash.merge!(result: @result) if @result
17
20
  hash.merge!(message: @message) if @message
21
+ hash.merge!(authentication: @authentication.to_h) if @authentication
18
22
  hash
19
23
  end
20
24
  alias_method :to_h, :to_hash
@@ -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
@@ -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
+
@@ -0,0 +1,84 @@
1
+ module SixSaferpay
2
+ class Items
3
+
4
+ attr_accessor(
5
+ :type,
6
+ :id,
7
+ :variant_id,
8
+ :name,
9
+ :category_name,
10
+ :description,
11
+ :quantity,
12
+ :unit_price,
13
+ :is_pre_order,
14
+ :tax_amount,
15
+ :discount_amount,
16
+ )
17
+
18
+ def initialize(
19
+ type: nil,
20
+ id: nil,
21
+ variant_id: nil,
22
+ name: nil,
23
+ category_name: nil,
24
+ description: nil,
25
+ quantity: nil,
26
+ unit_price: nil,
27
+ is_pre_order: nil,
28
+ tax_amount: nil,
29
+ discount_amount: nil
30
+ )
31
+ @type = type
32
+ @id = id
33
+ @variant_id = variant_id
34
+ @name = name
35
+ @category_name = category_name
36
+ @description = description
37
+ @quantity = quantity
38
+ @unit_price = unit_price
39
+ @is_pre_order = is_pre_order
40
+ @tax_amount = tax_amount
41
+ @discount_amount = discount_amount
42
+ end
43
+
44
+ def to_hash
45
+ hash = Hash.new
46
+ if @type
47
+ hash.merge!(type: @type)
48
+ end
49
+ if @id
50
+ hash.merge!(id: @id)
51
+ end
52
+ if @variant_id
53
+ hash.merge!(variant_id: @variant_id)
54
+ end
55
+ if @name
56
+ hash.merge!(name: @name)
57
+ end
58
+ if @category_name
59
+ hash.merge!(category_name: @category_name)
60
+ end
61
+ if @description
62
+ hash.merge!(description: @description)
63
+ end
64
+ if @quantity
65
+ hash.merge!(quantity: @quantity)
66
+ end
67
+ if @unit_price
68
+ hash.merge!(unit_price: @unit_price)
69
+ end
70
+ if !@is_pre_order.nil?
71
+ hash.merge!(is_pre_order: @is_pre_order)
72
+ end
73
+ if @tax_amount
74
+ hash.merge!(tax_amount: @tax_amount)
75
+ end
76
+ if @discount_amount
77
+ hash.merge!(discount_amount: @discount_amount)
78
+ end
79
+ hash
80
+ end
81
+ alias_method :to_h, :to_hash
82
+
83
+ end
84
+ end
@@ -0,0 +1,49 @@
1
+ module SixSaferpay
2
+ class MastercardIssuerInstallments
3
+
4
+ attr_accessor(
5
+ :installment_plans,
6
+ :custom_plan,
7
+ :chosen_plan,
8
+ :receipt_free_text
9
+ )
10
+
11
+ def initialize(
12
+ installment_plans: nil,
13
+ custom_plan: nil,
14
+ chosen_plan: nil,
15
+ receipt_free_text: nil
16
+ )
17
+ if installment_plans
18
+ @installment_plans = SixSaferpay::InstallmentPlans
19
+ .new(installment_plans.to_h)
20
+ end
21
+ if custom_plan
22
+ @custom_plan = SixSaferpay::CustomPlan
23
+ .new(custom_plan)
24
+ end
25
+ if chosen_plan
26
+ @chosen_plan = SixSaferpay::ChosenPlan
27
+ .new(chosen_plan.to_h)
28
+ end
29
+ @receipt_free_text = receipt_free_text
30
+ end
31
+
32
+ def to_hash
33
+ hash = Hash.new
34
+ if @installment_plans
35
+ hash.merge!(installment_plans: @installment_plans.to_h)
36
+ end
37
+ if @custom_plan
38
+ hash.merge!(custom_plan: @custom_plan.to_h)
39
+ end
40
+ if @chosen_plan
41
+ hash.merge!(chosen_plan: @chosen_plan.to_h)
42
+ end
43
+ hash.merge!(receipt_free_text: @receipt_free_text)
44
+ hash
45
+ end
46
+ alias_method :to_h, :to_hash
47
+
48
+ end
49
+ end