Class: StickyIoRestfulApiV2025731::OrdersController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::OrdersController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb
Overview
OrdersController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#calculate_order_total(body, domain, v2_ext) ⇒ ApiResponse
Calculate the pending order total from the request.
-
#calculate_recurring_total(domain, v2_ext) ⇒ ApiResponse
This API returns an array of line item calculations grouped by recurring date.
-
#get_assigned_license_keys(domain, v2_ext, order_id) ⇒ ApiResponse
Get the License Keys for Products on an Order.
-
#order_compliance_consent(domain, v2_ext, order_id) ⇒ ApiResponse
If consent is required for an order, use this method to confirm that consent has been received.
-
#unbundle_items(domain, v2_ext, order_id) ⇒ ApiResponse
If consent is required for an order, use this method to confirm that consent has been received.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from StickyIoRestfulApiV2025731::BaseController
Instance Method Details
#calculate_order_total(body, domain, v2_ext) ⇒ ApiResponse
Calculate the pending order total from the request. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | campaign_id | Required | - | Integer | The campaign ID. | | shipping_id | Conditional | - | Integer | The shipping method ID.
**For Non-Shippable** Orders: You can either omit this parameter or set it to an empty value.
**For Shippable Orders:** Provide a valid and genuine shipping ID. | | use_tax_provider | Optional | - | Integer Flag | A flag that decides whether or not to use a tax integration, if configured to the campaign. | | offers | Required | - | Array | Array of offer objects associated with the selected campaign. | | offers.*.id | Required | - | Integer | The offer ID associated to the offer object. | | offers.*.product_id | Required | - | Integer | The product ID associated with the offer object. | | offers.*.billing_model_id | Optional | - | Integer | The billing model ID. | | offers.*.variant_id | Conditional | - | Integer | The variant ID. Must be a configured variant of the ‘product_id` selected. | | offers.*.price | Optional | - | Float | A custom product price that will override the automated product price calculation. | | offers.*.quantity | Required | 1 | Integer | The product quantity for this line item. | | offers.*.cycles | Conditional | - | Integer | The amount of prepaid cycles. Must be a valid number of prepaid cycles configured with the selected offer. | | offers.*.cycle_depth | Conditional | 1 | Integer | The cycle depth. Specified the beginning position for custom recurring offers. | | offers.*.trial | Optional | 0 | Integer Flag | A flag that decides whether or not to use the trial configuration associated with the selected offer. | | offers.*.children | Optional | - | Array | An array of bundle child product objects. | | offers.*.children.*.product_id | Conditional | - | Integer | The custom bundle child product ID. | | offers.*.children.*.quantity | Conditional | 1 | Integer | The custom bundle child product quantity. | | location | Optional | - | Object | An object containing customer location information. Use this to facilitate tax calculation. | | location.country | Optional | - | String | Customer shipping country in ISO 2 format. | | location.postal_code | Optional | - | String | Customer shipping zip/postal code. | | location.state | Optional | - | String | Customer shipping state/region. | | promo | Optional | - | Object | An object containing coupon code information. | | promo.code | Conditional | - | String | The selected coupon promo code. | | promo.email | Conditional | - | String | The associated customer email address. | description here
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb', line 68 def calculate_order_total(body, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}order_total/calculate', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CalculateOrderTotal.method(:from_hash)) .is_api_response(true)) .execute end |
#calculate_recurring_total(domain, v2_ext) ⇒ ApiResponse
This API returns an array of line item calculations grouped by recurring date. To request calculations for a specific recurring date, use the “recurring_date” parameter. To include tax calculations and exclude shipping calculations from the response, set “calculate_shipping” to true and “calculate_tax” to false in the request payload or as needed. If calculate_shipping is true or omitted, the shipping calculations will be included, and their respective arrays will be returned. If calculate_tax is true, tax calculations will be included, and their respective arrays will be returned. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | order_id | Required | - | Integer | The Order ID. | | recurring_date | Optional | - | String | Fetch calculation for a particular recurring date of an order. This is an optional parameter. Value would be a date in YYYY-MM-DD format.. | | calculate_shipping | Optional | true | Boolean | A flag that decides whether or not to calculate a shipping charges. “true” means it will calculate and “false” means it will ignore the shipping. | | calculate_tax | Optional | false | Boolean | A flag that decides whether or not to calculate a tax charges. “true” means it will calculate all taxes and “false” means it will ignore the taxes. |
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb', line 120 def calculate_recurring_total(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}recurring_total/calculate', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer)) .is_api_response(true)) .execute end |
#get_assigned_license_keys(domain, v2_ext, order_id) ⇒ ApiResponse
Get the License Keys for Products on an Order
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb', line 204 def get_assigned_license_keys(domain, v2_ext, order_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}orders/{order_id}/license_keys', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(order_id, key: 'order_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetAssignedLicenseKeys.method(:from_hash)) .is_api_response(true)) .execute end |
#order_compliance_consent(domain, v2_ext, order_id) ⇒ ApiResponse
If consent is required for an order, use this method to confirm that consent has been received
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb', line 147 def (domain, v2_ext, order_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}orders/{order_id}/consent', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(order_id, key: 'order_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#unbundle_items(domain, v2_ext, order_id) ⇒ ApiResponse
If consent is required for an order, use this method to confirm that consent has been received
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/orders_controller.rb', line 176 def unbundle_items(domain, v2_ext, order_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}orders/{order_id}/consent', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(order_id, key: 'order_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |