six_saferpay 1.5.0 → 1.16.2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) 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 +21 -3
  7. data/lib/six_saferpay/api.rb +1 -1
  8. data/lib/six_saferpay/api/six_batch/responses/close_response.rb +2 -2
  9. data/lib/six_saferpay/api/six_omni_channel/requests/insert_alias.rb +2 -2
  10. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +4 -0
  11. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  12. data/lib/six_saferpay/api/six_payment_page/responses/{initalize_response.rb → initialize_response.rb} +0 -0
  13. data/lib/six_saferpay/api/six_secure_card_data/requests/update.rb +42 -0
  14. data/lib/six_saferpay/api/six_secure_card_data/responses/update_response.rb +29 -0
  15. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +61 -0
  16. data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
  17. data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +59 -0
  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 +4 -0
  22. data/lib/six_saferpay/api/six_transaction/requests/query_alternative_payment.rb +35 -0
  23. data/lib/six_saferpay/api/six_transaction/requests/refund.rb +2 -2
  24. data/lib/six_saferpay/api/six_transaction/responses/adjust_amount_response.rb +1 -4
  25. data/lib/six_saferpay/api/six_transaction/responses/alternative_payment_response.rb +35 -0
  26. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  27. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  28. data/lib/six_saferpay/api/six_transaction/responses/cancel_response.rb +1 -1
  29. data/lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb +39 -0
  30. data/lib/six_saferpay/client.rb +8 -2
  31. data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
  32. data/lib/six_saferpay/models/address.rb +4 -4
  33. data/lib/six_saferpay/models/alias_card.rb +20 -0
  34. data/lib/six_saferpay/models/authentication.rb +36 -0
  35. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  36. data/lib/six_saferpay/models/bancontact.rb +20 -0
  37. data/lib/six_saferpay/models/bankcontact.rb +21 -0
  38. data/lib/six_saferpay/models/check_result.rb +6 -2
  39. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  40. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  41. data/lib/six_saferpay/models/error.rb +0 -28
  42. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  43. data/lib/six_saferpay/models/ideal.rb +18 -0
  44. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  45. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  46. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  47. data/lib/six_saferpay/models/notification.rb +4 -4
  48. data/lib/six_saferpay/models/payment_method_options.rb +18 -0
  49. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  50. data/lib/six_saferpay/models/pending_notification.rb +4 -4
  51. data/lib/six_saferpay/models/processing_data.rb +18 -0
  52. data/lib/six_saferpay/models/registration_result.rb +11 -2
  53. data/lib/six_saferpay/models/request_payment_means.rb +6 -2
  54. data/lib/six_saferpay/models/response_card.rb +0 -4
  55. data/lib/six_saferpay/models/saferpay_fields.rb +18 -0
  56. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  57. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  58. data/lib/six_saferpay/models/update_alias.rb +20 -0
  59. data/lib/six_saferpay/models/update_payment_means.rb +18 -0
  60. data/lib/six_saferpay/version.rb +1 -1
  61. data/six_saferpay.gemspec +8 -10
  62. metadata +52 -25
@@ -0,0 +1,61 @@
1
+ module SixSaferpay
2
+ module SixSecurePayGateOffer
3
+ class CreateOffer
4
+
5
+ attr_accessor(:payment,
6
+ :expiration_date,
7
+ :config_set,
8
+ :payer,
9
+ :billing_address_form
10
+ )
11
+
12
+ def initialize(payment: ,
13
+ expiration_date: ,
14
+ config_set: nil,
15
+ payer: ,
16
+ billing_address_form: nil
17
+ )
18
+
19
+ @payment = SixSaferpay::Payment.new(payment.to_h) if payment
20
+ @expiration_date = expiration_date
21
+ @config_set = config_set
22
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
+ @billing_address_form =
24
+ SixSaferpay::BillingAddressForm.new(billing_address_form) if billing_address_form
25
+ end
26
+
27
+ def to_hash
28
+ hash = Hash.new
29
+ hash.merge!(payment: @payment.to_h) if @payment
30
+ hash.merge!(expiration_date: @expiration_date) if @expiration_date
31
+ hash.merge!(config_set: @config_set) if @config_set
32
+ hash.merge!(payer: @payer.to_h) if @payer
33
+ hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
34
+ hash
35
+ end
36
+ alias_method :to_h, :to_hash
37
+
38
+ def to_json
39
+ to_hash.to_json
40
+ end
41
+
42
+ def url
43
+ "/rest/customers/#{customer_id}/terminals/#{terminal_id}/spg-offers"
44
+ end
45
+
46
+ def response_class
47
+ SixSaferpay::SixSecurePayGateOffer::CreateOfferResponse
48
+ end
49
+
50
+ private
51
+
52
+ def customer_id
53
+ SixSaferpay.config.customer_id
54
+ end
55
+
56
+ def terminal_id
57
+ SixSaferpay.config.terminal_id
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,26 @@
1
+ module SixSaferpay
2
+ module SixSecurePayGateOffer
3
+ class CreateOfferResponse
4
+
5
+ attr_accessor(:offer_id,
6
+ :payment_link
7
+ )
8
+
9
+ def initialize(offer_id:,
10
+ payment_link: )
11
+
12
+ @offer_id = offer_id if offer_id
13
+ @payment_link = payment_link if payment_link
14
+ end
15
+
16
+ def to_hash
17
+ hash = Hash.new
18
+ hash.merge!(offer_id: @offer_id) if @offer_id
19
+ hash.merge!(payment_link: @payment_link) if @payment_link
20
+ hash
21
+ end
22
+ alias_method :to_h, :to_hash
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,59 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class AlternativePayment
4
+
5
+ attr_accessor(:request_header,
6
+ :terminal_id,
7
+ :payment,
8
+ :payment_method,
9
+ :payment_method_options,
10
+ :payer,
11
+ :notification
12
+ )
13
+
14
+
15
+
16
+ def initialize(request_header: nil,
17
+ terminal_id:,
18
+ payment:,
19
+ payment_method:,
20
+ payment_method_options: nil,
21
+ payer: nil,
22
+ notification: )
23
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
24
+ @terminal_id = terminal_id
25
+ @payment = SixSaferpay::Payment.new(payment.to_h)
26
+ @payment_method = payment_method
27
+ @payment_method_options = SixSaferpay::PaymentMethodOptions.new(payment_method_options.to_h) if payment_method_options
28
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
29
+ @notification = SixSaferpay::Notification.new(notification.to_h)
30
+ end
31
+
32
+ def to_hash
33
+ hash = Hash.new
34
+ hash.merge!(request_header: @request_header.to_h) if @request_header
35
+ hash.merge!(terminal_id: @terminal_id)
36
+ hash.merge!(payment: @payment.to_h)
37
+ hash.merge!(payment_method: @payment_method)
38
+ hash.merge!(payment_method_options: @payment_method_options.to_h) if @payment_method_options
39
+ hash.merge!(payer: @payer.to_h) if @payer
40
+ hash.merge!(notification: @notification.to_h)
41
+ hash
42
+ end
43
+ alias_method :to_h, :to_hash
44
+
45
+ def to_json
46
+ to_hash.to_json
47
+ end
48
+
49
+ def url
50
+ '/Payment/v1/Transaction/AlternativePayment'
51
+ end
52
+
53
+ def response_class
54
+ SixSaferpay::SixTransaction::AlternativePaymentResponse
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -6,6 +6,7 @@ module SixSaferpay
6
6
  :terminal_id,
7
7
  :payment,
8
8
  :payment_means,
9
+ :authentication,
9
10
  :register_alias,
10
11
  :payer
11
12
  )
@@ -15,6 +16,7 @@ module SixSaferpay
15
16
  terminal_id: nil,
16
17
  payment:,
17
18
  payment_means:,
19
+ authentication: nil,
18
20
  register_alias: nil,
19
21
  payer: nil
20
22
  )
@@ -22,6 +24,7 @@ module SixSaferpay
22
24
  @terminal_id = SixSaferpay.config.terminal_id || terminal_id
23
25
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
24
26
  @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
27
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
25
28
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
26
29
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
27
30
  end
@@ -32,6 +35,7 @@ module SixSaferpay
32
35
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
33
36
  hash.merge!(payment: @payment.to_h) if @payment
34
37
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
38
+ hash.merge!(authentication: @authentication.to_h) if @authentication
35
39
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
36
40
  hash.merge!(payer: @payer.to_h) if @payer
37
41
  hash
@@ -6,6 +6,7 @@ module SixSaferpay
6
6
  :terminal_id,
7
7
  :payment,
8
8
  :transaction_reference,
9
+ :authentication,
9
10
  :suppress_dcc
10
11
  )
11
12
 
@@ -14,12 +15,14 @@ module SixSaferpay
14
15
  terminal_id: nil,
15
16
  payment:,
16
17
  transaction_reference:,
18
+ authentication: nil,
17
19
  suppress_dcc:
18
20
  )
19
21
  @request_header = request_header || SixSaferpay::RequestHeader.new()
20
22
  @terminal_id = terminal_id || SixSaferpay.config.terminal_id
21
23
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
22
24
  @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
25
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
23
26
  @suppress_dcc = suppress_dcc
24
27
  end
25
28
 
@@ -29,6 +32,7 @@ module SixSaferpay
29
32
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
30
33
  hash.merge!(payment: @payment.to_h) if @payment
31
34
  hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
35
+ hash.merge!(authentication: @authentication.to_h) if @authentication
32
36
  hash.merge!(suppress_dcc: @suppress_dcc) if !@suppress_dcc.nil?
33
37
  hash
34
38
  end
@@ -7,7 +7,8 @@ module SixSaferpay
7
7
  :amount,
8
8
  :billpay,
9
9
  :pending_notification,
10
- :marketplace
10
+ :marketplace,
11
+ :mastercard_issuer_installments
11
12
  )
12
13
 
13
14
 
@@ -16,7 +17,8 @@ module SixSaferpay
16
17
  amount: nil,
17
18
  billpay: nil,
18
19
  pending_notification: nil,
19
- marketplace: nil
20
+ marketplace: nil,
21
+ mastercard_issuer_installments: nil
20
22
  )
21
23
  @request_header = request_header || SixSaferpay::RequestHeader.new()
22
24
  @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
@@ -24,6 +26,10 @@ module SixSaferpay
24
26
  @billpay = SixSaferpay::Billpay.new(billpay.to_h) if billpay
25
27
  @pending_notification = SixSaferpay::PendingNotification.new(pending_notification.to_h) if pending_notification
26
28
  @marketplace = SixSaferpay::Marketplace.new(marketplace.to_h) if marketplace
29
+ if mastercard_issuer_installments
30
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
31
+ .new(mastercard_issuer_installments.to_h)
32
+ end
27
33
  end
28
34
 
29
35
  def to_hash
@@ -34,6 +40,9 @@ module SixSaferpay
34
40
  hash.merge!(billpay: @billpay.to_h) if @billpay
35
41
  hash.merge!(pending_notification: @pending_notification.to_h) if @pending_notification
36
42
  hash.merge!(marketplace: @marketplace.to_h) if @marketplace
43
+ if @mastercard_issuer_installments
44
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
45
+ end
37
46
  hash
38
47
  end
39
48
  alias_method :to_h, :to_hash
@@ -8,6 +8,7 @@ module SixSaferpay
8
8
  :terminal_id,
9
9
  :payment,
10
10
  :payment_means,
11
+ :authentication,
11
12
  :payer,
12
13
  :return_urls,
13
14
  :styling,
@@ -22,6 +23,7 @@ module SixSaferpay
22
23
  terminal_id: nil,
23
24
  payment:,
24
25
  payment_means: nil,
26
+ authentication: nil,
25
27
  payer: nil,
26
28
  return_urls: nil,
27
29
  styling: nil,
@@ -34,6 +36,7 @@ module SixSaferpay
34
36
  @terminal_id = terminal_id || SixSaferpay.config.terminal_id
35
37
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
36
38
  @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
39
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
37
40
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
38
41
  @return_urls = return_urls || SixSaferpay::ReturnUrls.new()
39
42
  @styling = SixSaferpay::Styling.new(styling.to_h) if styling
@@ -49,6 +52,7 @@ module SixSaferpay
49
52
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
50
53
  hash.merge!(payment: @payment.to_h) if @payment
51
54
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
55
+ hash.merge!(authentication: @authentication.to_h) if @authentication
52
56
  hash.merge!(payer: @payer.to_h) if @payer
53
57
  hash.merge!(return_urls: @return_urls.to_h ) if @return_urls
54
58
  hash.merge!(styling: @styling.to_h) if @styling
@@ -0,0 +1,35 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class QueryAlternativePayment
4
+
5
+ attr_accessor :request_header, :token
6
+
7
+
8
+
9
+ def initialize(request_header: nil, token: )
10
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
11
+ @token = token
12
+ end
13
+
14
+ def to_hash
15
+ hash = Hash.new
16
+ hash.merge!(request_header: @request_header.to_h) if @request_header
17
+ hash.merge!(token: @token) if @token
18
+ hash
19
+ end
20
+ alias_method :to_h, :to_hash
21
+
22
+ def to_json
23
+ to_hash.to_json
24
+ end
25
+
26
+ def url
27
+ '/Payment/v1/Transaction/QueryAlternativePayment'
28
+ end
29
+
30
+ def response_class
31
+ SixSaferpay::SixTransaction::QueryAlternativePaymentResponse
32
+ end
33
+ end
34
+ end
35
+ end
@@ -34,11 +34,11 @@ module SixSaferpay
34
34
  end
35
35
 
36
36
  def url
37
- '/Payment/v1/Transaction/QueryPaymentMeans'
37
+ '/Payment/v1/Transaction/Refund'
38
38
  end
39
39
 
40
40
  def response_class
41
- SixSaferpay::SixTransaction::RefundRespose
41
+ SixSaferpay::SixTransaction::RefundResponse
42
42
  end
43
43
  end
44
44
  end
@@ -2,10 +2,7 @@ module SixSaferpay
2
2
  module SixTransaction
3
3
  class AdjustAmountResponse
4
4
 
5
- attr_accessor(:response_header,
6
- )
7
-
8
-
5
+ attr_accessor(:response_header)
9
6
 
10
7
  def initialize(response_header: )
11
8
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
@@ -0,0 +1,35 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class AlternativePaymentResponse
4
+
5
+ attr_accessor(:response_header,
6
+ :token,
7
+ :expiration,
8
+ :processing_data,
9
+ )
10
+
11
+
12
+
13
+ def initialize(response_header:,
14
+ token:,
15
+ expiration:,
16
+ processing_data: nil)
17
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
18
+ @token = token
19
+ @expiration = expiration
20
+ @processing_data = SixSaferpay::ProcessingData.new(@processing_data.to_h) if processing_data
21
+ end
22
+
23
+ def to_hash
24
+ hash = Hash.new
25
+ hash.merge!(response_header: @response_header.to_h) if @response_header
26
+ hash.merge!(token: @token)
27
+ hash.merge!(expiration: @expiration)
28
+ hash.merge!(processing_data: @processing_data.to_h) if @processing_data
29
+ hash
30
+ end
31
+ alias_method :to_h, :to_hash
32
+
33
+ end
34
+ end
35
+ end
@@ -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,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