Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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
 *  @see CheckoutByAmazon_Service_Model
17
 */
18
require_once ('CheckoutByAmazon/Service/Model.php');
19
 
20
 
21
 
22
/**
23
 * CheckoutByAmazon_Service_Model_Promotion
24
 *
25
 * Properties:
26
 * <ul>
27
 *
28
 * <li>PromotionId: IdType</li>
29
 * <li>Description: string</li>
30
 * <li>Discount: CheckoutByAmazon_Service_Model_Price</li>
31
 *
32
 * </ul>
33
 */
34
class CheckoutByAmazon_Service_Model_Promotion extends CheckoutByAmazon_Service_Model
35
{
36
 
37
 
38
    /**
39
     * Construct new CheckoutByAmazon_Service_Model_Promotion
40
     *
41
     * @param mixed $data DOMElement or Associative Array to construct from.
42
     *
43
     * Valid properties:
44
     * <ul>
45
     *
46
     * <li>PromotionId: IdType</li>
47
     * <li>Description: string</li>
48
     * <li>Discount: CheckoutByAmazon_Service_Model_Price</li>
49
     *
50
     * </ul>
51
     */
52
    public function __construct($data = null)
53
    {
54
        $this->_fields = array (
55
        'PromotionId' => array('FieldValue' => null, 'FieldType' => 'IdType'),
56
        'Description' => array('FieldValue' => null, 'FieldType' => 'string'),
57
        'Discount' => array('FieldValue' => null, 'FieldType' => 'CheckoutByAmazon_Service_Model_Price'),
58
        );
59
        parent::__construct($data);
60
    }
61
 
62
        /**
63
     * Gets the value of the PromotionId property.
64
     *
65
     * @return IdType PromotionId
66
     */
67
    public function getPromotionId()
68
    {
69
        return $this->_fields['PromotionId']['FieldValue'];
70
    }
71
 
72
    /**
73
     * Sets the value of the PromotionId property.
74
     *
75
     * @param IdType PromotionId
76
     * @return this instance
77
     */
78
    public function setPromotionId($value)
79
    {
80
        $this->_fields['PromotionId']['FieldValue'] = $value;
81
        return $this;
82
    }
83
 
84
 
85
    /**
86
     * Checks if PromotionId is set
87
     *
88
     * @return bool true if PromotionId  is set
89
     */
90
    public function isSetPromotionId()
91
    {
92
        return !is_null($this->_fields['PromotionId']['FieldValue']);
93
    }
94
 
95
    /**
96
     * Gets the value of the Description property.
97
     *
98
     * @return string Description
99
     */
100
    public function getDescription()
101
    {
102
        return $this->_fields['Description']['FieldValue'];
103
    }
104
 
105
    /**
106
     * Sets the value of the Description property.
107
     *
108
     * @param string Description
109
     * @return this instance
110
     */
111
    public function setDescription($value)
112
    {
113
        $this->_fields['Description']['FieldValue'] = $value;
114
        return $this;
115
    }
116
 
117
 
118
    /**
119
     * Checks if Description is set
120
     *
121
     * @return bool true if Description  is set
122
     */
123
    public function isSetDescription()
124
    {
125
        return !is_null($this->_fields['Description']['FieldValue']);
126
    }
127
 
128
    /**
129
     * Gets the value of the Discount.
130
     *
131
     * @return Price Discount
132
     */
133
    public function getDiscount()
134
    {
135
        return $this->_fields['Discount']['FieldValue'];
136
    }
137
 
138
    /**
139
     * Sets the value of the Discount.
140
     *
141
     * @param Price Discount
142
     * @return void
143
     */
144
    public function setDiscount($value)
145
    {
146
        $this->_fields['Discount']['FieldValue'] = $value;
147
        return;
148
    }
149
 
150
 
151
    /**
152
     * Checks if Discount  is set
153
     *
154
     * @return bool true if Discount property is set
155
     */
156
    public function isSetDiscount()
157
    {
158
        return !is_null($this->_fields['Discount']['FieldValue']);
159
 
160
    }
161
 
162
       /*
163
       * Creates a Promotion  and returns this instance
164
       *
165
       * @param PromotionId,Description,Amount
166
       * @return CheckoutByAmazon_Service_Model_Promotion instance
167
       */
168
 
169
    public function createPromotion($promotionId,$description,$amount)
170
    {
171
        $discountObject = new  CheckoutByAmazon_Service_Model_Price(
172
                                                        array('CurrencyCode' => CURRENCY_CODE, 'Amount' => $amount));
173
        $this->setPromotionId($promotionId);
174
        $this->setDescription($description);
175
        $this->setDiscount($discountObject);
176
        return $this;
177
    }
178
 
179
}
180
?>