Class: ShellSmartPayApi::PaymentProperties

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/payment_properties.rb

Overview

Object containing Payment Property details Please note: All the attributes are optional as they serve all payment methods (i.e. different payment methods require different fields to be filled/mandated). As a result, some of these fields will be mandatory depending on the selected payment method and the API will return an error if they are not completed

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(card_identifier = nil, payment_type = SKIP, client_metadata_id = SKIP, token = SKIP, identifier = SKIP, network = SKIP, odometer = SKIP, fleet_id = SKIP, external_ref_id = SKIP) ⇒ PaymentProperties

Returns a new instance of PaymentProperties.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 119

def initialize(card_identifier = nil, payment_type = SKIP,
                = SKIP, token = SKIP, identifier = SKIP,
               network = SKIP, odometer = SKIP, fleet_id = SKIP,
               external_ref_id = SKIP)
  @payment_type = payment_type unless payment_type == SKIP
   =  unless  == SKIP
  @token = token unless token == SKIP
  @identifier = identifier unless identifier == SKIP
  @network = network unless network == SKIP
  @card_identifier = card_identifier
  @odometer = odometer unless odometer == SKIP
  @fleet_id = fleet_id unless fleet_id == SKIP
  @external_ref_id = external_ref_id unless external_ref_id == SKIP
end

Instance Attribute Details

#card_identifierString

This is only relevant for transactions made by B2B customers using the Shell Card payment method. The ‘cardIdentifier’ is the unique identifier provided by Commercial Fleet and shared with the Shell mobile payments platform. This reference ID is used in interactions with the Commercial Fleet application to retrieve the fueling token - use the cardIdentifier when requesting a DPAN.

Returns:

  • (String)


52
53
54
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 52

def card_identifier
  @card_identifier
end

#client_metadata_idString

This is only used for PayPal. During the creation of the user’s profile an ID (clientMetadataId) will have been created by PayPal and stored by Shell. Thus, when PayPal payments are made this ID must be included in order for the payment to be processed

Returns:

  • (String)


25
26
27
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 25

def 
  
end

#external_ref_idString

This is only used for transactions made by B2B customers using the Shell Card payment method.

In this scenario the expectation is that :\ a B2B entity has been

successfully created that includes the external party’s reference for the entity (e.g. Contract Number, VRN, customer email); a new Shell Card (SFC) has been successfully created; and Shell Card and B2B Entity have been linked.

externalRefId refers to the 3rd Parties External Reference for the B2B

entity and will therefore be used to verify the Customer and SFC before attempting to process a payment using the SFC card

Returns:

  • (String)


83
84
85
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 83

def external_ref_id
  @external_ref_id
end

#fleet_idString

Only relevant if Customer attempting to pay with B2B Shell Card. Customers attempting to pay with a B2B Shell Card may have to specify their Fleet ID as an extra authorisation/security step. Shell Card configuration will determine whether or not Fleet ID needs to be provided. Please note this field is a 6 character numeric field.

Returns:

  • (String)


69
70
71
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 69

def fleet_id
  @fleet_id
end

#identifierString

This is the payment identifier and it is only used for ApplePay and AndroidPay.

Returns:

  • (String)


38
39
40
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 38

def identifier
  @identifier
end

#networkString

This is the payment network (e.g. Visa, Mastercard) and it is only used for ApplePay and AndroidPay.

Returns:

  • (String)


43
44
45
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 43

def network
  @network
end

#odometerString

This is only relevant for transactions made by B2B customers using a Shell Card payment method. During set up of the user’s Shell Card it’s possible to configure the card such that users are forced to provide an odometer reading before a Sale can begin processing. This field must be filled if the B2B user’s Shell Card has been configured this way but will be left blank in all other cases.

Returns:

  • (String)


61
62
63
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 61

def odometer
  @odometer
end

#payment_typeString

The type of payment (e.g. Credit Card, Debit Card)

Returns:

  • (String)


18
19
20
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 18

def payment_type
  @payment_type
end

#tokenString

This is only used for ApplePay and AndroidPay. Users using either of these payment methods use device biometrics to authenticate themselves against their respective payment method/provider (e.g. retina, fingerprint). Successful authentication will result in Apple/Android issuing a Payment Token which should be specified here

Returns:

  • (String)


33
34
35
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 33

def token
  @token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 135

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  card_identifier =
    hash.key?('cardIdentifier') ? hash['cardIdentifier'] : nil
  payment_type = hash.key?('paymentType') ? hash['paymentType'] : SKIP
   =
    hash.key?('clientMetadataId') ? hash['clientMetadataId'] : SKIP
  token = hash.key?('token') ? hash['token'] : SKIP
  identifier = hash.key?('identifier') ? hash['identifier'] : SKIP
  network = hash.key?('network') ? hash['network'] : SKIP
  odometer = hash.key?('odometer') ? hash['odometer'] : SKIP
  fleet_id = hash.key?('fleetId') ? hash['fleetId'] : SKIP
  external_ref_id =
    hash.key?('externalRefId') ? hash['externalRefId'] : SKIP

  # Create object from extracted values.

  PaymentProperties.new(card_identifier,
                        payment_type,
                        ,
                        token,
                        identifier,
                        network,
                        odometer,
                        fleet_id,
                        external_ref_id)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_type'] = 'paymentType'
  @_hash['client_metadata_id'] = 'clientMetadataId'
  @_hash['token'] = 'token'
  @_hash['identifier'] = 'identifier'
  @_hash['network'] = 'network'
  @_hash['card_identifier'] = 'cardIdentifier'
  @_hash['odometer'] = 'odometer'
  @_hash['fleet_id'] = 'fleetId'
  @_hash['external_ref_id'] = 'externalRefId'
  @_hash
end

.nullablesObject

An array for nullable fields



115
116
117
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 115

def self.nullables
  []
end

.optionalsObject

An array for optional fields



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 101

def self.optionals
  %w[
    payment_type
    client_metadata_id
    token
    identifier
    network
    odometer
    fleet_id
    external_ref_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



174
175
176
177
178
179
180
181
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 174

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_type: #{@payment_type.inspect}, client_metadata_id:"\
  " #{@client_metadata_id.inspect}, token: #{@token.inspect}, identifier:"\
  " #{@identifier.inspect}, network: #{@network.inspect}, card_identifier:"\
  " #{@card_identifier.inspect}, odometer: #{@odometer.inspect}, fleet_id:"\
  " #{@fleet_id.inspect}, external_ref_id: #{@external_ref_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



165
166
167
168
169
170
171
# File 'lib/shell_smart_pay_api/models/payment_properties.rb', line 165

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_type: #{@payment_type}, client_metadata_id: #{@client_metadata_id},"\
  " token: #{@token}, identifier: #{@identifier}, network: #{@network}, card_identifier:"\
  " #{@card_identifier}, odometer: #{@odometer}, fleet_id: #{@fleet_id}, external_ref_id:"\
  " #{@external_ref_id}>"
end