| 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_CompletePurchaseContractResponse
|
|
|
24 |
*
|
|
|
25 |
* Properties:
|
|
|
26 |
* <ul>
|
|
|
27 |
*
|
|
|
28 |
* <li>CompletePurchaseContractResult: CheckoutByAmazon_Service_Model_CompletePurchaseContractResult</li>
|
|
|
29 |
* <li>ResponseMetadata: CheckoutByAmazon_Service_Model_ResponseMetadata</li>
|
|
|
30 |
*
|
|
|
31 |
* </ul>
|
|
|
32 |
*/
|
|
|
33 |
class CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse extends CheckoutByAmazon_Service_Model
|
|
|
34 |
{
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* Construct new CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse
|
|
|
39 |
*
|
|
|
40 |
* @param mixed $data DOMElement or Associative Array to construct from.
|
|
|
41 |
*
|
|
|
42 |
* Valid properties:
|
|
|
43 |
* <ul>
|
|
|
44 |
*
|
|
|
45 |
* <li>CompletePurchaseContractResult: CheckoutByAmazon_Service_Model_CompletePurchaseContractResult</li>
|
|
|
46 |
* <li>ResponseMetadata: CheckoutByAmazon_Service_Model_ResponseMetadata</li>
|
|
|
47 |
*
|
|
|
48 |
* </ul>
|
|
|
49 |
*/
|
|
|
50 |
public function __construct($data = null)
|
|
|
51 |
{
|
|
|
52 |
$this->_fields = array (
|
|
|
53 |
'CompletePurchaseContractResult' => array('FieldValue' => null, 'FieldType' => 'CheckoutByAmazon_Service_Model_CompletePurchaseContractResult'),
|
|
|
54 |
'ResponseMetadata' => array('FieldValue' => null, 'FieldType' => 'CheckoutByAmazon_Service_Model_ResponseMetadata'),
|
|
|
55 |
);
|
|
|
56 |
parent::__construct($data);
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
* Construct CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse from XML string
|
|
|
62 |
*
|
|
|
63 |
* @param string $xml XML string to construct from
|
|
|
64 |
* @return CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse
|
|
|
65 |
*/
|
|
|
66 |
public static function fromXML($xml)
|
|
|
67 |
{
|
|
|
68 |
$dom = new DOMDocument();
|
|
|
69 |
$dom->loadXML($xml);
|
|
|
70 |
$xpath = new DOMXPath($dom);
|
|
|
71 |
$xpath->registerNamespace('a','http://payments.amazon.com/checkout/v2/2010-08-31/');
|
|
|
72 |
$response = $xpath->query('//a:CompletePurchaseContractResponse');
|
|
|
73 |
if ($response->length == 1) {
|
|
|
74 |
return new CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse(($response->item(0)));
|
|
|
75 |
} else {
|
|
|
76 |
throw new Exception ("Unable to construct CheckoutByAmazon_Service_Model_CompletePurchaseContractResponse from provided XML.
|
|
|
77 |
Make sure that CompletePurchaseContractResponse is a root element");
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* Gets the value of the CompletePurchaseContractResult.
|
|
|
84 |
*
|
|
|
85 |
* @return CompletePurchaseContractResult CompletePurchaseContractResult
|
|
|
86 |
*/
|
|
|
87 |
public function getCompletePurchaseContractResult()
|
|
|
88 |
{
|
|
|
89 |
return $this->_fields['CompletePurchaseContractResult']['FieldValue'];
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Sets the value of the CompletePurchaseContractResult.
|
|
|
94 |
*
|
|
|
95 |
* @param CompletePurchaseContractResult CompletePurchaseContractResult
|
|
|
96 |
* @return void
|
|
|
97 |
*/
|
|
|
98 |
public function setCompletePurchaseContractResult($value)
|
|
|
99 |
{
|
|
|
100 |
$this->_fields['CompletePurchaseContractResult']['FieldValue'] = $value;
|
|
|
101 |
return;
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
/**
|
|
|
106 |
* Checks if CompletePurchaseContractResult is set
|
|
|
107 |
*
|
|
|
108 |
* @return bool true if CompletePurchaseContractResult property is set
|
|
|
109 |
*/
|
|
|
110 |
public function isSetCompletePurchaseContractResult()
|
|
|
111 |
{
|
|
|
112 |
return !is_null($this->_fields['CompletePurchaseContractResult']['FieldValue']);
|
|
|
113 |
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
/**
|
|
|
117 |
* Gets the value of the ResponseMetadata.
|
|
|
118 |
*
|
|
|
119 |
* @return ResponseMetadata ResponseMetadata
|
|
|
120 |
*/
|
|
|
121 |
public function getResponseMetadata()
|
|
|
122 |
{
|
|
|
123 |
return $this->_fields['ResponseMetadata']['FieldValue'];
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
/**
|
|
|
127 |
* Sets the value of the ResponseMetadata.
|
|
|
128 |
*
|
|
|
129 |
* @param ResponseMetadata ResponseMetadata
|
|
|
130 |
* @return void
|
|
|
131 |
*/
|
|
|
132 |
public function setResponseMetadata($value)
|
|
|
133 |
{
|
|
|
134 |
$this->_fields['ResponseMetadata']['FieldValue'] = $value;
|
|
|
135 |
return;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
/**
|
|
|
140 |
* Checks if ResponseMetadata is set
|
|
|
141 |
*
|
|
|
142 |
* @return bool true if ResponseMetadata property is set
|
|
|
143 |
*/
|
|
|
144 |
public function isSetResponseMetadata()
|
|
|
145 |
{
|
|
|
146 |
return !is_null($this->_fields['ResponseMetadata']['FieldValue']);
|
|
|
147 |
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
/**
|
|
|
153 |
* XML Representation for this object
|
|
|
154 |
*
|
|
|
155 |
* @return string XML for this object
|
|
|
156 |
*/
|
|
|
157 |
public function toXML()
|
|
|
158 |
{
|
|
|
159 |
$xml = "";
|
|
|
160 |
$xml .= "<CompletePurchaseContractResponse xmlns=\"http://payments.amazon.com/checkout/v2/2010-08-31/\">";
|
|
|
161 |
$xml .= $this->_toXMLFragment();
|
|
|
162 |
$xml .= "</CompletePurchaseContractResponse>";
|
|
|
163 |
return $xml;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
}
|
|
|
167 |
?>
|