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,38 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class MultipartFinalize
4
+
5
+ attr_accessor(:request_header,
6
+ :transaction_reference
7
+ )
8
+
9
+
10
+ def initialize(request_header: nil,
11
+ transaction_reference: )
12
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
13
+ @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
14
+ end
15
+
16
+ def to_hash
17
+ hash = Hash.new
18
+ hash.merge!(request_header: @request_header.to_h) if @request_header
19
+ hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
20
+ hash
21
+ end
22
+ alias_method :to_h, :to_hash
23
+
24
+ def to_json
25
+ to_hash.to_json
26
+ end
27
+
28
+ def url
29
+ '/Payment/v1/Transaction/MultipartFinalize'
30
+ end
31
+
32
+ def response_class
33
+ SixSaferpay::SixTransaction::MultipartFinalizeResponse
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -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
@@ -2,11 +2,11 @@ module SixSaferpay
2
2
  module SixTransaction
3
3
  class Refund
4
4
 
5
- attr_accessor :request_header,
6
- :refund,
7
- :capture_reference,
8
- :pending_notification
9
-
5
+ attr_accessor(:request_header,
6
+ :refund,
7
+ :capture_reference,
8
+ :pending_notification
9
+ )
10
10
 
11
11
 
12
12
  def initialize(request_header: nil,
@@ -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
@@ -0,0 +1,46 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class RefundDirect
4
+
5
+ attr_accessor(:request_header,
6
+ :terminal_id,
7
+ :refund,
8
+ :payment_means
9
+ )
10
+
11
+
12
+ def initialize(request_header: nil,
13
+ terminal_id:,
14
+ refund:,
15
+ payment_means:
16
+ )
17
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
18
+ @terminal_id = terminal_id
19
+ @refund = SixSaferpay::Refund.new(refund.to_h) if refund
20
+ @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
21
+ end
22
+
23
+ def to_hash
24
+ hash = Hash.new
25
+ hash.merge!(request_header: @request_header.to_h) if @request_header
26
+ hash.merge!(terminal_id: @terminal_id) if @terminal_id
27
+ hash.merge!(refund: @refund.to_h) if @refund
28
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
29
+ hash
30
+ end
31
+ alias_method :to_h, :to_hash
32
+
33
+ def to_json
34
+ to_hash.to_json
35
+ end
36
+
37
+ def url
38
+ '/Payment/v1/Transaction/RefundDirect'
39
+ end
40
+
41
+ def response_class
42
+ SixSaferpay::SixTransaction::RefundDirectResponse
43
+ end
44
+ end
45
+ end
46
+ 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
@@ -11,7 +11,7 @@ module SixSaferpay
11
11
  def initialize(response_header:,
12
12
  transaction_id:,
13
13
  order_id: nil,
14
- date: nile
14
+ date: nil
15
15
  )
16
16
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
17
17
  @transaction_id = transaction_id
@@ -0,0 +1,44 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class InquireResponse
4
+
5
+ attr_accessor(:response_header,
6
+ :transaction,
7
+ :payment_means,
8
+ :payer,
9
+ :liability,
10
+ :dcc
11
+ )
12
+
13
+
14
+ def initialize(response_header:,
15
+ transaction:,
16
+ payment_means:,
17
+ payer: nil,
18
+ liability: nil,
19
+ dcc: nil
20
+
21
+ )
22
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
23
+ @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
24
+ @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h) if payment_means
25
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
26
+ @liability = SixSaferpay::Liability.new(liability.to_h) if liability
27
+ @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
28
+ end
29
+
30
+ def to_hash
31
+ hash = Hash.new
32
+ hash.merge!(response_header: @response_header.to_h) if @response_header
33
+ hash.merge!(transaction: @transaction.to_h) if @transaction
34
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
35
+ hash.merge!(payer: @payer.to_h) if @payer
36
+ hash.merge!(liability: @liability.to_h) if @liability
37
+ hash.merge!(dcc: @dcc.to_h) if @dcc
38
+ hash
39
+ end
40
+ alias_method :to_h, :to_hash
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class MultipartFinalizeResponse
4
+
5
+ attr_accessor(:response_header)
6
+
7
+ def initialize(response_header:)
8
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(response_header: @response_header.to_h) if @response_header
14
+ hash
15
+ end
16
+ alias_method :to_h, :to_hash
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class QueryAlternativePaymentResponse
4
+
5
+ attr_accessor(:response_header,
6
+ :transaction,
7
+ :payment_means,
8
+ :payer,
9
+ :liability
10
+ )
11
+
12
+ def initialize(response_header: ,
13
+ transaction: ,
14
+ payment_means: ,
15
+ payer: nil,
16
+ liability: nil)
17
+
18
+
19
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
20
+ @transaction = SixSaferpay::Transaction.new(transaction.to_h)
21
+ @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h)
22
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
+ @liability = SixSaferpay::Liability.new(liability.to_h) if liability
24
+ end
25
+
26
+ def to_hash
27
+ hash = Hash.new
28
+ hash.merge!(response_header: @response_header.to_h) if @response_header
29
+ hash.merge!(transaction: @transaction.to_h) if @transaction
30
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
31
+ hash.merge!(payer: @payer.to_h) if @payer
32
+ hash.merge!(liability: @liability.to_h) if @liability
33
+ hash
34
+ end
35
+ alias_method :to_h, :to_hash
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,34 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class RefundDirectResponse
4
+
5
+ attr_accessor(:response_header,
6
+ :transaction,
7
+ :payment_means,
8
+ :dcc
9
+ )
10
+
11
+ def initialize(response_header: ,
12
+ transaction:,
13
+ payment_means: ,
14
+ dcc: nil)
15
+
16
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
17
+ @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
18
+ @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h) if payment_means
19
+ @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
20
+ end
21
+
22
+ def to_hash
23
+ hash = Hash.new
24
+ hash.merge!(response_header: @response_header.to_h) if @response_header
25
+ hash.merge!(transaction: @transaction.to_h) if @transaction
26
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
27
+ hash.merge!(dcc: @dcc.to_h) if @dcc
28
+ hash
29
+ end
30
+ alias_method :to_h, :to_hash
31
+
32
+ end
33
+ end
34
+ end
@@ -17,17 +17,23 @@ module SixSaferpay
17
17
  hash = @response.body
18
18
  hash = JSON.parse(hash, symbolize_names: true)
19
19
  hash = transform_response_hash(hash)
20
- if @response.code == "200"
20
+ if @response.code == '200'
21
21
  @object.response_class.new(hash)
22
22
  else
23
23
  raise SixSaferpay::Error.new(hash)
24
24
  end
25
25
  end
26
26
 
27
+ protected
28
+
29
+ def header
30
+ {"Content-Type" => 'application/json'}
31
+ end
32
+
27
33
  private
28
34
 
29
35
  def request
30
- request = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
36
+ request = Net::HTTP::Post.new(uri.path, header)
31
37
  hash = @object.to_h
32
38
  hash = transform_request_hash(hash)
33
39
  hash = hash.to_json