1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\ShoppingContent\Resource; 19 20use Google\Service\ShoppingContent\CaptureOrderRequest; 21use Google\Service\ShoppingContent\CaptureOrderResponse; 22use Google\Service\ShoppingContent\Order; 23use Google\Service\ShoppingContent\OrdersAcknowledgeRequest; 24use Google\Service\ShoppingContent\OrdersAcknowledgeResponse; 25use Google\Service\ShoppingContent\OrdersAdvanceTestOrderResponse; 26use Google\Service\ShoppingContent\OrdersCancelLineItemRequest; 27use Google\Service\ShoppingContent\OrdersCancelLineItemResponse; 28use Google\Service\ShoppingContent\OrdersCancelRequest; 29use Google\Service\ShoppingContent\OrdersCancelResponse; 30use Google\Service\ShoppingContent\OrdersCancelTestOrderByCustomerRequest; 31use Google\Service\ShoppingContent\OrdersCancelTestOrderByCustomerResponse; 32use Google\Service\ShoppingContent\OrdersCreateTestOrderRequest; 33use Google\Service\ShoppingContent\OrdersCreateTestOrderResponse; 34use Google\Service\ShoppingContent\OrdersCreateTestReturnRequest; 35use Google\Service\ShoppingContent\OrdersCreateTestReturnResponse; 36use Google\Service\ShoppingContent\OrdersGetByMerchantOrderIdResponse; 37use Google\Service\ShoppingContent\OrdersGetTestOrderTemplateResponse; 38use Google\Service\ShoppingContent\OrdersInStoreRefundLineItemRequest; 39use Google\Service\ShoppingContent\OrdersInStoreRefundLineItemResponse; 40use Google\Service\ShoppingContent\OrdersListResponse; 41use Google\Service\ShoppingContent\OrdersRefundItemRequest; 42use Google\Service\ShoppingContent\OrdersRefundItemResponse; 43use Google\Service\ShoppingContent\OrdersRefundOrderRequest; 44use Google\Service\ShoppingContent\OrdersRefundOrderResponse; 45use Google\Service\ShoppingContent\OrdersRejectReturnLineItemRequest; 46use Google\Service\ShoppingContent\OrdersRejectReturnLineItemResponse; 47use Google\Service\ShoppingContent\OrdersReturnRefundLineItemRequest; 48use Google\Service\ShoppingContent\OrdersReturnRefundLineItemResponse; 49use Google\Service\ShoppingContent\OrdersSetLineItemMetadataRequest; 50use Google\Service\ShoppingContent\OrdersSetLineItemMetadataResponse; 51use Google\Service\ShoppingContent\OrdersShipLineItemsRequest; 52use Google\Service\ShoppingContent\OrdersShipLineItemsResponse; 53use Google\Service\ShoppingContent\OrdersUpdateLineItemShippingDetailsRequest; 54use Google\Service\ShoppingContent\OrdersUpdateLineItemShippingDetailsResponse; 55use Google\Service\ShoppingContent\OrdersUpdateMerchantOrderIdRequest; 56use Google\Service\ShoppingContent\OrdersUpdateMerchantOrderIdResponse; 57use Google\Service\ShoppingContent\OrdersUpdateShipmentRequest; 58use Google\Service\ShoppingContent\OrdersUpdateShipmentResponse; 59 60/** 61 * The "orders" collection of methods. 62 * Typical usage is: 63 * <code> 64 * $contentService = new Google\Service\ShoppingContent(...); 65 * $orders = $contentService->orders; 66 * </code> 67 */ 68class Orders extends \Google\Service\Resource 69{ 70 /** 71 * Marks an order as acknowledged. (orders.acknowledge) 72 * 73 * @param string $merchantId The ID of the account that manages the order. This 74 * cannot be a multi-client account. 75 * @param string $orderId The ID of the order. 76 * @param OrdersAcknowledgeRequest $postBody 77 * @param array $optParams Optional parameters. 78 * @return OrdersAcknowledgeResponse 79 */ 80 public function acknowledge($merchantId, $orderId, OrdersAcknowledgeRequest $postBody, $optParams = []) 81 { 82 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 83 $params = array_merge($params, $optParams); 84 return $this->call('acknowledge', [$params], OrdersAcknowledgeResponse::class); 85 } 86 /** 87 * Sandbox only. Moves a test order from state "`inProgress`" to state 88 * "`pendingShipment`". (orders.advancetestorder) 89 * 90 * @param string $merchantId The ID of the account that manages the order. This 91 * cannot be a multi-client account. 92 * @param string $orderId The ID of the test order to modify. 93 * @param array $optParams Optional parameters. 94 * @return OrdersAdvanceTestOrderResponse 95 */ 96 public function advancetestorder($merchantId, $orderId, $optParams = []) 97 { 98 $params = ['merchantId' => $merchantId, 'orderId' => $orderId]; 99 $params = array_merge($params, $optParams); 100 return $this->call('advancetestorder', [$params], OrdersAdvanceTestOrderResponse::class); 101 } 102 /** 103 * Cancels all line items in an order, making a full refund. (orders.cancel) 104 * 105 * @param string $merchantId The ID of the account that manages the order. This 106 * cannot be a multi-client account. 107 * @param string $orderId The ID of the order to cancel. 108 * @param OrdersCancelRequest $postBody 109 * @param array $optParams Optional parameters. 110 * @return OrdersCancelResponse 111 */ 112 public function cancel($merchantId, $orderId, OrdersCancelRequest $postBody, $optParams = []) 113 { 114 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 115 $params = array_merge($params, $optParams); 116 return $this->call('cancel', [$params], OrdersCancelResponse::class); 117 } 118 /** 119 * Cancels a line item, making a full refund. (orders.cancellineitem) 120 * 121 * @param string $merchantId The ID of the account that manages the order. This 122 * cannot be a multi-client account. 123 * @param string $orderId The ID of the order. 124 * @param OrdersCancelLineItemRequest $postBody 125 * @param array $optParams Optional parameters. 126 * @return OrdersCancelLineItemResponse 127 */ 128 public function cancellineitem($merchantId, $orderId, OrdersCancelLineItemRequest $postBody, $optParams = []) 129 { 130 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 131 $params = array_merge($params, $optParams); 132 return $this->call('cancellineitem', [$params], OrdersCancelLineItemResponse::class); 133 } 134 /** 135 * Sandbox only. Cancels a test order for customer-initiated cancellation. 136 * (orders.canceltestorderbycustomer) 137 * 138 * @param string $merchantId The ID of the account that manages the order. This 139 * cannot be a multi-client account. 140 * @param string $orderId The ID of the test order to cancel. 141 * @param OrdersCancelTestOrderByCustomerRequest $postBody 142 * @param array $optParams Optional parameters. 143 * @return OrdersCancelTestOrderByCustomerResponse 144 */ 145 public function canceltestorderbycustomer($merchantId, $orderId, OrdersCancelTestOrderByCustomerRequest $postBody, $optParams = []) 146 { 147 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 148 $params = array_merge($params, $optParams); 149 return $this->call('canceltestorderbycustomer', [$params], OrdersCancelTestOrderByCustomerResponse::class); 150 } 151 /** 152 * Capture funds from the customer for the current order total. This method 153 * should be called after the merchant verifies that they are able and ready to 154 * start shipping the order. This method blocks until a response is received 155 * from the payment processsor. If this method succeeds, the merchant is 156 * guaranteed to receive funds for the order after shipment. If the request 157 * fails, it can be retried or the order may be cancelled. This method cannot be 158 * called after the entire order is already shipped. A rejected error code is 159 * returned when the payment service provider has declined the charge. This 160 * indicates a problem between the PSP and either the merchant's or customer's 161 * account. Sometimes this error will be resolved by the customer. We recommend 162 * retrying these errors once per day or cancelling the order with reason 163 * `failedToCaptureFunds` if the items cannot be held. (orders.captureOrder) 164 * 165 * @param string $merchantId Required. The ID of the account that manages the 166 * order. This cannot be a multi-client account. 167 * @param string $orderId Required. The ID of the Order. 168 * @param CaptureOrderRequest $postBody 169 * @param array $optParams Optional parameters. 170 * @return CaptureOrderResponse 171 */ 172 public function captureOrder($merchantId, $orderId, CaptureOrderRequest $postBody, $optParams = []) 173 { 174 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 175 $params = array_merge($params, $optParams); 176 return $this->call('captureOrder', [$params], CaptureOrderResponse::class); 177 } 178 /** 179 * Sandbox only. Creates a test order. (orders.createtestorder) 180 * 181 * @param string $merchantId The ID of the account that should manage the order. 182 * This cannot be a multi-client account. 183 * @param OrdersCreateTestOrderRequest $postBody 184 * @param array $optParams Optional parameters. 185 * @return OrdersCreateTestOrderResponse 186 */ 187 public function createtestorder($merchantId, OrdersCreateTestOrderRequest $postBody, $optParams = []) 188 { 189 $params = ['merchantId' => $merchantId, 'postBody' => $postBody]; 190 $params = array_merge($params, $optParams); 191 return $this->call('createtestorder', [$params], OrdersCreateTestOrderResponse::class); 192 } 193 /** 194 * Sandbox only. Creates a test return. (orders.createtestreturn) 195 * 196 * @param string $merchantId The ID of the account that manages the order. This 197 * cannot be a multi-client account. 198 * @param string $orderId The ID of the order. 199 * @param OrdersCreateTestReturnRequest $postBody 200 * @param array $optParams Optional parameters. 201 * @return OrdersCreateTestReturnResponse 202 */ 203 public function createtestreturn($merchantId, $orderId, OrdersCreateTestReturnRequest $postBody, $optParams = []) 204 { 205 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 206 $params = array_merge($params, $optParams); 207 return $this->call('createtestreturn', [$params], OrdersCreateTestReturnResponse::class); 208 } 209 /** 210 * Retrieves an order from your Merchant Center account. (orders.get) 211 * 212 * @param string $merchantId The ID of the account that manages the order. This 213 * cannot be a multi-client account. 214 * @param string $orderId The ID of the order. 215 * @param array $optParams Optional parameters. 216 * @return Order 217 */ 218 public function get($merchantId, $orderId, $optParams = []) 219 { 220 $params = ['merchantId' => $merchantId, 'orderId' => $orderId]; 221 $params = array_merge($params, $optParams); 222 return $this->call('get', [$params], Order::class); 223 } 224 /** 225 * Retrieves an order using merchant order ID. (orders.getbymerchantorderid) 226 * 227 * @param string $merchantId The ID of the account that manages the order. This 228 * cannot be a multi-client account. 229 * @param string $merchantOrderId The merchant order ID to be looked for. 230 * @param array $optParams Optional parameters. 231 * @return OrdersGetByMerchantOrderIdResponse 232 */ 233 public function getbymerchantorderid($merchantId, $merchantOrderId, $optParams = []) 234 { 235 $params = ['merchantId' => $merchantId, 'merchantOrderId' => $merchantOrderId]; 236 $params = array_merge($params, $optParams); 237 return $this->call('getbymerchantorderid', [$params], OrdersGetByMerchantOrderIdResponse::class); 238 } 239 /** 240 * Sandbox only. Retrieves an order template that can be used to quickly create 241 * a new order in sandbox. (orders.gettestordertemplate) 242 * 243 * @param string $merchantId The ID of the account that should manage the order. 244 * This cannot be a multi-client account. 245 * @param string $templateName The name of the template to retrieve. 246 * @param array $optParams Optional parameters. 247 * 248 * @opt_param string country The country of the template to retrieve. Defaults 249 * to "`US`". 250 * @return OrdersGetTestOrderTemplateResponse 251 */ 252 public function gettestordertemplate($merchantId, $templateName, $optParams = []) 253 { 254 $params = ['merchantId' => $merchantId, 'templateName' => $templateName]; 255 $params = array_merge($params, $optParams); 256 return $this->call('gettestordertemplate', [$params], OrdersGetTestOrderTemplateResponse::class); 257 } 258 /** 259 * Deprecated. Notifies that item return and refund was handled directly by 260 * merchant outside of Google payments processing (for example, cash refund done 261 * in store). Note: We recommend calling the returnrefundlineitem method to 262 * refund in-store returns. We will issue the refund directly to the customer. 263 * This helps to prevent possible differences arising between merchant and 264 * Google transaction records. We also recommend having the point of sale system 265 * communicate with Google to ensure that customers do not receive a double 266 * refund by first refunding through Google then through an in-store return. 267 * (orders.instorerefundlineitem) 268 * 269 * @param string $merchantId The ID of the account that manages the order. This 270 * cannot be a multi-client account. 271 * @param string $orderId The ID of the order. 272 * @param OrdersInStoreRefundLineItemRequest $postBody 273 * @param array $optParams Optional parameters. 274 * @return OrdersInStoreRefundLineItemResponse 275 */ 276 public function instorerefundlineitem($merchantId, $orderId, OrdersInStoreRefundLineItemRequest $postBody, $optParams = []) 277 { 278 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 279 $params = array_merge($params, $optParams); 280 return $this->call('instorerefundlineitem', [$params], OrdersInStoreRefundLineItemResponse::class); 281 } 282 /** 283 * Lists the orders in your Merchant Center account. (orders.listOrders) 284 * 285 * @param string $merchantId The ID of the account that manages the order. This 286 * cannot be a multi-client account. 287 * @param array $optParams Optional parameters. 288 * 289 * @opt_param bool acknowledged Obtains orders that match the acknowledgement 290 * status. When set to true, obtains orders that have been acknowledged. When 291 * false, obtains orders that have not been acknowledged. We recommend using 292 * this filter set to `false`, in conjunction with the `acknowledge` call, such 293 * that only un-acknowledged orders are returned. 294 * @opt_param string maxResults The maximum number of orders to return in the 295 * response, used for paging. The default value is 25 orders per page, and the 296 * maximum allowed value is 250 orders per page. 297 * @opt_param string orderBy Order results by placement date in descending or 298 * ascending order. Acceptable values are: - placedDateAsc - placedDateDesc 299 * @opt_param string pageToken The token returned by the previous request. 300 * @opt_param string placedDateEnd Obtains orders placed before this date 301 * (exclusively), in ISO 8601 format. 302 * @opt_param string placedDateStart Obtains orders placed after this date 303 * (inclusively), in ISO 8601 format. 304 * @opt_param string statuses Obtains orders that match any of the specified 305 * statuses. Note that `active` is a shortcut for `pendingShipment` and 306 * `partiallyShipped`, and `completed` is a shortcut for `shipped`, 307 * `partiallyDelivered`, `delivered`, `partiallyReturned`, `returned`, and 308 * `canceled`. 309 * @return OrdersListResponse 310 */ 311 public function listOrders($merchantId, $optParams = []) 312 { 313 $params = ['merchantId' => $merchantId]; 314 $params = array_merge($params, $optParams); 315 return $this->call('list', [$params], OrdersListResponse::class); 316 } 317 /** 318 * Issues a partial or total refund for items and shipment. (orders.refunditem) 319 * 320 * @param string $merchantId The ID of the account that manages the order. This 321 * cannot be a multi-client account. 322 * @param string $orderId The ID of the order to refund. 323 * @param OrdersRefundItemRequest $postBody 324 * @param array $optParams Optional parameters. 325 * @return OrdersRefundItemResponse 326 */ 327 public function refunditem($merchantId, $orderId, OrdersRefundItemRequest $postBody, $optParams = []) 328 { 329 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 330 $params = array_merge($params, $optParams); 331 return $this->call('refunditem', [$params], OrdersRefundItemResponse::class); 332 } 333 /** 334 * Issues a partial or total refund for an order. (orders.refundorder) 335 * 336 * @param string $merchantId The ID of the account that manages the order. This 337 * cannot be a multi-client account. 338 * @param string $orderId The ID of the order to refund. 339 * @param OrdersRefundOrderRequest $postBody 340 * @param array $optParams Optional parameters. 341 * @return OrdersRefundOrderResponse 342 */ 343 public function refundorder($merchantId, $orderId, OrdersRefundOrderRequest $postBody, $optParams = []) 344 { 345 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 346 $params = array_merge($params, $optParams); 347 return $this->call('refundorder', [$params], OrdersRefundOrderResponse::class); 348 } 349 /** 350 * Rejects return on an line item. (orders.rejectreturnlineitem) 351 * 352 * @param string $merchantId The ID of the account that manages the order. This 353 * cannot be a multi-client account. 354 * @param string $orderId The ID of the order. 355 * @param OrdersRejectReturnLineItemRequest $postBody 356 * @param array $optParams Optional parameters. 357 * @return OrdersRejectReturnLineItemResponse 358 */ 359 public function rejectreturnlineitem($merchantId, $orderId, OrdersRejectReturnLineItemRequest $postBody, $optParams = []) 360 { 361 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 362 $params = array_merge($params, $optParams); 363 return $this->call('rejectreturnlineitem', [$params], OrdersRejectReturnLineItemResponse::class); 364 } 365 /** 366 * Returns and refunds a line item. Note that this method can only be called on 367 * fully shipped orders. The Orderreturns API is the preferred way to handle 368 * returns after you receive a return from a customer. You can use 369 * Orderreturns.list or Orderreturns.get to search for the return, and then use 370 * Orderreturns.processreturn to issue the refund. If the return cannot be 371 * found, then we recommend using this API to issue a refund. 372 * (orders.returnrefundlineitem) 373 * 374 * @param string $merchantId The ID of the account that manages the order. This 375 * cannot be a multi-client account. 376 * @param string $orderId The ID of the order. 377 * @param OrdersReturnRefundLineItemRequest $postBody 378 * @param array $optParams Optional parameters. 379 * @return OrdersReturnRefundLineItemResponse 380 */ 381 public function returnrefundlineitem($merchantId, $orderId, OrdersReturnRefundLineItemRequest $postBody, $optParams = []) 382 { 383 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 384 $params = array_merge($params, $optParams); 385 return $this->call('returnrefundlineitem', [$params], OrdersReturnRefundLineItemResponse::class); 386 } 387 /** 388 * Sets (or overrides if it already exists) merchant provided annotations in the 389 * form of key-value pairs. A common use case would be to supply us with 390 * additional structured information about a line item that cannot be provided 391 * through other methods. Submitted key-value pairs can be retrieved as part of 392 * the orders resource. (orders.setlineitemmetadata) 393 * 394 * @param string $merchantId The ID of the account that manages the order. This 395 * cannot be a multi-client account. 396 * @param string $orderId The ID of the order. 397 * @param OrdersSetLineItemMetadataRequest $postBody 398 * @param array $optParams Optional parameters. 399 * @return OrdersSetLineItemMetadataResponse 400 */ 401 public function setlineitemmetadata($merchantId, $orderId, OrdersSetLineItemMetadataRequest $postBody, $optParams = []) 402 { 403 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 404 $params = array_merge($params, $optParams); 405 return $this->call('setlineitemmetadata', [$params], OrdersSetLineItemMetadataResponse::class); 406 } 407 /** 408 * Marks line item(s) as shipped. (orders.shiplineitems) 409 * 410 * @param string $merchantId The ID of the account that manages the order. This 411 * cannot be a multi-client account. 412 * @param string $orderId The ID of the order. 413 * @param OrdersShipLineItemsRequest $postBody 414 * @param array $optParams Optional parameters. 415 * @return OrdersShipLineItemsResponse 416 */ 417 public function shiplineitems($merchantId, $orderId, OrdersShipLineItemsRequest $postBody, $optParams = []) 418 { 419 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 420 $params = array_merge($params, $optParams); 421 return $this->call('shiplineitems', [$params], OrdersShipLineItemsResponse::class); 422 } 423 /** 424 * Updates ship by and delivery by dates for a line item. 425 * (orders.updatelineitemshippingdetails) 426 * 427 * @param string $merchantId The ID of the account that manages the order. This 428 * cannot be a multi-client account. 429 * @param string $orderId The ID of the order. 430 * @param OrdersUpdateLineItemShippingDetailsRequest $postBody 431 * @param array $optParams Optional parameters. 432 * @return OrdersUpdateLineItemShippingDetailsResponse 433 */ 434 public function updatelineitemshippingdetails($merchantId, $orderId, OrdersUpdateLineItemShippingDetailsRequest $postBody, $optParams = []) 435 { 436 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 437 $params = array_merge($params, $optParams); 438 return $this->call('updatelineitemshippingdetails', [$params], OrdersUpdateLineItemShippingDetailsResponse::class); 439 } 440 /** 441 * Updates the merchant order ID for a given order. 442 * (orders.updatemerchantorderid) 443 * 444 * @param string $merchantId The ID of the account that manages the order. This 445 * cannot be a multi-client account. 446 * @param string $orderId The ID of the order. 447 * @param OrdersUpdateMerchantOrderIdRequest $postBody 448 * @param array $optParams Optional parameters. 449 * @return OrdersUpdateMerchantOrderIdResponse 450 */ 451 public function updatemerchantorderid($merchantId, $orderId, OrdersUpdateMerchantOrderIdRequest $postBody, $optParams = []) 452 { 453 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 454 $params = array_merge($params, $optParams); 455 return $this->call('updatemerchantorderid', [$params], OrdersUpdateMerchantOrderIdResponse::class); 456 } 457 /** 458 * Updates a shipment's status, carrier, and/or tracking ID. 459 * (orders.updateshipment) 460 * 461 * @param string $merchantId The ID of the account that manages the order. This 462 * cannot be a multi-client account. 463 * @param string $orderId The ID of the order. 464 * @param OrdersUpdateShipmentRequest $postBody 465 * @param array $optParams Optional parameters. 466 * @return OrdersUpdateShipmentResponse 467 */ 468 public function updateshipment($merchantId, $orderId, OrdersUpdateShipmentRequest $postBody, $optParams = []) 469 { 470 $params = ['merchantId' => $merchantId, 'orderId' => $orderId, 'postBody' => $postBody]; 471 $params = array_merge($params, $optParams); 472 return $this->call('updateshipment', [$params], OrdersUpdateShipmentResponse::class); 473 } 474} 475 476// Adding a class alias for backwards compatibility with the previous class name. 477class_alias(Orders::class, 'Google_Service_ShoppingContent_Resource_Orders'); 478