| 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 |
require_once ('/usr/share/php/CheckoutByAmazonService.config.inc.php');
|
|
|
16 |
define(MERCHANT_ID,$merchantID);
|
|
|
17 |
define(ACCESS_KEY_ID,$accessKey);
|
|
|
18 |
define(SECRET_ACCESS_KEY,$secretKey);
|
|
|
19 |
define(WEIGHT_UNIT,$weightUnit);
|
|
|
20 |
define(VERSION,$version);
|
|
|
21 |
define(CURRENCY_CODE,$currencyCode);
|
|
|
22 |
define(CBA_SERVICE_URL,$cbaServiceURL);
|
|
|
23 |
class CheckoutByAmazon_Service_MerchantValues
|
|
|
24 |
{
|
|
|
25 |
private $merchantId;
|
|
|
26 |
private static $instance ;
|
|
|
27 |
private $accessKey;
|
|
|
28 |
private $secretKey;
|
|
|
29 |
private $weightUnit;
|
|
|
30 |
private $currencyCode;
|
|
|
31 |
private $version;
|
|
|
32 |
private $cbaServiceUrl;
|
|
|
33 |
|
|
|
34 |
private function __construct()
|
|
|
35 |
{
|
|
|
36 |
$this->merchantId = MERCHANT_ID;
|
|
|
37 |
$this->accessKey = ACCESS_KEY_ID;
|
|
|
38 |
$this->secretKey = SECRET_ACCESS_KEY;
|
|
|
39 |
$this->weightUnit = WEIGHT_UNIT;
|
|
|
40 |
$this->currencyCode = CURRENCY_CODE;
|
|
|
41 |
$this->version = VERSION;
|
|
|
42 |
$this->cbaServiceUrl = CBA_SERVICE_URL;
|
|
|
43 |
|
|
|
44 |
if($this->merchantId == "")
|
|
|
45 |
{
|
|
|
46 |
trigger_error("Merchant Id not set in the properties file ",E_USER_ERROR);
|
|
|
47 |
exit(0);
|
|
|
48 |
}
|
|
|
49 |
if($this->accessKey == "")
|
|
|
50 |
{
|
|
|
51 |
trigger_error("AccessKey not set in the properties file ",E_USER_ERROR);
|
|
|
52 |
exit(0);
|
|
|
53 |
}
|
|
|
54 |
if($this->secretKey == "")
|
|
|
55 |
{
|
|
|
56 |
trigger_error("Secret Key not set in the properties file ",E_USER_ERROR);
|
|
|
57 |
exit(0);
|
|
|
58 |
}
|
|
|
59 |
if($this->weightUnit == "")
|
|
|
60 |
{
|
|
|
61 |
trigger_error("Weight Unit not set in the properties file ",E_USER_ERROR);
|
|
|
62 |
exit(0);
|
|
|
63 |
}
|
|
|
64 |
if($this->currencyCode == "")
|
|
|
65 |
{
|
|
|
66 |
trigger_error("Currency Code not set in the properties file ",E_USER_ERROR);
|
|
|
67 |
exit(0);
|
|
|
68 |
}
|
|
|
69 |
if($this->version == "")
|
|
|
70 |
{
|
|
|
71 |
trigger_error("Version Id not set in the properties file ",E_USER_ERROR);
|
|
|
72 |
exit(0);
|
|
|
73 |
}
|
|
|
74 |
if($this->cbaServiceUrl == "")
|
|
|
75 |
{
|
|
|
76 |
trigger_error("CbaServiceUrl not set in the properties file ",E_USER_ERROR);
|
|
|
77 |
exit(0);
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
public static function getInstance()
|
|
|
85 |
{
|
|
|
86 |
if(self::$instance == null)
|
|
|
87 |
{
|
|
|
88 |
self::$instance = new CheckoutByAmazon_Service_MerchantValues();
|
|
|
89 |
|
|
|
90 |
}
|
|
|
91 |
return self::$instance;
|
|
|
92 |
}
|
|
|
93 |
public function getMerchantId()
|
|
|
94 |
{
|
|
|
95 |
return $this->merchantId;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
public function getAccessKey()
|
|
|
100 |
{
|
|
|
101 |
return $this->accessKey;
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
public function getSecretKey()
|
|
|
105 |
{
|
|
|
106 |
return $this->secretKey;
|
|
|
107 |
}
|
|
|
108 |
public function getWeightUnit()
|
|
|
109 |
{
|
|
|
110 |
return $this->weightUnit;
|
|
|
111 |
|
|
|
112 |
}
|
|
|
113 |
public function getCurrencyCode()
|
|
|
114 |
{
|
|
|
115 |
return $this->currencyCode;
|
|
|
116 |
}
|
|
|
117 |
public function getVersion()
|
|
|
118 |
{
|
|
|
119 |
return $this->version;
|
|
|
120 |
}
|
|
|
121 |
public function getCbaServiceUrl()
|
|
|
122 |
{
|
|
|
123 |
return $this->cbaServiceUrl;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
?>
|
|
|
129 |
|
|
|
130 |
|