Class: CyberSourceMergedSpec::ShippingDetails1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ShippingDetails1
- Defined in:
- lib/cyber_source_merged_spec/models/shipping_details1.rb
Overview
Contains shipping details information for Klarna Advantage Plus Capture transactions.
Instance Attribute Summary collapse
-
#estimated_delivery_date ⇒ String
Estimated delivery date for the shipment provided by Merchant.
-
#ship_from_postal_code ⇒ String
Postal code for the address from which the goods are shipped, which is used to establish nexus.
-
#shipping_carrier ⇒ String
Name of the shipping carrier/company handling the delivery.
-
#shipping_method ⇒ String
Shipping method for the product.
-
#tracking_number ⇒ String
Shipment tracking number provided by the merchant.
-
#tracking_url ⇒ String
URL where the customer can track their shipment.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(ship_from_postal_code: SKIP, tracking_number: SKIP, tracking_url: SKIP, shipping_carrier: SKIP, estimated_delivery_date: SKIP, shipping_method: SKIP, additional_properties: nil) ⇒ ShippingDetails1
constructor
A new instance of ShippingDetails1.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(ship_from_postal_code: SKIP, tracking_number: SKIP, tracking_url: SKIP, shipping_carrier: SKIP, estimated_delivery_date: SKIP, shipping_method: SKIP, additional_properties: nil) ⇒ ShippingDetails1
Returns a new instance of ShippingDetails1.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 101 def initialize(ship_from_postal_code: SKIP, tracking_number: SKIP, tracking_url: SKIP, shipping_carrier: SKIP, estimated_delivery_date: SKIP, shipping_method: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @ship_from_postal_code = ship_from_postal_code unless ship_from_postal_code == SKIP @tracking_number = tracking_number unless tracking_number == SKIP @tracking_url = tracking_url unless tracking_url == SKIP @shipping_carrier = shipping_carrier unless shipping_carrier == SKIP @estimated_delivery_date = estimated_delivery_date unless estimated_delivery_date == SKIP @shipping_method = shipping_method unless shipping_method == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#estimated_delivery_date ⇒ String
Estimated delivery date for the shipment provided by Merchant. Format: YYYYMMDD (e.g., 20251115 for November 15, 2025)
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 46 def estimated_delivery_date @estimated_delivery_date end |
#ship_from_postal_code ⇒ String
Postal code for the address from which the goods are shipped, which is
used to establish nexus. The default is
the postal code associated with your CyberSource account.
The postal code must consist of 5 to 9 digits. When the billing country is
the U.S., the 9-digit postal code
must follow this format:
[5 digits][dash][4 digits]
Example 12345-6789
When the billing country is Canada, the 6-digit postal code must follow
this format:
[alpha][numeric][alpha][space] [numeric][alpha][numeric]
Example A1B 2C3
This field is frequently used for Level II and Level III transactions.
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 27 def ship_from_postal_code @ship_from_postal_code end |
#shipping_carrier ⇒ String
Name of the shipping carrier/company handling the delivery.
41 42 43 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 41 def shipping_carrier @shipping_carrier end |
#shipping_method ⇒ String
Shipping method for the product. Possible values:
lowcost: Lowest-cost servicesameday: Courier or same-day serviceoneday: Next-day or overnight servicetwoday: Two-day servicethreeday: Three-day servicepickup: Store pick-upother: Other shipping methodnone: No shipping method because product is a service or subscription Klarna Advantage Plus additional values:TO_DOOR: Delivery to doorTO_CURB: Delivery to curbTO_MAILBOX: Delivery to mailboxPICKUP_BOX: Pickup from boxPICKUP_POINT: Pickup from pointPICKUP_STORE: Pickup from storePICKUP_WAREHOUSE: Pickup from warehouseDIGITAL_EMAIL: Digital delivery via emailDIGITAL_DOWNLOAD: Digital downloadDIGITAL_OTHER: Other digital deliveryPHYSICAL_OTHER: Other physical delivery
70 71 72 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 70 def shipping_method @shipping_method end |
#tracking_number ⇒ String
Shipment tracking number provided by the merchant. Used to track the shipment of goods to the customer.
32 33 34 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 32 def tracking_number @tracking_number end |
#tracking_url ⇒ String
URL where the customer can track their shipment. Provides real-time tracking information for the delivery.
37 38 39 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 37 def tracking_url @tracking_url end |
Class Method Details
.from_element(root) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 151 def self.from_element(root) ship_from_postal_code = XmlUtilities.from_element(root, 'shipFromPostalCode', String) tracking_number = XmlUtilities.from_element(root, 'trackingNumber', String) tracking_url = XmlUtilities.from_element(root, 'trackingUrl', String) shipping_carrier = XmlUtilities.from_element(root, 'shippingCarrier', String) estimated_delivery_date = XmlUtilities.from_element( root, 'estimatedDeliveryDate', String ) shipping_method = XmlUtilities.from_element(root, 'shippingMethod', String) new(ship_from_postal_code: ship_from_postal_code, tracking_number: tracking_number, tracking_url: tracking_url, shipping_carrier: shipping_carrier, estimated_delivery_date: estimated_delivery_date, shipping_method: shipping_method, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 147 148 149 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 118 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. ship_from_postal_code = hash.key?('shipFromPostalCode') ? hash['shipFromPostalCode'] : SKIP tracking_number = hash.key?('trackingNumber') ? hash['trackingNumber'] : SKIP tracking_url = hash.key?('trackingUrl') ? hash['trackingUrl'] : SKIP shipping_carrier = hash.key?('shippingCarrier') ? hash['shippingCarrier'] : SKIP estimated_delivery_date = hash.key?('estimatedDeliveryDate') ? hash['estimatedDeliveryDate'] : SKIP shipping_method = hash.key?('shippingMethod') ? hash['shippingMethod'] : 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. ShippingDetails1.new(ship_from_postal_code: ship_from_postal_code, tracking_number: tracking_number, tracking_url: tracking_url, shipping_carrier: shipping_carrier, estimated_delivery_date: estimated_delivery_date, shipping_method: shipping_method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 73 def self.names @_hash = {} if @_hash.nil? @_hash['ship_from_postal_code'] = 'shipFromPostalCode' @_hash['tracking_number'] = 'trackingNumber' @_hash['tracking_url'] = 'trackingUrl' @_hash['shipping_carrier'] = 'shippingCarrier' @_hash['estimated_delivery_date'] = 'estimatedDeliveryDate' @_hash['shipping_method'] = 'shippingMethod' @_hash end |
.nullables ⇒ Object
An array for nullable fields
97 98 99 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 97 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 85 def self.optionals %w[ ship_from_postal_code tracking_number tracking_url shipping_carrier estimated_delivery_date shipping_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
205 206 207 208 209 210 211 212 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 205 def inspect class_name = self.class.name.split('::').last "<#{class_name} ship_from_postal_code: #{@ship_from_postal_code.inspect}, tracking_number:"\ " #{@tracking_number.inspect}, tracking_url: #{@tracking_url.inspect}, shipping_carrier:"\ " #{@shipping_carrier.inspect}, estimated_delivery_date:"\ " #{@estimated_delivery_date.inspect}, shipping_method: #{@shipping_method.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
196 197 198 199 200 201 202 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 196 def to_s class_name = self.class.name.split('::').last "<#{class_name} ship_from_postal_code: #{@ship_from_postal_code}, tracking_number:"\ " #{@tracking_number}, tracking_url: #{@tracking_url}, shipping_carrier:"\ " #{@shipping_carrier}, estimated_delivery_date: #{@estimated_delivery_date},"\ " shipping_method: #{@shipping_method}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/cyber_source_merged_spec/models/shipping_details1.rb', line 175 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'shipFromPostalCode', ship_from_postal_code) XmlUtilities.add_as_subelement(doc, root, 'trackingNumber', tracking_number) XmlUtilities.add_as_subelement(doc, root, 'trackingUrl', tracking_url) XmlUtilities.add_as_subelement(doc, root, 'shippingCarrier', shipping_carrier) XmlUtilities.add_as_subelement(doc, root, 'estimatedDeliveryDate', estimated_delivery_date) XmlUtilities.add_as_subelement(doc, root, 'shippingMethod', shipping_method) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |