Class: UnivapayClientSdk::MerchantWebhookCardBrandPercentFees

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb

Overview

Per-card-brand percent fee overrides.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(visa: SKIP, american_express: SKIP, mastercard: SKIP, maestro: SKIP, discover: SKIP, jcb: SKIP, diners_club: SKIP, union_pay: SKIP, private_label: SKIP, additional_properties: nil) ⇒ MerchantWebhookCardBrandPercentFees

Returns a new instance of MerchantWebhookCardBrandPercentFees.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 93

def initialize(visa: SKIP, american_express: SKIP, mastercard: SKIP,
               maestro: SKIP, discover: SKIP, jcb: SKIP, diners_club: SKIP,
               union_pay: SKIP, private_label: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @visa = visa unless visa == SKIP
  @american_express = american_express unless american_express == SKIP
  @mastercard = mastercard unless mastercard == SKIP
  @maestro = maestro unless maestro == SKIP
  @discover = discover unless discover == SKIP
  @jcb = jcb unless jcb == SKIP
  @diners_club = diners_club unless diners_club == SKIP
  @union_pay = union_pay unless union_pay == SKIP
  @private_label = private_label unless private_label == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#american_expressFloat

Percent fee override applied to American Express transactions.

Returns:

  • (Float)


18
19
20
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 18

def american_express
  @american_express
end

#diners_clubFloat

Percent fee override applied to Diners Club transactions.

Returns:

  • (Float)


38
39
40
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 38

def diners_club
  @diners_club
end

#discoverFloat

Percent fee override applied to Discover transactions.

Returns:

  • (Float)


30
31
32
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 30

def discover
  @discover
end

#jcbFloat

Percent fee override applied to JCB transactions.

Returns:

  • (Float)


34
35
36
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 34

def jcb
  @jcb
end

#maestroFloat

Percent fee override applied to Maestro transactions.

Returns:

  • (Float)


26
27
28
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 26

def maestro
  @maestro
end

#mastercardFloat

Percent fee override applied to Mastercard transactions.

Returns:

  • (Float)


22
23
24
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 22

def mastercard
  @mastercard
end

#private_labelFloat

Percent fee override applied to private-label card transactions.

Returns:

  • (Float)


46
47
48
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 46

def private_label
  @private_label
end

#union_payFloat

Percent fee override applied to UnionPay transactions.

Returns:

  • (Float)


42
43
44
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 42

def union_pay
  @union_pay
end

#visaFloat

Percent fee override applied to Visa transactions.

Returns:

  • (Float)


14
15
16
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 14

def visa
  @visa
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  visa = hash.key?('visa') ? hash['visa'] : SKIP
  american_express =
    hash.key?('american_express') ? hash['american_express'] : SKIP
  mastercard = hash.key?('mastercard') ? hash['mastercard'] : SKIP
  maestro = hash.key?('maestro') ? hash['maestro'] : SKIP
  discover = hash.key?('discover') ? hash['discover'] : SKIP
  jcb = hash.key?('jcb') ? hash['jcb'] : SKIP
  diners_club = hash.key?('diners_club') ? hash['diners_club'] : SKIP
  union_pay = hash.key?('union_pay') ? hash['union_pay'] : SKIP
  private_label = hash.key?('private_label') ? hash['private_label'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  MerchantWebhookCardBrandPercentFees.new(visa: visa,
                                          american_express: american_express,
                                          mastercard: mastercard,
                                          maestro: maestro,
                                          discover: discover,
                                          jcb: jcb,
                                          diners_club: diners_club,
                                          union_pay: union_pay,
                                          private_label: private_label,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['visa'] = 'visa'
  @_hash['american_express'] = 'american_express'
  @_hash['mastercard'] = 'mastercard'
  @_hash['maestro'] = 'maestro'
  @_hash['discover'] = 'discover'
  @_hash['jcb'] = 'jcb'
  @_hash['diners_club'] = 'diners_club'
  @_hash['union_pay'] = 'union_pay'
  @_hash['private_label'] = 'private_label'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 79

def self.nullables
  %w[
    visa
    american_express
    mastercard
    maestro
    discover
    jcb
    diners_club
    union_pay
    private_label
  ]
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 64

def self.optionals
  %w[
    visa
    american_express
    mastercard
    maestro
    discover
    jcb
    diners_club
    union_pay
    private_label
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
164
165
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} visa: #{@visa.inspect}, american_express: #{@american_express.inspect},"\
  " mastercard: #{@mastercard.inspect}, maestro: #{@maestro.inspect}, discover:"\
  " #{@discover.inspect}, jcb: #{@jcb.inspect}, diners_club: #{@diners_club.inspect},"\
  " union_pay: #{@union_pay.inspect}, private_label: #{@private_label.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
155
# File 'lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} visa: #{@visa}, american_express: #{@american_express}, mastercard:"\
  " #{@mastercard}, maestro: #{@maestro}, discover: #{@discover}, jcb: #{@jcb}, diners_club:"\
  " #{@diners_club}, union_pay: #{@union_pay}, private_label: #{@private_label},"\
  " additional_properties: #{@additional_properties}>"
end