six_saferpay 2.3.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +17 -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/alternative_payment.rb +11 -2
  19. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  20. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  21. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  22. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +14 -2
  23. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  24. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +17 -3
  25. data/lib/six_saferpay/models/authentication.rb +36 -0
  26. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  27. data/lib/six_saferpay/models/card_form.rb +11 -2
  28. data/lib/six_saferpay/models/check_result.rb +6 -2
  29. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  30. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  31. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  32. data/lib/six_saferpay/models/fraud_prevention.rb +24 -0
  33. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  34. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  35. data/lib/six_saferpay/models/items.rb +84 -0
  36. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  37. data/lib/six_saferpay/models/order.rb +27 -0
  38. data/lib/six_saferpay/models/payer.rb +8 -2
  39. data/lib/six_saferpay/models/payer_profile.rb +105 -0
  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
@@ -6,7 +6,8 @@ module SixSaferpay
6
6
  :transaction,
7
7
  :payment_means,
8
8
  :payer,
9
- :registration_result
9
+ :registration_result,
10
+ :mastercard_issuer_installments
10
11
  )
11
12
 
12
13
 
@@ -14,13 +15,18 @@ module SixSaferpay
14
15
  transaction:,
15
16
  payment_means:,
16
17
  payer: nil,
17
- registration_result: nil
18
+ registration_result: nil,
19
+ mastercard_issuer_installments: nil
18
20
  )
19
21
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
20
22
  @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
21
23
  @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h) if payment_means
22
24
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
25
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
26
+ if mastercard_issuer_installments
27
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
28
+ .new(mastercard_issuer_installments.to_h)
29
+ end
24
30
  end
25
31
 
26
32
  def to_hash
@@ -30,6 +36,9 @@ module SixSaferpay
30
36
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
31
37
  hash.merge!(payer: @payer.to_h) if @payer
32
38
  hash.merge!(registration_result: @registration_result.to_h) if @registration_result
39
+ if @mastercard_issuer_installments
40
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
41
+ end
33
42
  hash
34
43
  end
35
44
  alias_method :to_h, :to_hash
@@ -8,7 +8,9 @@ module SixSaferpay
8
8
  :payer,
9
9
  :registration_result,
10
10
  :liability,
11
- :dcc
11
+ :dcc,
12
+ :mastercard_issuer_installments,
13
+ :fraud_prevention,
12
14
  )
13
15
 
14
16
 
@@ -18,8 +20,9 @@ module SixSaferpay
18
20
  payer: nil,
19
21
  registration_result: nil,
20
22
  liability: nil,
21
- dcc: nil
22
-
23
+ dcc: nil,
24
+ mastercard_issuer_installments: nil,
25
+ fraud_prevention: nil
23
26
  )
24
27
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
25
28
  @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
@@ -28,6 +31,11 @@ module SixSaferpay
28
31
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
29
32
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
30
33
  @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
34
+ if mastercard_issuer_installments
35
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
36
+ .new(mastercard_issuer_installments.to_h)
37
+ end
38
+ @fraud_prevention = SixSaferpay::FraudPrevention.new(fraud_prevention.to_h) if fraud_prevention
31
39
  end
32
40
 
33
41
  def to_hash
@@ -39,6 +47,12 @@ module SixSaferpay
39
47
  hash.merge!(registration_result: @registration_result.to_h) if @registration_result
40
48
  hash.merge!(liability: @liability.to_h) if @liability
41
49
  hash.merge!(dcc: @dcc.to_h) if @dcc
50
+ if @mastercard_issuer_installments
51
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
52
+ end
53
+ if @fraud_prevention
54
+ hash.merge!(fraud_prevention: fraud_prevention.to_h)
55
+ end
42
56
  hash
43
57
  end
44
58
  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,24 @@
1
+ module SixSaferpay
2
+ class FraudPrevention
3
+
4
+ attr_accessor(
5
+ :result,
6
+ )
7
+
8
+ def initialize(
9
+ result: nil
10
+ )
11
+ @result = result
12
+ end
13
+
14
+ def to_hash
15
+ hash = Hash.new
16
+ if @result
17
+ hash.merge!(result: @result)
18
+ end
19
+ hash
20
+ end
21
+ alias_method :to_h, :to_hash
22
+
23
+ end
24
+ 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