Class: SixSaferpay::SixSecurePayGateOffer::CreateOffer

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payment:, expiration_date:, config_set: nil, payer:, billing_address_form: nil, register_alias: nil) ⇒ CreateOffer

Returns a new instance of CreateOffer.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 13

def initialize(payment: ,
               expiration_date: ,
               config_set: nil,
               payer: ,
               billing_address_form: nil,
               register_alias: nil
              )

  @payment = SixSaferpay::Payment.new(**payment.to_h) if payment
  @expiration_date = expiration_date
  @config_set = config_set
  @payer = SixSaferpay::Payer.new(**payer.to_h) if payer
  @billing_address_form =
    SixSaferpay::BillingAddressForm.new(**billing_address_form) if billing_address_form
  @register_alias = SixSaferpay::RegisterAlias.new(**register_alias.to_h) if register_alias
end

Instance Attribute Details

#billing_address_formObject

Returns the value of attribute billing_address_form.



5
6
7
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 5

def billing_address_form
  @billing_address_form
end

#config_setObject

Returns the value of attribute config_set.



5
6
7
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 5

def config_set
  @config_set
end

#expiration_dateObject

Returns the value of attribute expiration_date.



5
6
7
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 5

def expiration_date
  @expiration_date
end

#payerObject

Returns the value of attribute payer.



5
6
7
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 5

def payer
  @payer
end

#paymentObject

Returns the value of attribute payment.



5
6
7
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 5

def payment
  @payment
end

Instance Method Details

#response_classObject



50
51
52
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 50

def response_class
  SixSaferpay::SixSecurePayGateOffer::CreateOfferResponse
end

#to_hashObject Also known as: to_h



30
31
32
33
34
35
36
37
38
39
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 30

def to_hash
  hash = Hash.new
  hash.merge!(payment: @payment.to_h) if @payment
  hash.merge!(expiration_date: @expiration_date) if @expiration_date
  hash.merge!(config_set: @config_set) if @config_set
  hash.merge!(payer: @payer.to_h) if @payer
  hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
  hash
end

#to_jsonObject



42
43
44
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 42

def to_json
  to_hash.to_json
end

#urlObject



46
47
48
# File 'lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb', line 46

def url
  "/rest/customers/#{customer_id}/terminals/#{terminal_id}/spg-offers"
end