six_saferpay 0.0.1 → 0.1.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/.gitignore +3 -0
  3. data/Gemfile.lock +58 -0
  4. data/lib/six_saferpay/api/six_payment_page/requests/assert.rb +34 -0
  5. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +96 -0
  6. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +46 -0
  7. data/lib/six_saferpay/api/six_payment_page/responses/initalize_response.rb +44 -0
  8. data/lib/six_saferpay/api/six_payment_page.rb +10 -0
  9. data/lib/six_saferpay/api/six_transaction/requests/authorization.rb +33 -0
  10. data/lib/six_saferpay/api/six_transaction/requests/cancel.rb +33 -0
  11. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +54 -0
  12. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +73 -0
  13. data/lib/six_saferpay/api/six_transaction/responses/capture_response.rb +32 -0
  14. data/lib/six_saferpay/api/six_transaction/responses/initialize_response.rb +12 -0
  15. data/lib/six_saferpay/api/six_transaction.rb +4 -0
  16. data/lib/six_saferpay/api.rb +1 -4
  17. data/lib/six_saferpay/client.rb +17 -5
  18. data/lib/six_saferpay/error.rb +11 -0
  19. data/lib/six_saferpay/model.rb +5 -0
  20. data/lib/six_saferpay/models/address.rb +73 -0
  21. data/lib/six_saferpay/models/address_form.rb +21 -0
  22. data/lib/six_saferpay/models/alias.rb +23 -0
  23. data/lib/six_saferpay/models/alipay.rb +18 -0
  24. data/lib/six_saferpay/models/amount.rb +19 -0
  25. data/lib/six_saferpay/models/bank_account.rb +35 -0
  26. data/lib/six_saferpay/models/billing_address.rb +4 -0
  27. data/lib/six_saferpay/models/billing_address_form.rb +4 -0
  28. data/lib/six_saferpay/models/billpay.rb +18 -0
  29. data/lib/six_saferpay/models/brand.rb +20 -0
  30. data/lib/six_saferpay/models/card.rb +40 -0
  31. data/lib/six_saferpay/models/card_form.rb +18 -0
  32. data/lib/six_saferpay/models/client_info.rb +20 -0
  33. data/lib/six_saferpay/models/dcc.rb +18 -0
  34. data/lib/six_saferpay/models/debit_direct.rb +20 -0
  35. data/lib/six_saferpay/models/delivery_address.rb +4 -0
  36. data/lib/six_saferpay/models/delivery_address_form.rb +4 -0
  37. data/lib/six_saferpay/models/fee.rb +4 -0
  38. data/lib/six_saferpay/models/fee_refund.rb +4 -0
  39. data/lib/six_saferpay/models/installment.rb +18 -0
  40. data/lib/six_saferpay/models/invoice.rb +22 -0
  41. data/lib/six_saferpay/models/liability.rb +36 -0
  42. data/lib/six_saferpay/models/marketplace.rb +22 -0
  43. data/lib/six_saferpay/models/notification.rb +26 -0
  44. data/lib/six_saferpay/models/options.rb +18 -0
  45. data/lib/six_saferpay/models/payee.rb +23 -0
  46. data/lib/six_saferpay/models/payer.rb +27 -7
  47. data/lib/six_saferpay/models/payer_amount.rb +22 -0
  48. data/lib/six_saferpay/models/payment.rb +33 -14
  49. data/lib/six_saferpay/models/payment_means.rb +40 -0
  50. data/lib/six_saferpay/models/payment_methods_options.rb +18 -0
  51. data/lib/six_saferpay/models/pending_notification.rb +20 -0
  52. data/lib/six_saferpay/models/recurring.rb +18 -0
  53. data/lib/six_saferpay/models/register_alias.rb +23 -0
  54. data/lib/six_saferpay/models/registration_result.rb +27 -0
  55. data/lib/six_saferpay/models/request_header.rb +12 -11
  56. data/lib/six_saferpay/models/response_header.rb +20 -0
  57. data/lib/six_saferpay/models/return_urls.rb +12 -10
  58. data/lib/six_saferpay/models/six_transaction/initialize/card.rb +44 -0
  59. data/lib/six_saferpay/models/six_transaction/initialize/payment_means.rb +32 -0
  60. data/lib/six_saferpay/models/six_transaction/initialize.rb +6 -0
  61. data/lib/six_saferpay/models/six_transaction.rb +4 -0
  62. data/lib/six_saferpay/models/styling.rb +12 -7
  63. data/lib/six_saferpay/models/terminal.rb +14 -14
  64. data/lib/six_saferpay/models/three_ds.rb +28 -0
  65. data/lib/six_saferpay/models/transaction.rb +69 -0
  66. data/lib/six_saferpay/models/transaction_reference.rb +11 -7
  67. data/lib/six_saferpay/models/twint.rb +18 -0
  68. data/lib/six_saferpay/models/verification_code.rb +4 -2
  69. data/lib/six_saferpay/models/wallet.rb +32 -0
  70. data/lib/six_saferpay/version.rb +1 -1
  71. data/lib/six_saferpay.rb +6 -15
  72. data/six_saferpay.gemspec +12 -5
  73. metadata +131 -15
  74. data/.rspec_status +0 -28
  75. data/lib/six_saferpay/api/payment_page/assert.rb +0 -30
  76. data/lib/six_saferpay/api/payment_page/initialize.rb +0 -35
  77. data/lib/six_saferpay/api/payment_page.rb +0 -20
  78. data/lib/six_saferpay/api/transaction/authorization.rb +0 -31
  79. data/lib/six_saferpay/api/transaction/cancel.rb +0 -31
  80. data/lib/six_saferpay/api/transaction/capture.rb +0 -31
  81. data/lib/six_saferpay/api/transaction/initialize.rb +0 -36
  82. data/lib/six_saferpay/api/transaction.rb +0 -22
  83. data/lib/six_saferpay/models/token.rb +0 -18
@@ -1,25 +1,44 @@
1
1
  module SixSaferpay
2
2
  class Payment
3
- attr_accessor :value, :currency, :order_id, :description
3
+ attr_accessor(:amount,
4
+ :order_id,
5
+ :description,
6
+ :payer_note,
7
+ :mandate_id,
8
+ :options,
9
+ :recurring,
10
+ :installment
11
+ )
4
12
 
5
- def initialize(value, currency, order_id, description)
6
- @value = value
7
- @currency = currency
13
+ def initialize(amount:,
14
+ order_id: nil,
15
+ description:,
16
+ payer_note: nil,
17
+ mandate_id: nil,
18
+ options: nil,
19
+ recurring: nil,
20
+ installment: nil)
21
+ @amount = SixSaferpay::Amount.new(amount.to_h) if amount
8
22
  @order_id = order_id
9
23
  @description = description
24
+ @payer_note = payer_note
25
+ @mandate_id = mandate_id
26
+ @options = SixSaferpay::Options.new(options.to_h) if options
27
+ @recurring = SixSaferpay.new(recurring.to_h) if recurring
28
+ @installment = SixSaferpay::Installment.new(installment.to_h) if installment
10
29
  end
11
30
 
12
31
  def to_hash
13
- {
14
- 'Payment': {
15
- 'Amount': {
16
- 'Value': @value,
17
- 'CurrencyCode': @currency
18
- },
19
- 'OrderId': @order_id,
20
- 'Description': @description
21
- }
22
- }
32
+ hash = Hash.new
33
+ hash.merge!(amount: @amount.to_h)
34
+ hash.merge!(order_id: @order_id) if @order_id
35
+ hash.merge!(description: @description)
36
+ hash.merge!(payer_note: @payer_note) if @payer_note
37
+ hash.merge!(mandate_id: @mandate_id) if @mandate_id
38
+ hash.merge!(options: @options.to_h) if @options
39
+ hash.merge!(recurring: @recurring.to_h) if @recurring
40
+ hash.merge!(installment: @installment.to_h) if @installment
41
+ hash
23
42
  end
24
43
  alias_method :to_h, :to_hash
25
44
  end
@@ -0,0 +1,40 @@
1
+ module SixSaferpay
2
+ class PaymentMeans
3
+
4
+ attr_accessor(:brand,
5
+ :display_text,
6
+ :wallet,
7
+ :card,
8
+ :bank_account,
9
+ :twint
10
+ )
11
+
12
+ def initialize(brand:,
13
+ display_text:,
14
+ wallet: nil,
15
+ card: nil,
16
+ bank_account: nil,
17
+ twint: nil
18
+ )
19
+ @brand = brand
20
+ @display_text = display_text
21
+ @wallet = wallet
22
+ @card = card
23
+ @bank_account = bank_account
24
+ @twint = twint
25
+ end
26
+
27
+ def to_hash
28
+ body = Hash.new
29
+ body.merge!(Brand: @brand.to_h)
30
+ body.merge!(DisplayText: @display_text)
31
+ body.merge!(Wallet: @wallet) if @wallet
32
+ body.merge!(Card: @card.to_h) if @card
33
+ body.merge!(BankAccount: @bank_account) if @bank_account
34
+ body.merge!(Twint: @twint.to_h) if @twint
35
+ body
36
+ end
37
+ alias_method :to_h, :to_hash
38
+
39
+ end
40
+ end
@@ -0,0 +1,18 @@
1
+ module SixSaferpay
2
+ class PaymentMethodsOptions
3
+
4
+ attr_accessor(:alipay)
5
+
6
+ def initialize(alipay: nil)
7
+ @alipay = SixSaferpay::Alias.new(alipay.to_h) if alipay
8
+ end
9
+
10
+ def to_hash
11
+ hash = Hash.new
12
+ hash.merge!(alipay: @alipay.to_h) if @alipay
13
+ hash
14
+ end
15
+ alias_method :to_h, :to_hash
16
+
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class PendingNotification
3
+
4
+ attr_accessor(:merchant_email, :notify_url)
5
+
6
+ def initialize(merchant_email: nil, notify_url: nil)
7
+ @merchant_email = merchant_email
8
+ @notify_url = notify_url
9
+ end
10
+
11
+ def to_hash
12
+ hash = Hash.new
13
+ hash.merge!(merchant_email: @merchant_email) if @merchant_email
14
+ hash.merge!(notify_url: @notify_url) if @notify_url
15
+ hash
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module SixSaferpay
2
+ class Recurring
3
+
4
+ attr_accessor(:initial)
5
+
6
+ def initialize(initial:)
7
+ @initial = initial
8
+ end
9
+
10
+ def to_hash
11
+ hash = Hash.new
12
+ hash.merge!(initial: @initial)
13
+ hash
14
+ end
15
+ alias_method :to_h, :to_hash
16
+
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ module SixSaferpay
2
+ class RegisterAlias
3
+
4
+ attr_accessor(:id_generator, :id, :lifetime)
5
+
6
+ def initialize(id_generator:, id: nil, lifetime: nil)
7
+ @id_generator = id_generator
8
+ @id = id
9
+ @lifetime = lifetime
10
+ end
11
+
12
+ def to_hash
13
+ hash = Hash.new
14
+ hash.merge!(id_generator: @id_generator)
15
+ hash.merge!(id: @id) if @id
16
+ hash.merge!(lifetime: @lifetime) if @lifetime
17
+ hash
18
+ end
19
+ alias_method :to_h, :to_hash
20
+
21
+ end
22
+ end
23
+
@@ -0,0 +1,27 @@
1
+ module SixSaferpay
2
+ class RegistrationResult
3
+
4
+ attr_accessor(:success,
5
+ :alias,
6
+ :error
7
+ )
8
+
9
+
10
+ def initialize(success:,
11
+ alias: nil,
12
+ error: nil)
13
+
14
+ @success = success
15
+ @alias = SixSaferpay::Alias.new(__alias__.to_h) if __alias__
16
+ @error = SixSaferpay::Error.new(error.to_h) if error
17
+ end
18
+
19
+ def to_hash
20
+ hash = Hash.new
21
+ hash.merge!(Success: @sucess) if @success
22
+ hash.merge!(Alias: @alias.to_h) if @alias
23
+ hash.merge!(Error: @error.to_h) if @error
24
+ end
25
+
26
+ end
27
+ end
@@ -1,27 +1,28 @@
1
1
  module SixSaferpay
2
- class RequestHeader
2
+ class RequestHeader < Model
3
3
 
4
4
  attr_accessor :spec_version,
5
5
  :customer_id,
6
6
  :request_id,
7
- :retry_indicator
7
+ :retry_indicator,
8
+ :client_info
8
9
 
9
- def initialize
10
+ def initialize(client_info: nil)
10
11
  @spec_version = SixSaferpay::API::VERSION
11
12
  @customer_id = SixSaferpay.config.customer_id
12
13
  @request_id = SecureRandom.uuid
13
14
  @retry_indicator = 0
15
+ @client_info = SixSaferpay::ClientInfo.new(client_info.to_h) if client_info
14
16
  end
15
17
 
16
18
  def to_hash
17
- {
18
- 'RequestHeader': {
19
- 'SpecVersion': @spec_version,
20
- 'CustomerId': @customer_id,
21
- 'RequestId': @request_id,
22
- 'RetryIndicator': @retry_indicator
23
- }
24
- }
19
+ 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!(client_info: @client_info.to_h) if @client_info
25
+ hash
25
26
  end
26
27
  alias_method :to_h, :to_hash
27
28
 
@@ -0,0 +1,20 @@
1
+ module SixSaferpay
2
+ class ResponseHeader
3
+
4
+ attr_accessor(:request_id, :spec_version)
5
+
6
+ def initialize(request_id:, spec_version:)
7
+ @request_id = request_id
8
+ @spec_version = spec_version
9
+ end
10
+
11
+ def to_hash
12
+ body = Hash.new
13
+ body.merge!(RequestId: @request_id)
14
+ body.merge!(SpecVersion: @spec_version)
15
+ body
16
+ end
17
+ alias_method :to_h, :to_hash
18
+
19
+ end
20
+ end
@@ -1,20 +1,22 @@
1
1
  module SixSaferpay
2
2
  class ReturnUrls
3
- attr_accessor :success_url, :fail_url
4
3
 
5
- def initialize
6
- @success_url = SixSaferpay.config.success_url
7
- @fail_url = SixSaferpay.config.fail_url
4
+ attr_accessor :success, :fail, :abort
5
+
6
+ def initialize(success: nil, fail: nil, abort: nil)
7
+ @success = success || SixSaferpay.config.success_url
8
+ @fail = fail || SixSaferpay.config.fail_url
9
+ @abort = abort
8
10
  end
9
11
 
10
12
  def to_hash
11
- {
12
- 'ReturnUrls': {
13
- 'Success': @success_url,
14
- 'Fail': @fail_url
15
- }
16
- }
13
+ body = Hash.new
14
+ body.merge!(Success: @success)
15
+ body.merge!(Fail: @fail)
16
+ body.merge!(Abort: @abort) if @abort
17
+ body
17
18
  end
18
19
  alias_method :to_h, :to_hash
20
+
19
21
  end
20
22
  end
@@ -0,0 +1,44 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ module Initialize
4
+ class Card
5
+
6
+ attr_accessor(:number,
7
+ :exp_year,
8
+ :exp_month,
9
+ :holder_name,
10
+ :country_code,
11
+ :hash_value
12
+ )
13
+
14
+ def initialize(number:,
15
+ exp_year:,
16
+ exp_month:,
17
+ holder_name: nil,
18
+ country_code: nil,
19
+ hash_value: nil
20
+ )
21
+ @number = number
22
+ @exp_year = exp_year
23
+ @exp_month = exp_month
24
+ @holder_name = holder_name
25
+ @country_code = country_code
26
+ @hash_value = hash_value
27
+ end
28
+
29
+ def to_hash
30
+ body = Hash.new
31
+ body.merge!(Number: @number)
32
+ body.merge!(ExpYear: @exp_year)
33
+ body.merge!(ExpMonth: @exp_month)
34
+ body.merge!(HolderName: @holder_name) if @holder_name
35
+ body.merge!(CountryCode: @country_code) if @country_code
36
+ body.merge!(HashValue: @hash_value) if @hash_value
37
+ body
38
+ end
39
+ alias_method :to_h, :to_hash
40
+
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,32 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ module Initialize
4
+ class PaymentMeans
5
+
6
+ attr_accessor(:card,
7
+ :bank_account,
8
+ :six_alias
9
+ )
10
+
11
+ def initialize(card: nil,
12
+ bank_account: nil,
13
+ six_alias: nil
14
+ )
15
+ @card = card
16
+ @bank_account = bank_account
17
+ @six_alias = six_alias
18
+ end
19
+
20
+ def to_hash
21
+ body = Hash.new
22
+ body.merge!(Card: @card.to_h) if @card
23
+ body.merge!(BankAccount: @bank_account.to_h) if @bank_account
24
+ body.merge!(Alias: @six_alias.to_h) if @six_alias
25
+ body
26
+ end
27
+ alias_method :to_h, :to_hash
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,6 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ module Initialize
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module SixSaferpay
2
+ module SixTransaction
3
+ end
4
+ end
@@ -1,17 +1,22 @@
1
1
  module SixSaferpay
2
2
  class Styling
3
3
 
4
- def initialize
5
- @css_url = SixSaferpay.config.css_url || ''
4
+ attr_accessor(:css_url, :content_security_enabled, :theme)
5
+
6
+ def initialize(css_url: nil, content_security_enabled: nil, theme: nil)
7
+ @css_url = css_url || SixSaferpay.config.css_url
8
+ @content_security_enabled = content_security_enabled
9
+ @theme = theme
6
10
  end
7
11
 
8
12
  def to_hash
9
- {
10
- 'Styling': {
11
- 'CssUrl': @css_url
12
- }
13
- }
13
+ hash = Hash.new
14
+ hash.merge!(css_url: @css_url) if @css_url
15
+ hash.merge!(content_security_enabled: @content_security_enabled) if @content_security_enabled
16
+ hash.merge!(theme: @theme) if @theme
17
+ hash
14
18
  end
15
19
  alias_method :to_h, :to_hash
20
+
16
21
  end
17
22
  end
@@ -1,16 +1,16 @@
1
- module SixSaferpay
2
- class Terminal
3
- attr_accessor :terminal_id
1
+ # module SixSaferpay
2
+ # class Terminal
3
+ # attr_accessor :terminal_id
4
4
 
5
- def initialize
6
- @terminal_id = SixSaferpay.config.terminal_id
7
- end
5
+ # def initialize(terminal_id: terminal_id )
6
+ # @terminal_id = terminal_id || SixSaferpay.config.terminal_id
7
+ # end
8
8
 
9
- def to_hash
10
- {
11
- "TerminalId": @terminal_id
12
- }
13
- end
14
- alias_method :to_h, :to_hash
15
- end
16
- end
9
+ # def to_hash
10
+ # {
11
+ # TerminalId: @terminal_id
12
+ # }
13
+ # end
14
+ # alias_method :to_h, :to_hash
15
+ # end
16
+ # end
@@ -0,0 +1,28 @@
1
+ module SixSaferpay
2
+ class ThreeDs
3
+
4
+ attr_accessor(:authenticated, :liability_shift, :xid, :verification_value)
5
+
6
+ def initialize(authenticated:,
7
+ liability_shift:,
8
+ xid:,
9
+ verification_value: nil
10
+ )
11
+
12
+ @authenticated = authenticated
13
+ @liability_shift = liability_shift
14
+ @xid = xid
15
+ @verification_value = verification_value
16
+ end
17
+
18
+ def to_hash
19
+ body = Hash.new
20
+ body.merge!(Authenticated: @authenticated)
21
+ body.merge!(LiabilityShift: @liability_shift)
22
+ body.merge!(Xid: @xid) if @xid
23
+ body.merge!(VerificationValue: @verification_value) if @verification_value
24
+ end
25
+ alias_method :to_h, :to_hash
26
+
27
+ end
28
+ end
@@ -0,0 +1,69 @@
1
+ module SixSaferpay
2
+ class Transaction
3
+
4
+ attr_accessor(
5
+ :type,
6
+ :status,
7
+ :id,
8
+ :capture_id,
9
+ :date,
10
+ :amount,
11
+ :order_id,
12
+ :acquirer_name,
13
+ :acquirer_reference,
14
+ :six_transaction_reference,
15
+ :approval_code,
16
+ :direct_debit,
17
+ :invoice
18
+ )
19
+
20
+ def initialize(type:,
21
+ status:,
22
+ id:,
23
+ capture_id: nil,
24
+ date:,
25
+ amount:,
26
+ order_id: nil,
27
+ acquirer_name: nil,
28
+ acquirer_reference: nil,
29
+ six_transaction_reference:,
30
+ approval_code: nil,
31
+ direct_debit: nil,
32
+ invoice: nil
33
+ )
34
+ @type = type
35
+ @status = status
36
+ @id = id
37
+ @capture_id = capture_id
38
+ @date = date
39
+ @amount = SixSaferpay::Amount.new(amount)
40
+ @order_id = order_id
41
+ @acquirer_name = acquirer_name
42
+ @acquirer_reference = acquirer_reference
43
+ @six_transaction_reference = six_transaction_reference
44
+ @approval_code = approval_code
45
+ @direct_debit = SixSaferpay::DirectDebit.new(direct_debit) if direct_debit
46
+ @invoice = SixSaferpay::Invoice.new(invoice) if invoice
47
+ end
48
+
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!(CaptureId: @capture_id) if @capture_id
55
+ body.merge!(Date: @date)
56
+ body.merge!(Amount: @amount.to_h)
57
+ body.merge!(OrderId: @order_id) if @order_id
58
+ body.merge!(AcquirerName: @acquirer_name) if @acquirer_name
59
+ body.merge!(AcquirerReference: @acquirer_reference) if @acquirer_reference
60
+ body.merge!(SixTransactionReference: @six_transaction_reference)
61
+ body.merge!(ApprovalCode: @approval_code) if @approval_code
62
+ body.merge!(DirectDebit: @direct_debit.to_h) if @direct_debit
63
+ body.merge!(Invoice: @invoice.to_h) if @invoice
64
+ body
65
+ end
66
+ alias_method :to_h, :to_hash
67
+
68
+ end
69
+ end
@@ -1,18 +1,22 @@
1
1
  module SixSaferpay
2
2
  class TransactionReference
3
- attr_accessor :transaction_id
4
3
 
5
- def initialize(transaction_id)
4
+ attr_accessor(:transaction_id,
5
+ :order_id
6
+ )
7
+
8
+ def initialize(transaction_id: nil, order_id: nil)
6
9
  @transaction_id = transaction_id
10
+ @order_id = order_id
7
11
  end
8
12
 
9
13
  def to_hash
10
- {
11
- 'TransactionReference': {
12
- 'TransactionId': @transaction_id
13
- }
14
- }
14
+ hash = Hash.new
15
+ hash.merge!(transaction_id: @transaction_id) if @transaction_id
16
+ hash.merge!(order_id: @order_id) if @order_id
17
+ hash
15
18
  end
16
19
  alias_method :to_h, :to_hash
20
+
17
21
  end
18
22
  end
@@ -0,0 +1,18 @@
1
+ module SixSaferpay
2
+ class Twint
3
+
4
+ attr_accessor(:certificate_expiration_date)
5
+
6
+ def initialize(certificate_expiration_date:)
7
+ @certificate_expiration_date = certificate_expiration_date
8
+ end
9
+
10
+ def to_hash
11
+ body = Hash.new
12
+ body.merge!(CertificateExpirationDate: @certificate_expiration_date)
13
+ body
14
+ end
15
+ alias_method :to_h, :to_hash
16
+
17
+ end
18
+ end
@@ -3,14 +3,16 @@ module SixSaferpay
3
3
 
4
4
  attr_accessor :code
5
5
 
6
- def initialize(code)
6
+ def initialize(code: code)
7
7
  @code = code
8
8
  end
9
9
 
10
10
  def to_hash
11
11
  {
12
- "VerificationCode": @code
12
+ VerificationCode: @code
13
13
  }
14
14
  end
15
+ alias_method :to_h, :to_hash
16
+
15
17
  end
16
18
  end
@@ -0,0 +1,32 @@
1
+ module SixSaferpay
2
+ class Wallet
3
+
4
+ attr_accessor(:type,
5
+ :payment_methods,
6
+ :request_delivery_address,
7
+ :enable_amount_adjustment
8
+ )
9
+
10
+ def initialize(type:,
11
+ payment_methods: nil,
12
+ request_delivery_address: nil,
13
+ enable_amount_adjustment: nil
14
+ )
15
+ @type = type
16
+ @payment_methods = payment_methods
17
+ @request_delivery_address = request_delivery_address
18
+ @enable_amount_adjustment = enable_amount_adjustment
19
+ end
20
+
21
+ def to_hash
22
+ body = Hash.new
23
+ body.merge!(Type: @type)
24
+ body.merge!(PaymentMethods: @payment_methods) if @payment_methods
25
+ body.merge!(RequestDeliveryAddress: @request_delivery_address) if @request_delivery_address
26
+ body.merge!(EnableAmountAdjustment: @enable_amount_adjustment) if @enable_amount_adjustment
27
+ body
28
+ end
29
+ alias_method :to_h, :to_hash
30
+
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module SixSaferpay
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end