six_saferpay 2.4.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -2
  3. data/README.md +2 -2
  4. data/Thorfile +1 -0
  5. data/lib/generators/models.rb +100 -0
  6. data/lib/generators/templates/fabric.erb +13 -0
  7. data/lib/generators/templates/model.erb +64 -0
  8. data/lib/generators/templates/spec.erb +24 -0
  9. data/lib/six_saferpay.rb +5 -0
  10. data/lib/six_saferpay/api.rb +1 -1
  11. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +10 -2
  12. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +8 -2
  13. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
  14. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
  15. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +6 -2
  16. data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +11 -2
  17. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +10 -2
  18. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +10 -2
  19. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +10 -2
  20. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +8 -2
  21. data/lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb +11 -2
  22. data/lib/six_saferpay/models/card_form.rb +11 -2
  23. data/lib/six_saferpay/models/fraud_prevention.rb +24 -0
  24. data/lib/six_saferpay/models/items.rb +84 -0
  25. data/lib/six_saferpay/models/options.rb +15 -3
  26. data/lib/six_saferpay/models/order.rb +27 -0
  27. data/lib/six_saferpay/models/payer.rb +8 -2
  28. data/lib/six_saferpay/models/payer_profile.rb +105 -0
  29. data/lib/six_saferpay/models/phone.rb +36 -0
  30. data/lib/six_saferpay/models/risk_factors.rb +39 -0
  31. data/lib/six_saferpay/version.rb +1 -1
  32. data/six_saferpay.gemspec +3 -2
  33. metadata +31 -12
@@ -6,14 +6,16 @@ module SixSaferpay
6
6
  :expiration_date,
7
7
  :config_set,
8
8
  :payer,
9
- :billing_address_form
9
+ :billing_address_form,
10
+ :register_alias,
10
11
  )
11
12
 
12
13
  def initialize(payment: ,
13
14
  expiration_date: ,
14
15
  config_set: nil,
15
16
  payer: ,
16
- billing_address_form: nil
17
+ billing_address_form: nil,
18
+ register_alias: nil
17
19
  )
18
20
 
19
21
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
@@ -22,6 +24,7 @@ module SixSaferpay
22
24
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
25
  @billing_address_form =
24
26
  SixSaferpay::BillingAddressForm.new(billing_address_form) if billing_address_form
27
+ @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
25
28
  end
26
29
 
27
30
  def to_hash
@@ -31,6 +34,7 @@ module SixSaferpay
31
34
  hash.merge!(config_set: @config_set) if @config_set
32
35
  hash.merge!(payer: @payer.to_h) if @payer
33
36
  hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
37
+ hash.merge!(register_alias: @register_alias.to_h) if @register_alias
34
38
  hash
35
39
  end
36
40
  alias_method :to_h, :to_hash
@@ -8,7 +8,9 @@ module SixSaferpay
8
8
  :payment_method,
9
9
  :payment_method_options,
10
10
  :payer,
11
- :notification
11
+ :notification,
12
+ :order,
13
+ :risk_factors,
12
14
  )
13
15
 
14
16
 
@@ -19,7 +21,10 @@ module SixSaferpay
19
21
  payment_method:,
20
22
  payment_method_options: nil,
21
23
  payer: nil,
22
- notification: )
24
+ notification:,
25
+ order: nil,
26
+ risk_factors: nil
27
+ )
23
28
  @request_header = request_header || SixSaferpay::RequestHeader.new()
24
29
  @terminal_id = terminal_id
25
30
  @payment = SixSaferpay::Payment.new(payment.to_h)
@@ -27,6 +32,8 @@ module SixSaferpay
27
32
  @payment_method_options = SixSaferpay::PaymentMethodOptions.new(payment_method_options.to_h) if payment_method_options
28
33
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
29
34
  @notification = SixSaferpay::Notification.new(notification.to_h)
35
+ @order = SixSaferpay::Order.new(order.to_h) if order
36
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
30
37
  end
31
38
 
32
39
  def to_hash
@@ -38,6 +45,8 @@ module SixSaferpay
38
45
  hash.merge!(payment_method_options: @payment_method_options.to_h) if @payment_method_options
39
46
  hash.merge!(payer: @payer.to_h) if @payer
40
47
  hash.merge!(notification: @notification.to_h)
48
+ hash.merge!(order: @order.to_h) if @order
49
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
41
50
  hash
42
51
  end
43
52
  alias_method :to_h, :to_hash
@@ -8,7 +8,9 @@ module SixSaferpay
8
8
  :payment_means,
9
9
  :authentication,
10
10
  :register_alias,
11
- :payer
11
+ :payer,
12
+ :order,
13
+ :risk_factors
12
14
  )
13
15
 
14
16
 
@@ -18,7 +20,9 @@ module SixSaferpay
18
20
  payment_means:,
19
21
  authentication: nil,
20
22
  register_alias: nil,
21
- payer: nil
23
+ payer: nil,
24
+ order: nil,
25
+ risk_factors: nil
22
26
  )
23
27
  @request_header = request_header || SixSaferpay::RequestHeader.new()
24
28
  @terminal_id = SixSaferpay.config.terminal_id || terminal_id
@@ -27,6 +31,8 @@ module SixSaferpay
27
31
  @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
28
32
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
29
33
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
34
+ @order = SixSaferpay::Order.new(order.to_h) if order
35
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
30
36
  end
31
37
 
32
38
  def to_hash
@@ -38,6 +44,8 @@ module SixSaferpay
38
44
  hash.merge!(authentication: @authentication.to_h) if @authentication
39
45
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
40
46
  hash.merge!(payer: @payer.to_h) if @payer
47
+ hash.merge!(order: @order.to_h) if @order
48
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
41
49
  hash
42
50
  end
43
51
  alias_method :to_h, :to_hash
@@ -14,7 +14,9 @@ module SixSaferpay
14
14
  :styling,
15
15
  :wallet,
16
16
  :payment_methods,
17
- :card_form
17
+ :card_form,
18
+ :order,
19
+ :risk_factors
18
20
  )
19
21
 
20
22
 
@@ -29,7 +31,9 @@ module SixSaferpay
29
31
  styling: nil,
30
32
  wallet: nil,
31
33
  payment_methods: nil,
32
- card_form: nil
34
+ card_form: nil,
35
+ order: nil,
36
+ risk_factors: nil
33
37
  )
34
38
  @request_header = request_header || SixSaferpay::RequestHeader.new()
35
39
  @config_set = config_set
@@ -43,6 +47,8 @@ module SixSaferpay
43
47
  @wallet = SixSaferpay::Wallet.new(wallet.to_h) if wallet
44
48
  @payment_methods = payment_methods
45
49
  @card_form = SixSaferpay::CardForm.new(card_form.to_h) if card_form
50
+ @order = SixSaferpay::Order.new(order.to_h) if order
51
+ @risk_factors = SixSaferpay::RiskFactors.new(risk_factors.to_h) if risk_factors
46
52
  end
47
53
 
48
54
  def to_hash
@@ -59,6 +65,8 @@ module SixSaferpay
59
65
  hash.merge!(wallet: @wallet.to_h) if @wallet
60
66
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
61
67
  hash.merge!(card_form: @card_form.to_h) if @card_form
68
+ hash.merge!(order: @order.to_h) if @order
69
+ hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
62
70
  hash
63
71
  end
64
72
  alias_method :to_h, :to_hash
@@ -7,7 +7,8 @@ module SixSaferpay
7
7
  :payment_means,
8
8
  :payer,
9
9
  :registration_result,
10
- :mastercard_issuer_installments
10
+ :mastercard_issuer_installments,
11
+ :fraud_prevention
11
12
  )
12
13
 
13
14
 
@@ -16,7 +17,8 @@ module SixSaferpay
16
17
  payment_means:,
17
18
  payer: nil,
18
19
  registration_result: nil,
19
- mastercard_issuer_installments: nil
20
+ mastercard_issuer_installments: nil,
21
+ fraud_prevention: nil
20
22
  )
21
23
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
22
24
  @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
@@ -27,6 +29,9 @@ module SixSaferpay
27
29
  @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
28
30
  .new(mastercard_issuer_installments.to_h)
29
31
  end
32
+ if fraud_prevention
33
+ @fraud_prevention = SixSaferpay::FraudPrevention.new(fraud_prevention.to_h)
34
+ end
30
35
  end
31
36
 
32
37
  def to_hash
@@ -39,6 +44,9 @@ module SixSaferpay
39
44
  if @mastercard_issuer_installments
40
45
  hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
41
46
  end
47
+ if @fraud_prevention
48
+ hash.merge!(fraud_prevention: fraud_prevention.to_h)
49
+ end
42
50
  hash
43
51
  end
44
52
  alias_method :to_h, :to_hash
@@ -9,7 +9,8 @@ module SixSaferpay
9
9
  :registration_result,
10
10
  :liability,
11
11
  :dcc,
12
- :mastercard_issuer_installments
12
+ :mastercard_issuer_installments,
13
+ :fraud_prevention,
13
14
  )
14
15
 
15
16
 
@@ -20,7 +21,8 @@ module SixSaferpay
20
21
  registration_result: nil,
21
22
  liability: nil,
22
23
  dcc: nil,
23
- mastercard_issuer_installments: nil
24
+ mastercard_issuer_installments: nil,
25
+ fraud_prevention: nil
24
26
  )
25
27
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
26
28
  @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
@@ -33,6 +35,7 @@ module SixSaferpay
33
35
  @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
34
36
  .new(mastercard_issuer_installments.to_h)
35
37
  end
38
+ @fraud_prevention = SixSaferpay::FraudPrevention.new(fraud_prevention.to_h) if fraud_prevention
36
39
  end
37
40
 
38
41
  def to_hash
@@ -47,6 +50,9 @@ module SixSaferpay
47
50
  if @mastercard_issuer_installments
48
51
  hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
49
52
  end
53
+ if @fraud_prevention
54
+ hash.merge!(fraud_prevention: fraud_prevention.to_h)
55
+ end
50
56
  hash
51
57
  end
52
58
  alias_method :to_h, :to_hash
@@ -6,14 +6,17 @@ module SixSaferpay
6
6
  :transaction,
7
7
  :payment_means,
8
8
  :payer,
9
- :liability
9
+ :liability,
10
+ :fraud_prevention
10
11
  )
11
12
 
12
13
  def initialize(response_header: ,
13
14
  transaction: ,
14
15
  payment_means: ,
15
16
  payer: nil,
16
- liability: nil)
17
+ liability: nil,
18
+ fraud_prevention: nil
19
+ )
17
20
 
18
21
 
19
22
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
@@ -21,6 +24,9 @@ module SixSaferpay
21
24
  @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h)
22
25
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
26
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
27
+ if fraud_prevention
28
+ @fraud_prevention = SixSaferpay::FraudPrevention.new(fraud_prevention.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!(liability: @liability.to_h) if @liability
39
+ if @fraud_prevention
40
+ hash.merge!(fraud_prevention: fraud_prevention.to_h)
41
+ end
33
42
  hash
34
43
  end
35
44
  alias_method :to_h, :to_hash
@@ -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
@@ -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,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
@@ -1,15 +1,27 @@
1
1
  module SixSaferpay
2
2
  class Options
3
3
 
4
- attr_accessor :pre_auth
4
+ attr_accessor(
5
+ :pre_auth,
6
+ :allow_partial_authorization,
7
+ )
5
8
 
6
- def initialize(pre_auth: nil)
9
+ def initialize(
10
+ pre_auth: nil,
11
+ allow_partial_authorization: nil
12
+ )
7
13
  @pre_auth = pre_auth
14
+ @allow_partial_authorization = allow_partial_authorization
8
15
  end
9
16
 
10
17
  def to_hash
11
18
  hash = Hash.new
12
- hash.merge!(pre_auth: @pre_auth) if !@pre_auth.nil?
19
+ if !@pre_auth.nil?
20
+ hash.merge!(pre_auth: @pre_auth)
21
+ end
22
+ if !@allow_partial_authorization.nil?
23
+ hash.merge!(allow_partial_authorization: @allow_partial_authorization)
24
+ end
13
25
  hash
14
26
  end
15
27
  alias_method :to_h, :to_hash
@@ -0,0 +1,27 @@
1
+ module SixSaferpay
2
+ class Order
3
+
4
+ attr_accessor(
5
+ :items,
6
+ )
7
+
8
+ def initialize(
9
+ items: nil
10
+ )
11
+
12
+ if items
13
+ @items = SixSaferpay::Items.new(items.to_h)
14
+ end
15
+ end
16
+
17
+ def to_hash
18
+ hash = Hash.new
19
+ if @items
20
+ hash.merge!(items: @items.to_h)
21
+ end
22
+ hash
23
+ end
24
+ alias_method :to_h, :to_hash
25
+
26
+ end
27
+ end