six_saferpay 0.1.10 → 1.0.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 (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
@@ -0,0 +1,28 @@
1
+ module SixSaferpay
2
+ class RegistrationError
3
+
4
+ attr_accessor(:success,
5
+ :fd_alias,
6
+ :error
7
+ )
8
+
9
+
10
+ def initialize(success:,
11
+ fd_alias: nil,
12
+ error: nil)
13
+
14
+ binding.pry
15
+ @success = success
16
+ @fd_alias = SixSaferpay::RegistrationAlias.new(fd_alias.to_h) if fd_alias
17
+ @error = SixSaferpay::RegistrationError.new(error.to_h) if error
18
+ end
19
+
20
+ def to_hash
21
+ hash = Hash.new
22
+ hash.merge!(sucess: @sucess) if @success
23
+ hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
24
+ hash.merge!(error: @error.to_h) if @error
25
+ end
26
+
27
+ end
28
+ end
@@ -1,4 +1,4 @@
1
1
  module SixSaferpay
2
- class SixRefund < SixSaferpay::Amount
2
+ class SixSaferpay::FeeRefund < SixSaferpay::Amount
3
3
  end
4
4
  end
@@ -4,29 +4,29 @@ module SixSaferpay
4
4
  attr_accessor(:id,
5
5
  :liability_shift,
6
6
  :score,
7
- :investigationpoints,
7
+ :investigation_points,
8
8
  :error_message
9
9
  )
10
10
 
11
11
  def initialize(id: ,
12
12
  liability_shift: ,
13
13
  score: ,
14
- investigationpoints: nil,
14
+ investigation_points: nil,
15
15
  error_message: nil
16
16
  )
17
17
  @id = id
18
18
  @liability_shift = liability_shift
19
19
  @score = score
20
- @investigationpoints = investigationpoints
20
+ @investigation_points = investigation_points
21
21
  @error_message = error_message
22
22
  end
23
23
 
24
24
  def to_hash
25
25
  hash = Hash.new
26
26
  hash.merge!(id: @id) if @id
27
- hash.merge!(liability_shift: @liability_shift) if @liability_shift
27
+ hash.merge!(liability_shift: @liability_shift) if !@liability_shift.nil?
28
28
  hash.merge!(score: @score) if @score
29
- hash.merge!(investigationpoints: @investigationpoints) if @investigationpoints
29
+ hash.merge!(investigation_points: @investigation_points) if @investigation_points
30
30
  hash.merge!(error_message: @error_message) if @error_message
31
31
  hash
32
32
  end
@@ -9,7 +9,7 @@ module SixSaferpay
9
9
 
10
10
  def to_hash
11
11
  hash = Hash.new
12
- hash.merge!(initial: @initial)
12
+ hash.merge!(initial: @initial) if !@initial.nil?
13
13
  hash
14
14
  end
15
15
  alias_method :to_h, :to_hash
@@ -10,11 +10,11 @@ module SixSaferpay
10
10
  end
11
11
 
12
12
  def to_hash
13
- body = Hash.new
14
- body.merge!(payee: @payee.to_h) if @payee
15
- body.merge!(reason_for_transfer: @reason_for_transfer) if @reason_for_transfer
16
- body.merge!(due_date: @due_date) if @due_date
17
- body
13
+ hash = Hash.new
14
+ hash.merge!(payee: @payee.to_h) if @payee
15
+ hash.merge!(reason_for_transfer: @reason_for_transfer) if @reason_for_transfer
16
+ hash.merge!(due_date: @due_date) if @due_date
17
+ hash
18
18
  end
19
19
  alias_method :to_h, :to_hash
20
20
 
@@ -19,12 +19,12 @@ module SixSaferpay
19
19
  end
20
20
 
21
21
  def to_hash
22
- body = Hash.new
23
- body.merge!(liability_shift: @liability_shift)
24
- body.merge!(liable_entity: @liable_entity)
25
- body.merge!(three_ds: @three_ds.to_h) if @three_ds
26
- body.merge!(fraud_free: @fraud_free.to_h) if @fraud_free
27
- body
22
+ hash = Hash.new
23
+ hash.merge!(liability_shift: @liability_shift)
24
+ hash.merge!(liable_entity: @liable_entity)
25
+ hash.merge!(three_ds: @three_ds.to_h) if @three_ds
26
+ hash.merge!(fraud_free: @fraud_free.to_h) if @fraud_free
27
+ hash
28
28
  end
29
29
  alias_method :to_h, :to_hash
30
30
 
@@ -9,7 +9,7 @@ module SixSaferpay
9
9
 
10
10
  def to_hash
11
11
  hash = Hash.new
12
- hash.merge!(pre_auth: @pre_auth) if @pre_auth
12
+ hash.merge!(pre_auth: @pre_auth) if !@pre_auth.nil?
13
13
  hash
14
14
  end
15
15
  alias_method :to_h, :to_hash
@@ -1,23 +1,4 @@
1
1
  module SixSaferpay
2
- class Payee
3
-
4
- attr_accessor(:iban, :holder_name, :bic, :bank_name)
5
-
6
- def initialize(iban:, holder_name: nil, bic: nil, bank_name: nil)
7
- @iban = iban
8
- @holder_name = holder_name
9
- @bic = bic
10
- @bank_name = bank_name
11
- end
12
-
13
- def to_hash
14
- body = Hash.new
15
- body.merge!(IBAN: @iban)
16
- body.merge!(holder_name: @holder_name) if @holder_name
17
- body.merge!(BIC: @bic) if @bic
18
- body.merge!(bank_name: @bank_name) if @bank_name
19
- body
20
- end
21
- alias_method :to_h, :to_hash
2
+ class Payee < SixSaferpay::BankAccount
22
3
  end
23
4
  end
@@ -24,7 +24,7 @@ module SixSaferpay
24
24
  @payer_note = payer_note
25
25
  @mandate_id = mandate_id
26
26
  @options = SixSaferpay::Options.new(options.to_h) if options
27
- @recurring = SixSaferpay.new(recurring.to_h) if recurring
27
+ @recurring = SixSaferpay::Recurring.new(recurring.to_h) if recurring
28
28
  @installment = SixSaferpay::Installment.new(installment.to_h) if installment
29
29
  end
30
30
 
@@ -1,5 +1,5 @@
1
1
  module SixSaferpay
2
- class PaymentMeans
2
+ class PaymentMeansAlias
3
3
 
4
4
  attr_accessor(:id,
5
5
  :verification_code
@@ -13,10 +13,10 @@ module SixSaferpay
13
13
  end
14
14
 
15
15
  def to_hash
16
- body = Hash.new
17
- body.merge!(Id: @id)
18
- body.merge!(VerificationCode: @verification_code) if @verification_code
19
- body
16
+ hash = Hash.new
17
+ hash.merge!(id: @id) if @id
18
+ hash.merge!(verification_code: @verification_code) if @verification_code
19
+ hash
20
20
  end
21
21
  alias_method :to_h, :to_hash
22
22
  end
@@ -4,7 +4,7 @@ module SixSaferpay
4
4
  attr_accessor(:alipay)
5
5
 
6
6
  def initialize(alipay: nil)
7
- @alipay = SixSaferpay::Alias.new(alipay.to_h) if alipay
7
+ @alipay = SixSaferpay::Alipay.new(alipay.to_h) if alipay
8
8
  end
9
9
 
10
10
  def to_hash
@@ -0,0 +1,22 @@
1
+ module SixSaferpay
2
+ class Redirect
3
+ attr_accessor(:redirect_url,
4
+ :payment_means_required
5
+ )
6
+
7
+ def initialize(redirect_url:,
8
+ payment_means_required: )
9
+ @redirect_url = redirect_url
10
+ @payment_means_required = payment_means_required
11
+ end
12
+
13
+ def to_hash
14
+ hash = Hash.new
15
+ hash.merge!(redirect_url: @redirect_url) if @redirect_url
16
+ hash.merge!(payment_means_required: @payment_means_required) if !@payment_means_required.nil?
17
+ hash
18
+ end
19
+ alias_method :to_h, :to_hash
20
+ end
21
+
22
+ end
@@ -1,6 +1,5 @@
1
1
  module SixSaferpay
2
2
  class RegisterAlias
3
-
4
3
  attr_accessor(:id_generator, :id, :lifetime)
5
4
 
6
5
  def initialize(id_generator:, id: nil, lifetime: nil)
@@ -11,7 +10,7 @@ module SixSaferpay
11
10
 
12
11
  def to_hash
13
12
  hash = Hash.new
14
- hash.merge!(id_generator: @id_generator)
13
+ hash.merge!(id_generator: @id_generator) if @id_generator
15
14
  hash.merge!(id: @id) if @id
16
15
  hash.merge!(lifetime: @lifetime) if @lifetime
17
16
  hash
@@ -20,4 +19,3 @@ module SixSaferpay
20
19
 
21
20
  end
22
21
  end
23
-
@@ -0,0 +1,23 @@
1
+ module SixSaferpay
2
+ class RegistrationAlias
3
+
4
+ attr_accessor(:id,
5
+ :lifetime
6
+ )
7
+
8
+ def initialize(id:,
9
+ lifetime: nil
10
+ )
11
+ @id = id
12
+ @lifetime = lifetime
13
+ end
14
+
15
+ def to_hash
16
+ hash = Hash.new
17
+ hash.merge!(id: @id) if @id
18
+ hash.merge!(lifetime: @lifetime) if @lifetime
19
+ hash
20
+ end
21
+ alias_method :to_h, :to_hash
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ module SixSaferpay
2
+ class RegistrationError
3
+
4
+ attr_accessor(:error_name,
5
+ :error_message
6
+ )
7
+
8
+
9
+ def initialize(error_name: nil,
10
+ error_message: nil)
11
+
12
+ @error_name = error_name
13
+ @error_message = error_message
14
+ end
15
+
16
+ def to_hash
17
+ hash = Hash.new
18
+ hash.merge!(error_name: @error_name) if @error_name
19
+ hash.merge!(error_message: @error_message) if @error_message
20
+ hash
21
+ end
22
+ alias_method :to_h, :to_hash
23
+
24
+ end
25
+ end
@@ -2,26 +2,28 @@ module SixSaferpay
2
2
  class RegistrationResult
3
3
 
4
4
  attr_accessor(:success,
5
- :alias,
5
+ :fd_alias,
6
6
  :error
7
7
  )
8
8
 
9
9
 
10
10
  def initialize(success:,
11
- alias: nil,
11
+ fd_alias: nil,
12
12
  error: nil)
13
13
 
14
14
  @success = success
15
- @alias = SixSaferpay::Alias.new(__alias__.to_h) if __alias__
16
- @error = SixSaferpay::Error.new(error.to_h) if error
15
+ @fd_alias = SixSaferpay::RegistrationAlias.new(fd_alias.to_h) if fd_alias
16
+ @error = SixSaferpay::RegistrationError.new(error.to_h) if error
17
17
  end
18
18
 
19
19
  def to_hash
20
20
  hash = Hash.new
21
- hash.merge!(sucess: @sucess) if @success
22
- hash.merge!(alias: @alias.to_h) if @alias
21
+ hash.merge!(success: @success) if !@success.nil?
22
+ hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
23
23
  hash.merge!(error: @error.to_h) if @error
24
+ hash
24
25
  end
26
+ alias_method :to_h, :to_hash
25
27
 
26
28
  end
27
29
  end
@@ -0,0 +1,36 @@
1
+ module SixSaferpay
2
+ class RequestCard
3
+
4
+ attr_accessor(:number,
5
+ :exp_year,
6
+ :exp_month,
7
+ :holder_name,
8
+ :verification_code
9
+ )
10
+
11
+ def initialize(number:,
12
+ exp_year:,
13
+ exp_month:,
14
+ holder_name: nil,
15
+ verification_code: nil
16
+ )
17
+ @number = number
18
+ @exp_year = exp_year
19
+ @exp_month = exp_month
20
+ @holder_name = holder_name
21
+ @verification_code = verification_code
22
+ end
23
+
24
+ def to_hash
25
+ hash = Hash.new
26
+ hash.merge!(number: @number)
27
+ hash.merge!(exp_year: @exp_year)
28
+ hash.merge!(exp_month: @exp_month)
29
+ hash.merge!(holder_name: @holder_name) if @holder_name
30
+ hash.merge!(verification_code: @verification_code) if @verification_code
31
+ hash
32
+ end
33
+ alias_method :to_h, :to_hash
34
+
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  module SixSaferpay
2
- class RequestHeader < Model
2
+ class RequestHeader
3
3
 
4
4
  attr_accessor :spec_version,
5
5
  :customer_id,
@@ -7,20 +7,24 @@ module SixSaferpay
7
7
  :retry_indicator,
8
8
  :client_info
9
9
 
10
- def initialize(client_info: nil)
11
- @spec_version = SixSaferpay::API::VERSION
12
- @customer_id = SixSaferpay.config.customer_id
13
- @request_id = SecureRandom.uuid
14
- @retry_indicator = 0
10
+ def initialize(spec_version: nil,
11
+ customer_id: nil,
12
+ request_id: nil,
13
+ retry_indicator: nil,
14
+ client_info: nil)
15
+ @spec_version = spec_version || SixSaferpay::API::VERSION
16
+ @customer_id = customer_id || SixSaferpay.config.customer_id
17
+ @request_id = request_id || SecureRandom.uuid
18
+ @retry_indicator = retry_indicator || 0
15
19
  @client_info = SixSaferpay::ClientInfo.new(client_info.to_h) if client_info
16
20
  end
17
21
 
18
22
  def to_hash
19
23
  hash = Hash.new
20
- hash.merge!(spec_version: @spec_version)
21
- hash.merge!(customer_id: @customer_id)
22
- hash.merge!(request_id: @request_id)
23
- hash.merge!(retry_indicator: @retry_indicator)
24
+ hash.merge!(spec_version: @spec_version) if @spec_version
25
+ hash.merge!(customer_id: @customer_id) if @customer_id
26
+ hash.merge!(request_id: @request_id) if @request_id
27
+ hash.merge!(retry_indicator: @retry_indicator) if @retry_indicator
24
28
  hash.merge!(client_info: @client_info.to_h) if @client_info
25
29
  hash
26
30
  end
@@ -0,0 +1,29 @@
1
+ module SixSaferpay
2
+ class RequestPaymentMeans
3
+
4
+ attr_accessor(:card,
5
+ :bank_account,
6
+ :fd_alias
7
+ )
8
+
9
+ def initialize(card: nil,
10
+ bank_account: nil,
11
+ fd_alias: nil
12
+ )
13
+ @card = SixSaferpay::RequestCard.new(card.to_h) if card
14
+ @bank_account = SixSaferpay::BankAccount.new(bank_account.to_h) if bank_account
15
+ @fd_alias = SixSaferpay::PaymentMeansAlias.new(fd_alias.to_h) if fd_alias
16
+ end
17
+
18
+ def to_hash
19
+ hash = Hash.new
20
+ hash.merge!(card: @card.to_h) if @card
21
+ hash.merge!(bank_account: @bank_account.to_h) if @bank_account
22
+ hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
23
+ hash
24
+ end
25
+ alias_method :to_h, :to_hash
26
+
27
+ end
28
+ end
29
+
@@ -0,0 +1,48 @@
1
+ module SixSaferpay
2
+ class ResponseCard
3
+
4
+ attr_accessor(:masked_number,
5
+ :exp_year,
6
+ :exp_month,
7
+ :holder_name,
8
+ :holder_segment,
9
+ :country_code,
10
+ :hash_value
11
+ # :verification_code
12
+ )
13
+
14
+ def initialize(masked_number:,
15
+ exp_year:,
16
+ exp_month:,
17
+ holder_name: nil,
18
+ holder_segment: nil,
19
+ country_code: nil,
20
+ hash_value: nil
21
+ # verification_code: nil
22
+ )
23
+ @masked_number = masked_number
24
+ @exp_year = exp_year
25
+ @exp_month = exp_month
26
+ @holder_name = holder_name
27
+ @holder_segment = holder_segment
28
+ @country_code = country_code
29
+ @hash_value = hash_value
30
+ # @verification_code = verification_code
31
+ end
32
+
33
+ def to_hash
34
+ hash = Hash.new
35
+ hash.merge!(masked_number: @masked_number)
36
+ hash.merge!(exp_year: @exp_year)
37
+ hash.merge!(exp_month: @exp_month)
38
+ hash.merge!(holder_name: @holder_name) if @holder_name
39
+ hash.merge!(holder_segment: @holder_segment) if @holder_segment
40
+ hash.merge!(country_code: @country_code) if @country_code
41
+ hash.merge!(hash_value: @hash_value) if @hash_value
42
+ # hash.merge!(verification_code: @verification_code) if @verification_code
43
+ hash
44
+ end
45
+ alias_method :to_h, :to_hash
46
+
47
+ end
48
+ end
@@ -9,10 +9,10 @@ module SixSaferpay
9
9
  end
10
10
 
11
11
  def to_hash
12
- body = Hash.new
13
- body.merge!(request_id: @request_id)
14
- body.merge!(spec_version: @spec_version)
15
- body
12
+ hash = Hash.new
13
+ hash.merge!(request_id: @request_id)
14
+ hash.merge!(spec_version: @spec_version)
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 PaymentMeans
2
+ class ResponsePaymentMeans
3
3
 
4
4
  attr_accessor(:brand,
5
5
  :display_text,
@@ -19,20 +19,20 @@ module SixSaferpay
19
19
  @brand = SixSaferpay::Brand.new(brand.to_h) if brand
20
20
  @display_text = display_text
21
21
  @wallet = wallet
22
- @card = SixSaferpay::Card.new(card.to_h) if card
23
- @bank_account = bank_account
22
+ @card = SixSaferpay::ResponseCard.new(card.to_h) if card
23
+ @bank_account = SixSaferpay::BankAccount.new(bank_account.to_h) if bank_account
24
24
  @twint = SixSaferpay::Twint.new(twint.to_h) if twint
25
25
  end
26
26
 
27
27
  def to_hash
28
- body = Hash.new
29
- body.merge!(brand: @brand.to_h)
30
- body.merge!(display_text: @display_text)
31
- body.merge!(wallet: @wallet) if @wallet
32
- body.merge!(card: @card.to_h) if @card
33
- body.merge!(bank_account: @bank_account) if @bank_account
34
- body.merge!(twint: @twint.to_h) if @twint
35
- body
28
+ hash = Hash.new
29
+ hash.merge!(brand: @brand.to_h)
30
+ hash.merge!(display_text: @display_text)
31
+ hash.merge!(wallet: @wallet) if @wallet
32
+ hash.merge!(card: @card.to_h) if @card
33
+ hash.merge!(bank_account: @bank_account.to_h) if @bank_account
34
+ hash.merge!(twint: @twint.to_h) if @twint
35
+ hash
36
36
  end
37
37
  alias_method :to_h, :to_hash
38
38
 
@@ -1,20 +1,20 @@
1
1
  module SixSaferpay
2
2
  class ReturnUrls
3
3
 
4
- attr_accessor :success, :fail, :abort
4
+ attr_accessor :success, :fd_fail, :fd_abort
5
5
 
6
- def initialize(success: nil, fail: nil, abort: nil)
6
+ def initialize(success: nil, fd_fail: nil, fd_abort: nil)
7
7
  @success = success || SixSaferpay.config.success_url
8
- @fail = fail || SixSaferpay.config.fail_url
9
- @abort = abort
8
+ @fd_fail = fd_fail || SixSaferpay.config.fail_url
9
+ @fd_abort = fd_abort
10
10
  end
11
11
 
12
12
  def to_hash
13
- body = Hash.new
14
- body.merge!(success: @success)
15
- body.merge!(fail: @fail)
16
- body.merge!(abort: @abort) if @abort
17
- body
13
+ hash = Hash.new
14
+ hash.merge!(success: @success) if @success
15
+ hash.merge!(fd_fail: @fd_fail) if @fd_fail
16
+ hash.merge!(fd_abort: @fd_abort) if @fd_abort
17
+ hash
18
18
  end
19
19
  alias_method :to_h, :to_hash
20
20
 
@@ -12,7 +12,7 @@ module SixSaferpay
12
12
  def to_hash
13
13
  hash = Hash.new
14
14
  hash.merge!(css_url: @css_url) if @css_url
15
- hash.merge!(content_security_enabled: @content_security_enabled) if @content_security_enabled
15
+ hash.merge!(content_security_enabled: @content_security_enabled) if !@content_security_enabled.nil?
16
16
  hash.merge!(theme: @theme) if @theme
17
17
  hash
18
18
  end
@@ -16,11 +16,12 @@ module SixSaferpay
16
16
  end
17
17
 
18
18
  def to_hash
19
- body = Hash.new
20
- body.merge!(authenticated: @authenticated)
21
- body.merge!(liability_shift: @liability_shift)
22
- body.merge!(xid: @xid) if @xid
23
- body.merge!(verification_value: @verification_value) if @verification_value
19
+ hash = Hash.new
20
+ hash.merge!(authenticated: @authenticated) if !@authenticated.nil?
21
+ hash.merge!(liability_shift: @liability_shift) if !@liability_shift.nil?
22
+ hash.merge!(xid: @xid) if @xid
23
+ hash.merge!(verification_value: @verification_value) if @verification_value
24
+ hash
24
25
  end
25
26
  alias_method :to_h, :to_hash
26
27
 
@@ -47,21 +47,21 @@ module SixSaferpay
47
47
  end
48
48
 
49
49
  def to_hash
50
- body = Hash.new
51
- body.merge!(type: @type)
52
- body.merge!(status: @status)
53
- body.merge!(id: @id)
54
- body.merge!(capture_id: @capture_id) if @capture_id
55
- body.merge!(date: @date)
56
- body.merge!(amount: @amount.to_h)
57
- body.merge!(order_id: @order_id) if @order_id
58
- body.merge!(acquirer_name: @acquirer_name) if @acquirer_name
59
- body.merge!(acquirer_reference: @acquirer_reference) if @acquirer_reference
60
- body.merge!(six_transaction_reference: @six_transaction_reference)
61
- body.merge!(approval_code: @approval_code) if @approval_code
62
- body.merge!(direct_debit: @direct_debit.to_h) if @direct_debit
63
- body.merge!(invoice: @invoice.to_h) if @invoice
64
- body
50
+ hash = Hash.new
51
+ hash.merge!(type: @type)
52
+ hash.merge!(status: @status)
53
+ hash.merge!(id: @id)
54
+ hash.merge!(capture_id: @capture_id) if @capture_id
55
+ hash.merge!(date: @date)
56
+ hash.merge!(amount: @amount.to_h)
57
+ hash.merge!(order_id: @order_id) if @order_id
58
+ hash.merge!(acquirer_name: @acquirer_name) if @acquirer_name
59
+ hash.merge!(acquirer_reference: @acquirer_reference) if @acquirer_reference
60
+ hash.merge!(six_transaction_reference: @six_transaction_reference)
61
+ hash.merge!(approval_code: @approval_code) if @approval_code
62
+ hash.merge!(direct_debit: @direct_debit.to_h) if @direct_debit
63
+ hash.merge!(invoice: @invoice.to_h) if @invoice
64
+ hash
65
65
  end
66
66
  alias_method :to_h, :to_hash
67
67
 
@@ -8,9 +8,9 @@ module SixSaferpay
8
8
  end
9
9
 
10
10
  def to_hash
11
- body = Hash.new
12
- body.merge!(certificate_expiration_date: @certificate_expiration_date)
13
- body
11
+ hash = Hash.new
12
+ hash.merge!(certificate_expiration_date: @certificate_expiration_date)
13
+ hash
14
14
  end
15
15
  alias_method :to_h, :to_hash
16
16