| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*******************************************************************************
|
|
|
3 |
* Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
*
|
|
|
6 |
* You may not use this file except in compliance with the License.
|
|
|
7 |
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
|
|
|
8 |
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
9 |
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
|
10 |
* specific language governing permissions and limitations under the License.
|
|
|
11 |
* *****************************************************************************
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
/**
|
|
|
15 |
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
interface CheckoutByAmazon_Service_Interface
|
|
|
19 |
{
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* This function calls createPurchaseContract API and returns the PurchaseContract ID.
|
|
|
23 |
* If you use this API, you must pass the Purchase Contract ID as input to the InlineCheckoutWidget.
|
|
|
24 |
* If no Purchase Contract ID is passed to the InlineCheckoutWidget, the widget will always create
|
|
|
25 |
* and return a new Purchase Contract ID.For most cases, you don't need to use this API. A
|
|
|
26 |
* Purchase Contract ID will be returned to you from the InlineCheckoutWidget, which you can then
|
|
|
27 |
* use with the other APIs.
|
|
|
28 |
* @param void
|
|
|
29 |
* @return String PurchaseContractId
|
|
|
30 |
* @throws CheckoutByAmazon_Service_RequestException ,CheckoutByAmazon_Service_Exception
|
|
|
31 |
*
|
|
|
32 |
*/
|
|
|
33 |
public function createPurchaseContract();
|
|
|
34 |
|
|
|
35 |
/**
|
|
|
36 |
*This function calls getPurchaseContract API and returns the Address List.
|
|
|
37 |
*It returns the Destination information if the buyer selected an address. This can be used if we need to
|
|
|
38 |
*calculate Promotions and Shipping charges based on the address selected by the user
|
|
|
39 |
*@param String PurchaseContractId
|
|
|
40 |
*
|
|
|
41 |
*@return List<ShippingAddress> of all the shipping addresses selected
|
|
|
42 |
* @throws CheckoutByAmazon_Service_RequestException,CheckoutByAmazon_Service_Exception
|
|
|
43 |
*/
|
|
|
44 |
public function getAddress($PurchaseContractId);
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* This function calls SetContractCharges API. You can use this API to set shipping
|
|
|
49 |
* or promotion amounts for the entire purchase contract.After the purchase contract is
|
|
|
50 |
* completed (that is, the order is placed), the contract charges are distributed to each item
|
|
|
51 |
* proportional to the item's cost (that is, the item's unit price multiplied by the quantity).
|
|
|
52 |
* However, the sum of charge amounts distributed to each item will be equal to the contract charge
|
|
|
53 |
* amount you set with this API.Please refer to the sample codes to see how this can be set.
|
|
|
54 |
* There can be following valid sets of input charge elements to this API –
|
|
|
55 |
* Shipping + Promotion
|
|
|
56 |
* Shipping + No Promotion
|
|
|
57 |
* No Shipping + Promotion
|
|
|
58 |
* @param String PurchaseContractId, Charges ChargesObject
|
|
|
59 |
* @return int 1 if setting contract charges was successful.
|
|
|
60 |
* @throws CheckoutByAmazonServiceRequestException,CheckoutByAmazonServiceException
|
|
|
61 |
*/
|
|
|
62 |
public function setContractCharges($PurchaseContractId, $Charges);
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* This function calls SetPurchaseItems API.The SetPurchaseItems API will take the list
|
|
|
68 |
* of order items as input. You can specify the order total (that is, the
|
|
|
69 |
* amount the buyer will be charged for the entire order) broken down to each item as part of this
|
|
|
70 |
* API call. Please look at the sample code to see how each value can be set for the Item
|
|
|
71 |
* @param String PurchaseContract ID , List<PurchaseItem> Items
|
|
|
72 |
* @return int 1 if setting items was successful.
|
|
|
73 |
* @throws CheckoutByAmazon_Service_RequestException,CheckoutByAmazon_Service_Exception
|
|
|
74 |
*/
|
|
|
75 |
public function setItems($PurchaseContractId,$ItemList);
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* This function is used to complete the order after setting the Items and contract charges or just the Items only.
|
|
|
80 |
* This API transforms the purchase contract into Checkout by Amazon orders and
|
|
|
81 |
* returns you a list of Checkout by Amazon Order IDs.
|
|
|
82 |
* @param String PurchaseContractId
|
|
|
83 |
* @return List of all Order ids
|
|
|
84 |
* @throws CheckoutByAmazon_Service_RequestException ,CheckoutByAmazon_Service_Exception
|
|
|
85 |
*/
|
|
|
86 |
public function completeOrder($PurchaseContractId);
|
|
|
87 |
}
|
|
|
88 |
?>
|