digital-payments-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +85 -0
- data/lib/shell_ev/api_helper.rb +10 -0
- data/lib/shell_ev/client.rb +86 -0
- data/lib/shell_ev/configuration.rb +104 -0
- data/lib/shell_ev/controllers/base_controller.rb +66 -0
- data/lib/shell_ev/controllers/digital_payment_enablement_controller.rb +56 -0
- data/lib/shell_ev/controllers/fueling_controller.rb +126 -0
- data/lib/shell_ev/controllers/partner_notification_controller.rb +95 -0
- data/lib/shell_ev/controllers/shell_api_platform_security_authentication_controller.rb +44 -0
- data/lib/shell_ev/controllers/station_locator_controller.rb +76 -0
- data/lib/shell_ev/exceptions/access_token_error_exception.rb +37 -0
- data/lib/shell_ev/exceptions/api_exception.rb +10 -0
- data/lib/shell_ev/exceptions/cancel_fueling_error_response_error_exception.rb +64 -0
- data/lib/shell_ev/exceptions/mpp_acces_token_error_response_exception.rb +44 -0
- data/lib/shell_ev/exceptions/payment_enablement_error_response_exception.rb +37 -0
- data/lib/shell_ev/exceptions/station_locator_bad_request_exception.rb +38 -0
- data/lib/shell_ev/exceptions/station_locator_forbidden_exception.rb +38 -0
- data/lib/shell_ev/exceptions/station_locator_internal_server_error_exception.rb +38 -0
- data/lib/shell_ev/exceptions/station_locator_not_found_exception.rb +38 -0
- data/lib/shell_ev/exceptions/station_locator_unauthorized_exception.rb +38 -0
- data/lib/shell_ev/http/auth/mpp_token.rb +42 -0
- data/lib/shell_ev/http/auth/o_auth_token_post.rb +44 -0
- data/lib/shell_ev/http/http_call_back.rb +10 -0
- data/lib/shell_ev/http/http_method_enum.rb +10 -0
- data/lib/shell_ev/http/http_request.rb +10 -0
- data/lib/shell_ev/http/http_response.rb +10 -0
- data/lib/shell_ev/models/access_token_response.rb +71 -0
- data/lib/shell_ev/models/around_location_array.rb +109 -0
- data/lib/shell_ev/models/around_location_array_data_items.rb +242 -0
- data/lib/shell_ev/models/around_location_array_data_items_loc.rb +99 -0
- data/lib/shell_ev/models/around_location_array_data_items_opening_hours_items.rb +148 -0
- data/lib/shell_ev/models/base_model.rb +62 -0
- data/lib/shell_ev/models/cancel_fueling_error_response.rb +92 -0
- data/lib/shell_ev/models/cancel_fueling_request.rb +61 -0
- data/lib/shell_ev/models/collecting_company.rb +50 -0
- data/lib/shell_ev/models/fault_response.rb +50 -0
- data/lib/shell_ev/models/fault_response_fault.rb +60 -0
- data/lib/shell_ev/models/fault_response_fault_detail.rb +50 -0
- data/lib/shell_ev/models/finalise_fueling_request.rb +181 -0
- data/lib/shell_ev/models/finalise_fueling_request_payment.rb +71 -0
- data/lib/shell_ev/models/finalise_fueling_request_products_items.rb +70 -0
- data/lib/shell_ev/models/loyalty_details.rb +59 -0
- data/lib/shell_ev/models/mobile_payment_registration_request.rb +134 -0
- data/lib/shell_ev/models/mpp_acces_token_response.rb +81 -0
- data/lib/shell_ev/models/mpp_error.rb +94 -0
- data/lib/shell_ev/models/mpp_token_request_body.rb +73 -0
- data/lib/shell_ev/models/oauth_token_post_request_body.rb +73 -0
- data/lib/shell_ev/models/partner_token_request_body.rb +73 -0
- data/lib/shell_ev/models/payment_details_items.rb +78 -0
- data/lib/shell_ev/models/payment_enablement_response.rb +48 -0
- data/lib/shell_ev/models/payment_properties.rb +169 -0
- data/lib/shell_ev/models/prepare_fueling_request.rb +183 -0
- data/lib/shell_ev/models/prepare_fueling_request_device_details_items.rb +95 -0
- data/lib/shell_ev/models/prepare_fueling_response.rb +66 -0
- data/lib/shell_ev/utilities/date_time_helper.rb +11 -0
- data/lib/shell_ev/utilities/file_wrapper.rb +16 -0
- data/lib/shell_ev.rb +85 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_fueling_controller.rb +61 -0
- data/test/controllers/test_partner_notification_controller.rb +60 -0
- data/test/controllers/test_shell_api_platform_security_authentication_controller.rb +36 -0
- data/test/controllers/test_station_locator_controller.rb +44 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +185 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# PaymentDetailsItems Model.
|
8
|
+
class PaymentDetailsItems < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The type of commercial transaction. Permitted value\:
|
13
|
+
# * B2B
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :payment_category
|
16
|
+
|
17
|
+
# The payment method used to make the transaction. Possible values include:
|
18
|
+
# * euroShell
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :payment_method_id
|
21
|
+
|
22
|
+
# Object containing Payment Property details Please note:
|
23
|
+
# All the attributes are optional as they serve all payment methods (i.e.
|
24
|
+
# different payment methods require different fields to be filled/mandated).
|
25
|
+
# As a result, some of these fields will be mandatory depending on the
|
26
|
+
# selected payment method and the API will return an error if they are not
|
27
|
+
# completed
|
28
|
+
# @return [PaymentProperties]
|
29
|
+
attr_accessor :payment_properties
|
30
|
+
|
31
|
+
# A mapping from model property names to API property names.
|
32
|
+
def self.names
|
33
|
+
@_hash = {} if @_hash.nil?
|
34
|
+
@_hash['payment_category'] = 'paymentCategory'
|
35
|
+
@_hash['payment_method_id'] = 'paymentMethodId'
|
36
|
+
@_hash['payment_properties'] = 'paymentProperties'
|
37
|
+
@_hash
|
38
|
+
end
|
39
|
+
|
40
|
+
# An array for optional fields
|
41
|
+
def self.optionals
|
42
|
+
%w[
|
43
|
+
payment_category
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
# An array for nullable fields
|
48
|
+
def self.nullables
|
49
|
+
[]
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(payment_method_id = nil,
|
53
|
+
payment_properties = nil,
|
54
|
+
payment_category = SKIP)
|
55
|
+
@payment_category = payment_category unless payment_category == SKIP
|
56
|
+
@payment_method_id = payment_method_id
|
57
|
+
@payment_properties = payment_properties
|
58
|
+
end
|
59
|
+
|
60
|
+
# Creates an instance of the object from a hash.
|
61
|
+
def self.from_hash(hash)
|
62
|
+
return nil unless hash
|
63
|
+
|
64
|
+
# Extract variables from the hash.
|
65
|
+
payment_method_id =
|
66
|
+
hash.key?('paymentMethodId') ? hash['paymentMethodId'] : nil
|
67
|
+
payment_properties = PaymentProperties.from_hash(hash['paymentProperties']) if
|
68
|
+
hash['paymentProperties']
|
69
|
+
payment_category =
|
70
|
+
hash.key?('paymentCategory') ? hash['paymentCategory'] : SKIP
|
71
|
+
|
72
|
+
# Create object from extracted values.
|
73
|
+
PaymentDetailsItems.new(payment_method_id,
|
74
|
+
payment_properties,
|
75
|
+
payment_category)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# PaymentEnablementResponse Model.
|
8
|
+
class PaymentEnablementResponse < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# DPan Last number
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :dpan_last4
|
15
|
+
|
16
|
+
# A mapping from model property names to API property names.
|
17
|
+
def self.names
|
18
|
+
@_hash = {} if @_hash.nil?
|
19
|
+
@_hash['dpan_last4'] = 'dpanLast4'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
# An array for optional fields
|
24
|
+
def self.optionals
|
25
|
+
[]
|
26
|
+
end
|
27
|
+
|
28
|
+
# An array for nullable fields
|
29
|
+
def self.nullables
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(dpan_last4 = nil)
|
34
|
+
@dpan_last4 = dpan_last4
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates an instance of the object from a hash.
|
38
|
+
def self.from_hash(hash)
|
39
|
+
return nil unless hash
|
40
|
+
|
41
|
+
# Extract variables from the hash.
|
42
|
+
dpan_last4 = hash.key?('dpanLast4') ? hash['dpanLast4'] : nil
|
43
|
+
|
44
|
+
# Create object from extracted values.
|
45
|
+
PaymentEnablementResponse.new(dpan_last4)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Object containing Payment Property details Please note: All the
|
8
|
+
# attributes are optional as they serve all payment methods (i.e. different
|
9
|
+
# payment methods require different fields to be filled/mandated). As a
|
10
|
+
# result, some of these fields will be mandatory depending on the selected
|
11
|
+
# payment method and the API will return an error if they are not completed
|
12
|
+
class PaymentProperties < BaseModel
|
13
|
+
SKIP = Object.new
|
14
|
+
private_constant :SKIP
|
15
|
+
|
16
|
+
# The type of payment (e.g. Credit Card, Debit Card)
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :payment_type
|
19
|
+
|
20
|
+
# This is only used for PayPal. During the creation of the user’s profile an
|
21
|
+
# ID (clientMetadataId) will have been created by PayPal and stored by
|
22
|
+
# Shell. Thus, when PayPal payments are made this ID must be included in
|
23
|
+
# order for the payment to be processed
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :client_metadata_id
|
26
|
+
|
27
|
+
# This is only used for ApplePay and AndroidPay. Users using either of these
|
28
|
+
# payment methods use device biometrics to authenticate themselves against
|
29
|
+
# their respective payment method/provider (e.g. retina, fingerprint).
|
30
|
+
# Successful authentication will result in Apple/Android issuing a Payment
|
31
|
+
# Token which should be specified here
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :token
|
34
|
+
|
35
|
+
# This is the payment identifier and it is only used for ApplePay and
|
36
|
+
# AndroidPay.
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :identifier
|
39
|
+
|
40
|
+
# This is the payment network (e.g. Visa, Mastercard) and it is only used
|
41
|
+
# for ApplePay and AndroidPay.
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :network
|
44
|
+
|
45
|
+
# This is only relevant for transactions made by B2B customers using the
|
46
|
+
# Shell Card payment method. The ‘cardIdentifier’ is the unique identifier
|
47
|
+
# provided by Commercial Fleet and shared with the Shell mobile payments
|
48
|
+
# platform. This reference ID is used in interactions with the Commercial
|
49
|
+
# Fleet application to retrieve the fueling token - use the cardIdentifier
|
50
|
+
# when requesting a DPAN.
|
51
|
+
# @return [String]
|
52
|
+
attr_accessor :card_identifier
|
53
|
+
|
54
|
+
# This is only relevant for transactions made by B2B customers using a Shell
|
55
|
+
# Card payment method. During set up of the user’s Shell Card it’s possible
|
56
|
+
# to configure the card such that users are forced to provide an odometer
|
57
|
+
# reading before a Sale can begin processing. This field must be filled if
|
58
|
+
# the B2B user’s Shell Card has been configured this way but will be left
|
59
|
+
# blank in all other cases.
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :odometer
|
62
|
+
|
63
|
+
# Only relevant if Customer attempting to pay with B2B Shell Card. Customers
|
64
|
+
# attempting to pay with a B2B Shell Card may have to specify their Fleet ID
|
65
|
+
# as an extra authorisation/security step. Shell Card configuration will
|
66
|
+
# determine whether or not Fleet ID needs to be provided. Please note this
|
67
|
+
# field is a 6 character numeric field.
|
68
|
+
# @return [String]
|
69
|
+
attr_accessor :fleet_id
|
70
|
+
|
71
|
+
# This is only used for transactions made by B2B customers using the Shell
|
72
|
+
# Card payment method.
|
73
|
+
# In this scenario the expectation is that :\ a B2B entity has been
|
74
|
+
# successfully created that includes the external party’s reference for the
|
75
|
+
# entity (e.g. Contract Number, VRN, customer email); a new Shell Card (SFC)
|
76
|
+
# has been successfully created; and Shell Card and B2B Entity have been
|
77
|
+
# linked.
|
78
|
+
#
|
79
|
+
# externalRefId refers to the 3rd Parties External Reference for the B2B
|
80
|
+
# entity and will therefore be used to verify the Customer and SFC before
|
81
|
+
# attempting to process a payment using the SFC card
|
82
|
+
# @return [String]
|
83
|
+
attr_accessor :external_ref_id
|
84
|
+
|
85
|
+
# A mapping from model property names to API property names.
|
86
|
+
def self.names
|
87
|
+
@_hash = {} if @_hash.nil?
|
88
|
+
@_hash['payment_type'] = 'paymentType'
|
89
|
+
@_hash['client_metadata_id'] = 'clientMetadataId'
|
90
|
+
@_hash['token'] = 'token'
|
91
|
+
@_hash['identifier'] = 'identifier'
|
92
|
+
@_hash['network'] = 'network'
|
93
|
+
@_hash['card_identifier'] = 'cardIdentifier'
|
94
|
+
@_hash['odometer'] = 'odometer'
|
95
|
+
@_hash['fleet_id'] = 'fleetId'
|
96
|
+
@_hash['external_ref_id'] = 'externalRefId'
|
97
|
+
@_hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# An array for optional fields
|
101
|
+
def self.optionals
|
102
|
+
%w[
|
103
|
+
payment_type
|
104
|
+
client_metadata_id
|
105
|
+
token
|
106
|
+
identifier
|
107
|
+
network
|
108
|
+
odometer
|
109
|
+
fleet_id
|
110
|
+
external_ref_id
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
# An array for nullable fields
|
115
|
+
def self.nullables
|
116
|
+
[]
|
117
|
+
end
|
118
|
+
|
119
|
+
def initialize(card_identifier = nil,
|
120
|
+
payment_type = SKIP,
|
121
|
+
client_metadata_id = SKIP,
|
122
|
+
token = SKIP,
|
123
|
+
identifier = SKIP,
|
124
|
+
network = SKIP,
|
125
|
+
odometer = SKIP,
|
126
|
+
fleet_id = SKIP,
|
127
|
+
external_ref_id = SKIP)
|
128
|
+
@payment_type = payment_type unless payment_type == SKIP
|
129
|
+
@client_metadata_id = client_metadata_id unless client_metadata_id == SKIP
|
130
|
+
@token = token unless token == SKIP
|
131
|
+
@identifier = identifier unless identifier == SKIP
|
132
|
+
@network = network unless network == SKIP
|
133
|
+
@card_identifier = card_identifier
|
134
|
+
@odometer = odometer unless odometer == SKIP
|
135
|
+
@fleet_id = fleet_id unless fleet_id == SKIP
|
136
|
+
@external_ref_id = external_ref_id unless external_ref_id == SKIP
|
137
|
+
end
|
138
|
+
|
139
|
+
# Creates an instance of the object from a hash.
|
140
|
+
def self.from_hash(hash)
|
141
|
+
return nil unless hash
|
142
|
+
|
143
|
+
# Extract variables from the hash.
|
144
|
+
card_identifier =
|
145
|
+
hash.key?('cardIdentifier') ? hash['cardIdentifier'] : nil
|
146
|
+
payment_type = hash.key?('paymentType') ? hash['paymentType'] : SKIP
|
147
|
+
client_metadata_id =
|
148
|
+
hash.key?('clientMetadataId') ? hash['clientMetadataId'] : SKIP
|
149
|
+
token = hash.key?('token') ? hash['token'] : SKIP
|
150
|
+
identifier = hash.key?('identifier') ? hash['identifier'] : SKIP
|
151
|
+
network = hash.key?('network') ? hash['network'] : SKIP
|
152
|
+
odometer = hash.key?('odometer') ? hash['odometer'] : SKIP
|
153
|
+
fleet_id = hash.key?('fleetId') ? hash['fleetId'] : SKIP
|
154
|
+
external_ref_id =
|
155
|
+
hash.key?('externalRefId') ? hash['externalRefId'] : SKIP
|
156
|
+
|
157
|
+
# Create object from extracted values.
|
158
|
+
PaymentProperties.new(card_identifier,
|
159
|
+
payment_type,
|
160
|
+
client_metadata_id,
|
161
|
+
token,
|
162
|
+
identifier,
|
163
|
+
network,
|
164
|
+
odometer,
|
165
|
+
fleet_id,
|
166
|
+
external_ref_id)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# PrepareFuelingRequest Model.
|
8
|
+
class PrepareFuelingRequest < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The user’s current latitude
|
13
|
+
# @return [Float]
|
14
|
+
attr_accessor :latitude
|
15
|
+
|
16
|
+
# The user’s current longitude
|
17
|
+
# @return [Float]
|
18
|
+
attr_accessor :longitude
|
19
|
+
|
20
|
+
# The maximum fuelling amount that can be purchased. If the prepare fuelling
|
21
|
+
# is successful and the Customer starts fuelling their car, the pump will
|
22
|
+
# cut off once this threshold is reached. For B2B customers a maximum
|
23
|
+
# ceiling is set against their Shell Card. As a result, this can be left
|
24
|
+
# blank for B2B customers. If a value is provided it cannot be zero or lower
|
25
|
+
# and values that exceed ceiling will be ignored.
|
26
|
+
# @return [Float]
|
27
|
+
attr_accessor :maximum_fueling_amount
|
28
|
+
|
29
|
+
# Expectation is that a user has to be located at a Shell petrol station in
|
30
|
+
# order to make this call. A user is recognised as being located at a Shell
|
31
|
+
# station if the user’s current location (as determined by GPS) is within
|
32
|
+
# 300 meters of a Shell station. Expectation is that requester will have
|
33
|
+
# established the Shell petrol station the user is located at prior to
|
34
|
+
# making this call by calling Station Locator APIs. The API will use
|
35
|
+
# stationId and siteCountry/GPS to verify the user is The user’s current
|
36
|
+
# latitude genuinely located at the specified Station. ‘mpp_station_id’ of
|
37
|
+
# the Station Locator API should be used. Leading ‘0’ should be dropped and
|
38
|
+
# only last four digits, should be used. E.G. for ‘00123’, only ‘0123’
|
39
|
+
# should be used and for ‘04567’ only ‘4567’ should be used.
|
40
|
+
# @return [String]
|
41
|
+
attr_accessor :station_id
|
42
|
+
|
43
|
+
# A two digit numeric number of the pump as marked on the forecourt (e.g.
|
44
|
+
# pump number 12)
|
45
|
+
# @return [String]
|
46
|
+
attr_accessor :pump_id
|
47
|
+
|
48
|
+
# Object containing Loyalty details
|
49
|
+
# @return [Array[LoyaltyDetails]]
|
50
|
+
attr_accessor :loyalty_details
|
51
|
+
|
52
|
+
# The ID of the source application making this call. Each 3rd Party will be
|
53
|
+
# issued with its own sourceApp ID that must be specified correctly here
|
54
|
+
# * 3rdParty_App_Archetype
|
55
|
+
# @return [String]
|
56
|
+
attr_accessor :source_application
|
57
|
+
|
58
|
+
# The type of device making this call. Permitted values for deviceType:
|
59
|
+
# * car
|
60
|
+
# * phone
|
61
|
+
# @return [String]
|
62
|
+
attr_accessor :device_type
|
63
|
+
|
64
|
+
# Object containing Payment details
|
65
|
+
# @return [Array[PaymentDetailsItems]]
|
66
|
+
attr_accessor :payment_details
|
67
|
+
|
68
|
+
# Object containing device details
|
69
|
+
# @return [Array[PrepareFuelingRequestDeviceDetailsItems]]
|
70
|
+
attr_accessor :device_details
|
71
|
+
|
72
|
+
# A mapping from model property names to API property names.
|
73
|
+
def self.names
|
74
|
+
@_hash = {} if @_hash.nil?
|
75
|
+
@_hash['latitude'] = 'latitude'
|
76
|
+
@_hash['longitude'] = 'longitude'
|
77
|
+
@_hash['maximum_fueling_amount'] = 'maximumFuelingAmount'
|
78
|
+
@_hash['station_id'] = 'stationId'
|
79
|
+
@_hash['pump_id'] = 'pumpId'
|
80
|
+
@_hash['loyalty_details'] = 'loyaltyDetails'
|
81
|
+
@_hash['source_application'] = 'sourceApplication'
|
82
|
+
@_hash['device_type'] = 'deviceType'
|
83
|
+
@_hash['payment_details'] = 'paymentDetails'
|
84
|
+
@_hash['device_details'] = 'deviceDetails'
|
85
|
+
@_hash
|
86
|
+
end
|
87
|
+
|
88
|
+
# An array for optional fields
|
89
|
+
def self.optionals
|
90
|
+
%w[
|
91
|
+
maximum_fueling_amount
|
92
|
+
loyalty_details
|
93
|
+
device_type
|
94
|
+
device_details
|
95
|
+
]
|
96
|
+
end
|
97
|
+
|
98
|
+
# An array for nullable fields
|
99
|
+
def self.nullables
|
100
|
+
[]
|
101
|
+
end
|
102
|
+
|
103
|
+
def initialize(latitude = nil,
|
104
|
+
longitude = nil,
|
105
|
+
station_id = nil,
|
106
|
+
pump_id = nil,
|
107
|
+
source_application = nil,
|
108
|
+
payment_details = nil,
|
109
|
+
maximum_fueling_amount = SKIP,
|
110
|
+
loyalty_details = SKIP,
|
111
|
+
device_type = SKIP,
|
112
|
+
device_details = SKIP)
|
113
|
+
@latitude = latitude
|
114
|
+
@longitude = longitude
|
115
|
+
@maximum_fueling_amount = maximum_fueling_amount unless maximum_fueling_amount == SKIP
|
116
|
+
@station_id = station_id
|
117
|
+
@pump_id = pump_id
|
118
|
+
@loyalty_details = loyalty_details unless loyalty_details == SKIP
|
119
|
+
@source_application = source_application
|
120
|
+
@device_type = device_type unless device_type == SKIP
|
121
|
+
@payment_details = payment_details
|
122
|
+
@device_details = device_details unless device_details == SKIP
|
123
|
+
end
|
124
|
+
|
125
|
+
# Creates an instance of the object from a hash.
|
126
|
+
def self.from_hash(hash)
|
127
|
+
return nil unless hash
|
128
|
+
|
129
|
+
# Extract variables from the hash.
|
130
|
+
latitude = hash.key?('latitude') ? hash['latitude'] : nil
|
131
|
+
longitude = hash.key?('longitude') ? hash['longitude'] : nil
|
132
|
+
station_id = hash.key?('stationId') ? hash['stationId'] : nil
|
133
|
+
pump_id = hash.key?('pumpId') ? hash['pumpId'] : nil
|
134
|
+
source_application =
|
135
|
+
hash.key?('sourceApplication') ? hash['sourceApplication'] : nil
|
136
|
+
# Parameter is an array, so we need to iterate through it
|
137
|
+
payment_details = nil
|
138
|
+
unless hash['paymentDetails'].nil?
|
139
|
+
payment_details = []
|
140
|
+
hash['paymentDetails'].each do |structure|
|
141
|
+
payment_details << (PaymentDetailsItems.from_hash(structure) if structure)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
payment_details = nil unless hash.key?('paymentDetails')
|
146
|
+
maximum_fueling_amount =
|
147
|
+
hash.key?('maximumFuelingAmount') ? hash['maximumFuelingAmount'] : SKIP
|
148
|
+
# Parameter is an array, so we need to iterate through it
|
149
|
+
loyalty_details = nil
|
150
|
+
unless hash['loyaltyDetails'].nil?
|
151
|
+
loyalty_details = []
|
152
|
+
hash['loyaltyDetails'].each do |structure|
|
153
|
+
loyalty_details << (LoyaltyDetails.from_hash(structure) if structure)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
loyalty_details = SKIP unless hash.key?('loyaltyDetails')
|
158
|
+
device_type = hash.key?('deviceType') ? hash['deviceType'] : SKIP
|
159
|
+
# Parameter is an array, so we need to iterate through it
|
160
|
+
device_details = nil
|
161
|
+
unless hash['deviceDetails'].nil?
|
162
|
+
device_details = []
|
163
|
+
hash['deviceDetails'].each do |structure|
|
164
|
+
device_details << (PrepareFuelingRequestDeviceDetailsItems.from_hash(structure) if structure)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
device_details = SKIP unless hash.key?('deviceDetails')
|
169
|
+
|
170
|
+
# Create object from extracted values.
|
171
|
+
PrepareFuelingRequest.new(latitude,
|
172
|
+
longitude,
|
173
|
+
station_id,
|
174
|
+
pump_id,
|
175
|
+
source_application,
|
176
|
+
payment_details,
|
177
|
+
maximum_fueling_amount,
|
178
|
+
loyalty_details,
|
179
|
+
device_type,
|
180
|
+
device_details)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# PrepareFuelingRequestDeviceDetailsItems Model.
|
8
|
+
class PrepareFuelingRequestDeviceDetailsItems < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# This is the mobile device’s unique ID (Vendor ID for iOS vs. Android ID
|
13
|
+
# for Android). This is only used for transactions made via the Shell Mobile
|
14
|
+
# App and will therefore be mandatory for requests originating from Shell’s
|
15
|
+
# mobile app but can be ignored by all other parties.
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :device_id
|
18
|
+
|
19
|
+
# This is the mobile device’s model (machine name/systemInfo for iOS vs.
|
20
|
+
# Build.MODEL for Android). This is only used for transactions made via the
|
21
|
+
# Shell Mobile App and will therefore be mandatory for requests originating
|
22
|
+
# from Shell’s mobile app but can be ignored by all other parties.
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :model
|
25
|
+
|
26
|
+
# This is the mobile device’s OS Version. This is only used for transactions
|
27
|
+
# made via the Shell Mobile App and will therefore be mandatory for requests
|
28
|
+
# originating from Shell’s mobile app but can be ignored by all other
|
29
|
+
# parties.
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :os_version
|
32
|
+
|
33
|
+
# This is only used for transactions made via Android versions of the Shell
|
34
|
+
# Mobile App and will therefore be mandatory for requests originating from
|
35
|
+
# Shell’s Android mobile app but can be ignored by all other devices and/or
|
36
|
+
# parties.
|
37
|
+
# This field is used to capture the Shell App build that was used to make
|
38
|
+
# this call.
|
39
|
+
# @return [String]
|
40
|
+
attr_accessor :other_device_information
|
41
|
+
|
42
|
+
# A mapping from model property names to API property names.
|
43
|
+
def self.names
|
44
|
+
@_hash = {} if @_hash.nil?
|
45
|
+
@_hash['device_id'] = 'deviceId'
|
46
|
+
@_hash['model'] = 'model'
|
47
|
+
@_hash['os_version'] = 'osVersion'
|
48
|
+
@_hash['other_device_information'] = 'otherDeviceInformation'
|
49
|
+
@_hash
|
50
|
+
end
|
51
|
+
|
52
|
+
# An array for optional fields
|
53
|
+
def self.optionals
|
54
|
+
%w[
|
55
|
+
device_id
|
56
|
+
model
|
57
|
+
os_version
|
58
|
+
other_device_information
|
59
|
+
]
|
60
|
+
end
|
61
|
+
|
62
|
+
# An array for nullable fields
|
63
|
+
def self.nullables
|
64
|
+
[]
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize(device_id = SKIP,
|
68
|
+
model = SKIP,
|
69
|
+
os_version = SKIP,
|
70
|
+
other_device_information = SKIP)
|
71
|
+
@device_id = device_id unless device_id == SKIP
|
72
|
+
@model = model unless model == SKIP
|
73
|
+
@os_version = os_version unless os_version == SKIP
|
74
|
+
@other_device_information = other_device_information unless other_device_information == SKIP
|
75
|
+
end
|
76
|
+
|
77
|
+
# Creates an instance of the object from a hash.
|
78
|
+
def self.from_hash(hash)
|
79
|
+
return nil unless hash
|
80
|
+
|
81
|
+
# Extract variables from the hash.
|
82
|
+
device_id = hash.key?('deviceId') ? hash['deviceId'] : SKIP
|
83
|
+
model = hash.key?('model') ? hash['model'] : SKIP
|
84
|
+
os_version = hash.key?('osVersion') ? hash['osVersion'] : SKIP
|
85
|
+
other_device_information =
|
86
|
+
hash.key?('otherDeviceInformation') ? hash['otherDeviceInformation'] : SKIP
|
87
|
+
|
88
|
+
# Create object from extracted values.
|
89
|
+
PrepareFuelingRequestDeviceDetailsItems.new(device_id,
|
90
|
+
model,
|
91
|
+
os_version,
|
92
|
+
other_device_information)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# The response of prepare fueling returns
|
8
|
+
class PrepareFuelingResponse < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The unique identifier of the Order. NB at this stage the Customer hasn’t
|
13
|
+
# actually bought anything so there’s no formal transaction associated with
|
14
|
+
# the Order. A transaction is not processed until refuelling has been
|
15
|
+
# completed successfully and will be triggered by returning the nozzle to
|
16
|
+
# the pump.
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :mpp_transaction_id
|
19
|
+
|
20
|
+
# An array of Strings that contain the list of products that the user can
|
21
|
+
# purchase at the specified Station/Pump. The text is localized based on the
|
22
|
+
# country.
|
23
|
+
# @return [Array[String]]
|
24
|
+
attr_accessor :products
|
25
|
+
|
26
|
+
# A mapping from model property names to API property names.
|
27
|
+
def self.names
|
28
|
+
@_hash = {} if @_hash.nil?
|
29
|
+
@_hash['mpp_transaction_id'] = 'mppTransactionId'
|
30
|
+
@_hash['products'] = 'products'
|
31
|
+
@_hash
|
32
|
+
end
|
33
|
+
|
34
|
+
# An array for optional fields
|
35
|
+
def self.optionals
|
36
|
+
%w[
|
37
|
+
products
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# An array for nullable fields
|
42
|
+
def self.nullables
|
43
|
+
[]
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize(mpp_transaction_id = nil,
|
47
|
+
products = SKIP)
|
48
|
+
@mpp_transaction_id = mpp_transaction_id
|
49
|
+
@products = products unless products == SKIP
|
50
|
+
end
|
51
|
+
|
52
|
+
# Creates an instance of the object from a hash.
|
53
|
+
def self.from_hash(hash)
|
54
|
+
return nil unless hash
|
55
|
+
|
56
|
+
# Extract variables from the hash.
|
57
|
+
mpp_transaction_id =
|
58
|
+
hash.key?('mppTransactionId') ? hash['mppTransactionId'] : nil
|
59
|
+
products = hash.key?('products') ? hash['products'] : SKIP
|
60
|
+
|
61
|
+
# Create object from extracted values.
|
62
|
+
PrepareFuelingResponse.new(mpp_transaction_id,
|
63
|
+
products)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module ShellEv
|
8
|
+
# A utility that supports dateTime conversion to different formats
|
9
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# A utility to allow users to set the content-type for files
|
8
|
+
class FileWrapper < CoreLibrary::FileWrapper
|
9
|
+
# The constructor.
|
10
|
+
# @param [File] file The file to be sent in the request.
|
11
|
+
# @param [string] content_type The content type of the provided file.
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|