six_saferpay 0.1.10 → 1.0.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/Gemfile.lock +8 -5
  3. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +3 -4
  4. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +1 -1
  5. data/lib/six_saferpay/api/six_payment_page/responses/initalize_response.rb +0 -11
  6. data/lib/six_saferpay/api/six_transaction/requests/authorize.rb +45 -0
  7. data/lib/six_saferpay/api/six_transaction/requests/cancel.rb +20 -22
  8. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +1 -0
  9. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +61 -62
  10. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +47 -0
  11. data/lib/six_saferpay/api/six_transaction/responses/cancel_response.rb +34 -0
  12. data/lib/six_saferpay/api/six_transaction/responses/capture_response.rb +2 -1
  13. data/lib/six_saferpay/api/six_transaction/responses/initialize_response.rb +34 -5
  14. data/lib/six_saferpay/client.rb +8 -4
  15. data/lib/six_saferpay/models/address_form.rb +5 -4
  16. data/lib/six_saferpay/models/amount.rb +4 -3
  17. data/lib/six_saferpay/models/bank_account.rb +7 -6
  18. data/lib/six_saferpay/models/brand.rb +4 -4
  19. data/lib/six_saferpay/models/client_info.rb +3 -3
  20. data/lib/six_saferpay/models/direct_debit.rb +20 -0
  21. data/lib/six_saferpay/models/error.rb +28 -0
  22. data/lib/six_saferpay/models/fee_refund.rb +1 -1
  23. data/lib/six_saferpay/models/fraud_free.rb +5 -5
  24. data/lib/six_saferpay/models/installment.rb +1 -1
  25. data/lib/six_saferpay/models/invoice.rb +5 -5
  26. data/lib/six_saferpay/models/liability.rb +6 -6
  27. data/lib/six_saferpay/models/options.rb +1 -1
  28. data/lib/six_saferpay/models/payee.rb +1 -20
  29. data/lib/six_saferpay/models/payment.rb +1 -1
  30. data/lib/six_saferpay/models/{alias.rb → payment_means_alias.rb} +5 -5
  31. data/lib/six_saferpay/models/payment_methods_options.rb +1 -1
  32. data/lib/six_saferpay/models/redirect.rb +22 -0
  33. data/lib/six_saferpay/models/register_alias.rb +1 -3
  34. data/lib/six_saferpay/models/registration_alias.rb +23 -0
  35. data/lib/six_saferpay/models/registration_error.rb +25 -0
  36. data/lib/six_saferpay/models/registration_result.rb +8 -6
  37. data/lib/six_saferpay/models/request_card.rb +36 -0
  38. data/lib/six_saferpay/models/request_header.rb +14 -10
  39. data/lib/six_saferpay/models/request_payment_means.rb +29 -0
  40. data/lib/six_saferpay/models/response_card.rb +48 -0
  41. data/lib/six_saferpay/models/response_header.rb +4 -4
  42. data/lib/six_saferpay/models/{payment_means.rb → response_payment_means.rb} +11 -11
  43. data/lib/six_saferpay/models/return_urls.rb +9 -9
  44. data/lib/six_saferpay/models/styling.rb +1 -1
  45. data/lib/six_saferpay/models/three_ds.rb +6 -5
  46. data/lib/six_saferpay/models/transaction.rb +15 -15
  47. data/lib/six_saferpay/models/twint.rb +3 -3
  48. data/lib/six_saferpay/models/wallet.rb +6 -6
  49. data/lib/six_saferpay/version.rb +1 -1
  50. data/six_saferpay.gemspec +1 -0
  51. metadata +29 -15
  52. data/lib/six_saferpay/api/six_payment_page.rb +0 -10
  53. data/lib/six_saferpay/api/six_transaction/requests/authorization.rb +0 -33
  54. data/lib/six_saferpay/api/six_transaction.rb +0 -4
  55. data/lib/six_saferpay/error.rb +0 -11
  56. data/lib/six_saferpay/model.rb +0 -5
  57. data/lib/six_saferpay/models/card.rb +0 -40
  58. data/lib/six_saferpay/models/debit_direct.rb +0 -20
  59. data/lib/six_saferpay/models/six_transaction/initialize/card.rb +0 -44
  60. data/lib/six_saferpay/models/six_transaction/initialize/payment_means.rb +0 -32
  61. data/lib/six_saferpay/models/six_transaction/initialize.rb +0 -6
  62. data/lib/six_saferpay/models/verification_code.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25905e96758e61391e8ee95dfc6795ca1e84fb753fa8ce46a9948cdde7d6df4e
4
- data.tar.gz: 686f52677a0abe0b4ca8d9ea03111985403840eab2d35e4ed3a554dacb48bff8
3
+ metadata.gz: ceaa6770af2ef4601171a3712aa2eb140392c1b44ce467e27ba2854a0b8fcca3
4
+ data.tar.gz: 836723987b8b80de63418413e5a7e32c446f27f0fbb1fc1c5f13e2301605bcf4
5
5
  SHA512:
6
- metadata.gz: f77747f41a4f5c1727a9ccab460ce8934ca23a2504846d39bb261810ac92eeb7ba66d3f42ad2ec220b01d8b59dd91003b957413f7c25fbfc05f6c8141389bfd4
7
- data.tar.gz: 1f35d0a4af9a38fd6ed22eec212db2a9277728119121de034df51b6471bb724dcb21fde9b7de3f93e7ade5c995ffb48f1c2903371841e6316450f129e0f87f42
6
+ metadata.gz: 5c54b4d3b7e6f4572dd3a783ac8de905e5abf915198c7a8a5a4b28f8d92340882a90efacad5cbc5b9c827296cb71395cfa8bf2cd9587a0da11f63ef202260380
7
+ data.tar.gz: 409044750e116e69a0c4be1d417a6272c5f189d36933fe2d5203f08857614c6909c8cf5e82ab6436c5b35f654d8023eb90ec9d40cf9f9f4fa82a9489e683e47f
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- six_saferpay (0.1.9)
5
- activesupport (>= 5.0.0.0)
4
+ six_saferpay (0.1.10)
5
+ activesupport (~> 5.0, >= 5.0.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -62,6 +62,8 @@ GEM
62
62
  json (>= 1.8, < 3)
63
63
  simplecov-html (~> 0.10.0)
64
64
  simplecov-html (0.10.2)
65
+ spinning_wheel (0.2.0)
66
+ activesupport (~> 5.0, >= 5.0.0.0)
65
67
  spoon (0.0.6)
66
68
  ffi
67
69
  thread_safe (0.3.6)
@@ -95,15 +97,16 @@ PLATFORMS
95
97
 
96
98
  DEPENDENCIES
97
99
  bundler (~> 2.0)
98
- dotenv (~> 2.7.0)
100
+ dotenv (~> 2.7, >= 2.7)
99
101
  pry (~> 0.12.0)
100
102
  rake (~> 10.0)
101
103
  rspec (~> 3.0)
102
104
  simplecov (~> 0.16)
103
105
  six_saferpay!
106
+ spinning_wheel (~> 0.1)
104
107
  tty-prompt (~> 0.18)
105
- vcr (~> 4.0.0)
106
- webmock (~> 3.5.1)
108
+ vcr (~> 4.0, >= 4.0.0)
109
+ webmock (~> 3.5, >= 3.5.1)
107
110
 
108
111
  BUNDLED WITH
109
112
  2.0.1
@@ -19,7 +19,6 @@ module SixSaferpay
19
19
  :delivery_address_form,
20
20
  :card_form,
21
21
  :condition
22
-
23
22
  )
24
23
 
25
24
  def initialize(request_header: nil,
@@ -40,7 +39,7 @@ module SixSaferpay
40
39
  condition: nil
41
40
  )
42
41
  @request_header = request_header || SixSaferpay::RequestHeader.new()
43
- @config_set = @config_set
42
+ @config_set = config_set
44
43
  @terminal_id = terminal_id || SixSaferpay.config.terminal_id
45
44
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
46
45
  @payment_methods = payment_methods
@@ -64,7 +63,7 @@ module SixSaferpay
64
63
  hash.merge!(terminal_id: @terminal_id)
65
64
  hash.merge!(payment: @payment.to_h)
66
65
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
67
- hash.merge!(payment_methods_options: @payment_methods_options) if @payment_methods_options
66
+ hash.merge!(payment_methods_options: @payment_methods_options.to_h) if @payment_methods_options
68
67
  hash.merge!(wallets: @wallets) if @wallets
69
68
  hash.merge!(payer: @payer.to_h) if @payer
70
69
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
@@ -74,7 +73,7 @@ module SixSaferpay
74
73
  hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
75
74
  hash.merge!(delivery_address_form: @delivery_address_form.to_h) if @delivery_address_form
76
75
  hash.merge!(card_form: @card_form.to_h) if @card_form
77
- hash.merge!(condition: @codition) if @condition
76
+ hash.merge!(condition: @condition) if @condition
78
77
  hash
79
78
  end
80
79
  alias_method :to_h, :to_hash
@@ -21,7 +21,7 @@ module SixSaferpay
21
21
  )
22
22
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h)
23
23
  @transaction = SixSaferpay::Transaction.new(transaction.to_h)
24
- @payment_means = SixSaferpay::PaymentMeans.new(payment_means.to_h)
24
+ @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h)
25
25
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
26
26
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
27
27
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
@@ -28,17 +28,6 @@ module SixSaferpay
28
28
  end
29
29
  alias_method :to_h, :to_hash
30
30
 
31
- def token
32
- @token
33
- end
34
-
35
- def expiration
36
- @expiration
37
- end
38
-
39
- def redirect_url
40
- @redirect_url
41
- end
42
31
  end
43
32
  end
44
33
  end
@@ -0,0 +1,45 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class Authorize
4
+
5
+ attr_accessor :request_header,
6
+ :token,
7
+ :condition,
8
+ :verification_code,
9
+ :register_alias
10
+
11
+
12
+ def initialize(request_header: nil,
13
+ token:,
14
+ condition: nil,
15
+ verification_code: nil,
16
+ register_alias: nil
17
+ )
18
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
19
+ @token = token
20
+ @condition = condition
21
+ @verification_code = verification_code
22
+ @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
23
+ end
24
+
25
+ def to_hash
26
+ hash = Hash.new
27
+ hash.merge!(request_header: @request_header.to_h) if @register_alias
28
+ hash.merge!(token: @token) if @token
29
+ hash.merge!(condition: @condition) if @condition
30
+ hash.merge!(verification_code: @verification_code) if @verification_code
31
+ hash.merge!(register_alias: @register_alias.to_h) if @register_alias
32
+ hash
33
+ end
34
+ alias_method :to_h, :to_hash
35
+
36
+ def to_json
37
+ to_hash.to_json
38
+ end
39
+
40
+ def url
41
+ '/Payment/v1/Transaction/Authorize'
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,32 +1,30 @@
1
1
  module SixSaferpay
2
- module API
3
- module SixTransaction
4
- class Cancel
2
+ module SixTransaction
3
+ class Cancel
5
4
 
6
- attr_accessor :request_header, :transaction_reference
5
+ attr_accessor :request_header,
6
+ :transaction_reference
7
7
 
8
- def initialize(transaction_id)
9
- @request_header = SixSaferpay::RequestHeader.new
10
- @transaction_reference = SixSaferpay::TransactionReference
11
- .new(transaction_id)
12
- end
13
8
 
14
- def to_hash
15
- hash = Hash.new
16
- hash.merge!(@request_header.to_h)
17
- hash.merge!(@transaction_reference.to_h)
18
- hash
19
- end
20
- alias_method :to_h, :to_hash
9
+ def initialize(request_header: nil, transaction_reference:)
10
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
11
+ @transaction_reference = SixSaferpay::TransactionReference.new(transaction_reference.to_h) if transaction_reference
12
+ end
21
13
 
22
- def to_json
23
- to_hash.to_json
24
- end
14
+ def to_hash
15
+ hash = Hash.new
16
+ hash.merge!(request_header: @request_header.to_h) if @request_header
17
+ hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
18
+ hash
19
+ end
20
+ alias_method :to_h, :to_hash
25
21
 
26
- def url
27
- '/Payment/v1/Transaction/Cancel'
28
- end
22
+ def to_json
23
+ to_hash.to_json
24
+ end
29
25
 
26
+ def url
27
+ '/Payment/v1/Transaction/Cancel'
30
28
  end
31
29
  end
32
30
  end
@@ -30,6 +30,7 @@ module SixSaferpay
30
30
  hash = Hash.new
31
31
  hash.merge!(request_header: @request_header.to_h) if @request_header
32
32
  hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
33
+ hash.merge!(amount: @amount.to_h) if @amount
33
34
  hash.merge!(billpay: @billpay.to_h) if @billpay
34
35
  hash.merge!(pending_notifiction: @pending_notifiction.to_h) if @pending_notifiction
35
36
  hash.merge!(marketplace: @marketplace.to_h) if @marketplace
@@ -1,73 +1,72 @@
1
1
  module SixSaferpay
2
- module API
3
- module SixTransactions
4
- class Initialize
2
+ module SixTransaction
3
+ class Initialize
5
4
 
6
- attr_accessor(
7
- :request_header,
8
- :config_set,
9
- :terminal_id,
10
- :payment,
11
- :payment_means,
12
- :payer,
13
- :return_urls,
14
- :styling,
15
- :wallet,
16
- :payment_methods,
17
- :card_form
18
- )
5
+ attr_accessor(
6
+ :request_header,
7
+ :config_set,
8
+ :terminal_id,
9
+ :payment,
10
+ :payment_means,
11
+ :payer,
12
+ :return_urls,
13
+ :styling,
14
+ :wallet,
15
+ :payment_methods,
16
+ :card_form
17
+ )
19
18
 
20
19
 
21
- def initialize(request_header: nil,
22
- config_set: nil,
23
- terminal_id: nil,
24
- payment:,
25
- payment_means: nil,
26
- payer: nil,
27
- return_urls: nil,
28
- styling: nil,
29
- wallet: nil,
30
- payment_methods: nil,
31
- card_form: nil
32
- )
33
- @request_header = request_header || SixSaferpay::RequestHeader.new()
34
- @config_set = config_set
35
- @terminal_id = terminal_id || SixSaferpay.config.terminal_id
36
- @payment = payment
37
- @payment_means = payment_means
38
- @return_urls = return_urls || SixSaferpay::ReturnUrls.new()
39
- @styling = styling
40
- @wallet = wallet
41
- @payment_methods = payment_methods
42
- @card_form = card_form
43
- end
44
-
45
- def to_hash
46
- hash = Hash.new
47
- hash.merge!(RequestHeader: @request_header.to_h)
48
- hash.merge!(ConfigSet: @config_set) if @config_set
49
- hash.merge!(TerminalID: @terminal_id)
50
- hash.merge!(Payment: @payment.to_h)
51
- hash.merge!(PaymentMeans: @payment_means.to_h) if @payment_means
52
- hash.merge!(Payer: @payer.to_h) if @payer
53
- hash.merge!(ReturnUrls: @return_urls.to_h ) if @return_urls
54
- hash.merge!(Styling: @styling.to_h) if @styling
55
- hash.merge!(Wallet: @wallet.to_h) if @wallet
56
- hash.merge!(PaymentMethods: @payment_methods) if @payment_methods
57
- hash.merge!(CardForm: @card_form.to_h) if @card_form
58
- hash
59
- end
60
- alias_method :to_h, :to_hash
20
+ def initialize(request_header: nil,
21
+ config_set: nil,
22
+ terminal_id: nil,
23
+ payment:,
24
+ payment_means: nil,
25
+ payer: nil,
26
+ return_urls: nil,
27
+ styling: nil,
28
+ wallet: nil,
29
+ payment_methods: nil,
30
+ card_form: nil
31
+ )
32
+ @request_header = request_header || SixSaferpay::RequestHeader.new()
33
+ @config_set = config_set
34
+ @terminal_id = terminal_id || SixSaferpay.config.terminal_id
35
+ @payment = SixSaferpay::Payment.new(payment.to_h) if payment
36
+ @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
37
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
38
+ @return_urls = return_urls || SixSaferpay::ReturnUrls.new()
39
+ @styling = SixSaferpay::Styling.new(styling.to_h) if styling
40
+ @wallet = SixSaferpay::Wallet.new(wallet.to_h) if wallet
41
+ @payment_methods = payment_methods
42
+ @card_form = SixSaferpay::CardForm.new(card_form.to_h) if card_form
43
+ end
61
44
 
62
- def to_json
63
- to_hash.to_json
64
- end
45
+ def to_hash
46
+ hash = Hash.new
47
+ hash.merge!(request_header: @request_header.to_h) if @request_header
48
+ hash.merge!(config_set: @config_set) if @config_set
49
+ hash.merge!(terminal_id: @terminal_id) if @terminal_id
50
+ hash.merge!(payment: @payment.to_h) if @payment
51
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
52
+ hash.merge!(payer: @payer.to_h) if @payer
53
+ hash.merge!(return_urls: @return_urls.to_h ) if @return_urls
54
+ hash.merge!(styling: @styling.to_h) if @styling
55
+ hash.merge!(wallet: @wallet.to_h) if @wallet
56
+ hash.merge!(payment_methods: @payment_methods) if @payment_methods
57
+ hash.merge!(card_form: @card_form.to_h) if @card_form
58
+ hash
59
+ end
60
+ alias_method :to_h, :to_hash
65
61
 
66
- def url
67
- '/Payment/v1/Transaction/Initialize'
68
- end
62
+ def to_json
63
+ to_hash.to_json
64
+ end
69
65
 
66
+ def url
67
+ '/Payment/v1/Transaction/Initialize'
70
68
  end
69
+
71
70
  end
72
71
  end
73
72
  end
@@ -0,0 +1,47 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class AuthorizeResponse
4
+
5
+ attr_accessor :response_header,
6
+ :transaction,
7
+ :payment_means,
8
+ :payer,
9
+ :registration_result,
10
+ :liability,
11
+ :dcc
12
+
13
+
14
+ def initialize(response_header:,
15
+ transaction:,
16
+ payment_means:,
17
+ payer: nil,
18
+ registration_result: nil,
19
+ liability: nil,
20
+ dcc: nil
21
+
22
+ )
23
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
24
+ @transaction = SixSaferpay::Transaction.new(transaction.to_h) if transaction
25
+ @payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h) if payment_means
26
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
27
+ @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
28
+ @liability = SixSaferpay::Liability.new(liability.to_h) if liability
29
+ @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
30
+ end
31
+
32
+ def to_hash
33
+ hash = Hash.new
34
+ hash.merge!(response_header: @response_header.to_h) if @response_header
35
+ hash.merge!(transaction: @transaction.to_h) if @transaction
36
+ hash.merge!(payment_means: @payment_means.to_h) if @payment_means
37
+ hash.merge!(payer: @payer.to_h) if @payer
38
+ hash.merge!(registration_result: @registration_result.to_h) if @registration_result
39
+ hash.merge!(liability: @liability.to_h) if @liability
40
+ hash.merge!(dcc: @dcc.to_h) if @dcc
41
+ hash
42
+ end
43
+ alias_method :to_h, :to_hash
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,34 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ class CancelResponse
4
+
5
+ attr_accessor :response_header,
6
+ :transaction_id,
7
+ :order_id,
8
+ :date
9
+
10
+
11
+ def initialize(response_header:,
12
+ transaction_id:,
13
+ order_id: nil,
14
+ date: nile
15
+ )
16
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
17
+ @transaction_id = transaction_id
18
+ @order_id = order_id
19
+ @date = date
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_id: @transaction_id) if @transaction_id
26
+ hash.merge!(order_id: @order_id) if @order_id
27
+ hash.merge!(date: @date) if @date
28
+ hash
29
+ end
30
+ alias_method :to_h, :to_hash
31
+
32
+ end
33
+ end
34
+ end
@@ -8,12 +8,13 @@ module SixSaferpay
8
8
  :date,
9
9
  :invoice
10
10
  )
11
+
11
12
  def initialize(response_header: ,
12
13
  capture_id: nil,
13
14
  status: ,
14
15
  date: ,
15
16
  invoice: nil)
16
- @response_header = SixSaferpay::ResponseHeader.new(response_header) if response_header
17
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
17
18
  @capture_id = capture_id
18
19
  @status = status
19
20
  @date = date
@@ -1,12 +1,41 @@
1
1
  module SixSaferpay
2
- module API
3
- module SixTransaction
4
- class InitializeResponse
2
+ module SixTransaction
3
+ class InitializeResponse
5
4
 
6
- def initialize(hash)
7
- end
5
+ attr_accessor(:response_header,
6
+ :token,
7
+ :expiration,
8
+ :liability_shift,
9
+ :redirect_required,
10
+ :redirect
11
+ )
8
12
 
13
+ def initialize(response_header:,
14
+ token:,
15
+ expiration:,
16
+ liability_shift: nil,
17
+ redirect_required:,
18
+ redirect: )
19
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
20
+ @token = token
21
+ @expiration = expiration
22
+ @liability_shift = liability_shift
23
+ @redirect_required = redirect_required
24
+ @redirect = SixSaferpay::Redirect.new(redirect.to_h) if redirect
9
25
  end
26
+
27
+ def to_hash
28
+ hash = Hash.new
29
+ hash.merge!(response_header: @response_header.to_h) if @response_header
30
+ hash.merge!(token: @token) if @token
31
+ hash.merge!(expiration: @expiration) if @expiration
32
+ hash.merge!(liability_shift: @liability_shift) if !@liability_shift.nil?
33
+ hash.merge!(redirect_required: @redirect_required) if !@redirect_required.nil?
34
+ hash.merge!(redirect: @redirect.to_h) if @redirect
35
+ hash
36
+ end
37
+ alias_method :to_h, :to_hash
38
+
10
39
  end
11
40
  end
12
41
  end
@@ -14,10 +14,13 @@ module SixSaferpay
14
14
  https = Net::HTTP.new(uri.host, uri.port)
15
15
  https.use_ssl = true
16
16
  @response = https.request(request)
17
- body = @response.body
18
- hash = JSON.parse(body, symbolize_names: true)
17
+ hash = @response.body
18
+ hash = JSON.parse(hash, symbolize_names: true)
19
19
  hash = hash.deep_transform_keys do |key|
20
20
  key = key.to_s.underscore
21
+ key.gsub!(/^alias/,'fd_alias')
22
+ key.gsub!(/^abort/,'fd_abort')
23
+ key.gsub!(/^fail/,'fd_fail')
21
24
  key.to_sym
22
25
  end
23
26
  if @response.code == "200"
@@ -34,10 +37,11 @@ module SixSaferpay
34
37
  hash = @object.to_h
35
38
  hash = hash.deep_transform_keys do |key|
36
39
  key = key.to_s.camelize
40
+ key.gsub!('fd_','')
37
41
  key.to_sym
38
42
  end
39
- body = hash.to_json
40
- request.body = body
43
+ hash = hash.to_json
44
+ request.body = hash
41
45
  request.basic_auth(username, password)
42
46
  @request = request
43
47
  end
@@ -1,16 +1,18 @@
1
1
  module SixSaferpay
2
2
  class AddressForm
3
3
 
4
- attr_accessor(:display, :mandatory_fields)
4
+ attr_accessor(:display,
5
+ :mandatory_fields)
5
6
 
6
- def initialize(display:, mandatory_fields: nil)
7
+ def initialize(display:,
8
+ mandatory_fields: nil)
7
9
  @display = display
8
10
  @mandatory_fields = mandatory_fields
9
11
  end
10
12
 
11
13
  def to_hash
12
14
  hash = Hash.new
13
- hash.merge!(display: @display)
15
+ hash.merge!(display: @display) if !@display.nil?
14
16
  hash.merge!(mandatory_fields: @mandatory_fields) if @mandatory_fields
15
17
  hash
16
18
  end
@@ -18,4 +20,3 @@ module SixSaferpay
18
20
 
19
21
  end
20
22
  end
21
-
@@ -9,9 +9,10 @@ module SixSaferpay
9
9
  end
10
10
 
11
11
  def to_hash
12
- body = Hash.new
13
- body.merge!(value: @value)
14
- body.merge!(currency_code: @currency_code)
12
+ hash = Hash.new
13
+ hash.merge!(value: @value)
14
+ hash.merge!(currency_code: @currency_code)
15
+ hash
15
16
  end
16
17
  alias_method :to_h, :to_hash
17
18
 
@@ -22,12 +22,13 @@ module SixSaferpay
22
22
  end
23
23
 
24
24
  def to_hash
25
- body = Hash.new
26
- body.merge!(IBAN: @iban)
27
- body.merge!(HolderName: @holder_name)
28
- body.merge!(BankName: @bank_name)
29
- body.merge!(CountryCode: @country_code)
30
- body
25
+ hash = Hash.new
26
+ hash.merge!(iban: @iban) if @iban
27
+ hash.merge!(holder_name: @holder_name) if @holder_name
28
+ hash.merge!(bic: @bic) if @bic
29
+ hash.merge!(bank_name: @bank_name)
30
+ hash.merge!(country_code: @country_code)
31
+ hash
31
32
  end
32
33
  alias_method :to_h, :to_hash
33
34
 
@@ -9,10 +9,10 @@ module SixSaferpay
9
9
  end
10
10
 
11
11
  def to_hash
12
- body = Hash.new
13
- body.merge!(payment_method: @payment_method) if @payment_method
14
- body.merge!(name: @name)
15
- body
12
+ hash = Hash.new
13
+ hash.merge!(payment_method: @payment_method) if @payment_method
14
+ hash.merge!(name: @name) if @name
15
+ hash
16
16
  end
17
17
  alias_method :to_h, :to_hash
18
18
 
@@ -1,5 +1,5 @@
1
1
  module SixSaferpay
2
- class ClientInfo < Model
2
+ class ClientInfo
3
3
 
4
4
  attr_accessor :shop_info, :os_info
5
5
 
@@ -10,8 +10,8 @@ module SixSaferpay
10
10
 
11
11
  def to_hash
12
12
  hash = Hash.new
13
- hash.merge!(shop_info: @shop_info)
14
- hash.merge!(os_info: @os_info)
13
+ hash.merge!(shop_info: @shop_info) if @shop_info
14
+ hash.merge!(os_info: @os_info) if @os_info
15
15
  hash
16
16
  end
17
17
  alias_method :to_h, :to_hash
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class DirectDebit
3
+
4
+ attr_accessor(:mandate_id, :creditor_id)
5
+
6
+ def initialize(mandate_id:, creditor_id:)
7
+ @mandate_id = mandate_id
8
+ @creditor_id = creditor_id
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(mandate_id: @mandate_id) if @mandate_id
14
+ hash.merge!(creditor_id: @creditor_id) if @creditor_id
15
+ hash
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end