File indexing completed on 2025-05-04 05:32:13
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 abstract class Local_Payment_Amazon_FlexiblePayment_Gateway implements Local_Payment_GatewayInterface 0024 { 0025 /** @var \Zend_Config */ 0026 protected $_config; 0027 /** @var \Zend_Log */ 0028 protected $_logger; 0029 0030 /** @var \Local_Payment_Amazon_UserData */ 0031 protected $_paymentUserData; 0032 protected $_dataIpn; 0033 protected $_returnUrl; 0034 protected $_ipnNotificationUrl; 0035 protected $_cancelUrl; 0036 0037 /** 0038 * @param array|Zend_config $config 0039 * @param Zend_Log_Writer_Abstract $logger 0040 * @throws Local_Payment_Exception 0041 */ 0042 function __construct($config, $logger = null) 0043 { 0044 if (is_array($config)) { 0045 $this->_config = new Zend_Config($config); 0046 } else { 0047 if ($config instanceof Zend_Config) { 0048 $this->_config = $config; 0049 } 0050 } 0051 if (is_null($logger)) { 0052 $this->_logger = Zend_Registry::get('logger'); 0053 } else { 0054 if ($logger instanceof Zend_Log) { 0055 $this->_logger = $logger; 0056 } else { 0057 throw new Local_Payment_Exception('Logger must be an instance of Zend_Log'); 0058 } 0059 } 0060 0061 $this->_paymentUserData = new Local_Payment_Amazon_UserData(); 0062 } 0063 0064 /** 0065 * @param float $amount 0066 * @param string $requestMsg 0067 * @return Local_Payment_ResponseInterface 0068 */ 0069 public function requestPayment($amount, $requestMsg = null) 0070 { 0071 $log = $this->_logger; 0072 0073 $log->info('********** Start Amazon Payment **********'); 0074 $log->info(__FUNCTION__); 0075 $log->debug(APPLICATION_ENV); 0076 0077 $response = new Local_Payment_Amazon_FlexiblePayment_Response(null); 0078 0079 $log->info('********** Finished Amazon Payment **********'); 0080 0081 return $response; 0082 0083 } 0084 0085 /** 0086 * @param Local_Payment_Amazon_UserData $userData 0087 * @throws Exception 0088 */ 0089 public function setUserDataStore($userData) 0090 { 0091 if (false === ($userData instanceof Local_Payment_UserDataInterface)) { 0092 throw new Exception('Wrong data type for user data'); 0093 } 0094 $this->_paymentUserData = $userData; 0095 } 0096 0097 /** 0098 * @return Local_Payment_Amazon_UserData 0099 */ 0100 public function getUserDataStore() 0101 { 0102 return $this->_paymentUserData; 0103 } 0104 0105 /** 0106 * @return string 0107 */ 0108 public function getCancelUrl() 0109 { 0110 return $this->_cancelUrl; 0111 } 0112 0113 /** 0114 * @param string $cancelUrl 0115 */ 0116 public function setCancelUrl($cancelUrl) 0117 { 0118 $this->_cancelUrl = $cancelUrl; 0119 } 0120 0121 /** 0122 * @return string 0123 */ 0124 public function getIpnNotificationUrl() 0125 { 0126 return $this->_ipnNotificationUrl; 0127 } 0128 0129 /** 0130 * @param string $ipnNotificationUrl 0131 */ 0132 public function setIpnNotificationUrl($ipnNotificationUrl) 0133 { 0134 $this->_ipnNotificationUrl = $ipnNotificationUrl; 0135 } 0136 0137 /** 0138 * @return string 0139 */ 0140 public function getReturnUrl() 0141 { 0142 return $this->_returnUrl; 0143 } 0144 0145 /** 0146 * @param string $returnUrl 0147 */ 0148 public function setReturnUrl($returnUrl) 0149 { 0150 $this->_returnUrl = $returnUrl; 0151 } 0152 0153 }