File indexing completed on 2025-05-04 05:32:14
0001 <?php 0002 0003 /** 0004 * ocs-webserver 0005 * 0006 * Copyright 2016 by pling GmbH. 0007 * 0008 * This file is part of ocs-webserver. 0009 * 0010 * This program is free software: you can redistribute it and/or modify 0011 * it under the terms of the GNU Affero General Public License as 0012 * published by the Free Software Foundation, either version 3 of the 0013 * License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Affero General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Affero General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 **/ 0023 class Local_Payment_PayPal_Support_ResponseSupport implements Local_Payment_PayPal_PaymentInterface 0024 { 0025 0026 /** @var array|null */ 0027 protected $_rawResponse; 0028 0029 /** 0030 * @param array|null $rawResponse 0031 */ 0032 function __construct($rawResponse = null) 0033 { 0034 if (isset($rawResponse)) { 0035 $this->_rawResponse = $rawResponse; 0036 } 0037 } 0038 0039 /** 0040 * @return bool 0041 */ 0042 public function isSuccessful() 0043 { 0044 return $this->getStatus() == 'COMPLETED'; 0045 } 0046 0047 /** 0048 * @return mixed 0049 */ 0050 public function getStatus() 0051 { 0052 return strtoupper($this->_rawResponse['payment_status']); 0053 } 0054 0055 /** 0056 * @return mixed 0057 */ 0058 public function getCustom() 0059 { 0060 return strtoupper($this->_rawResponse['custom']); 0061 } 0062 0063 /** 0064 * @return mixed 0065 */ 0066 public function getTransactionId() 0067 { 0068 return $this->_rawResponse['txn_id']; 0069 } 0070 0071 public function getTransactionStatus() 0072 { 0073 return ($this->_rawResponse['payment_status']); 0074 } 0075 0076 /** 0077 * @return mixed 0078 */ 0079 public function getPaymentId() 0080 { 0081 return null; 0082 } 0083 0084 /** 0085 * @param $name 0086 * 0087 * @return mixed 0088 */ 0089 public function getField($name) 0090 { 0091 return $this->_rawResponse[$name]; 0092 } 0093 0094 /** 0095 * @return array|null 0096 */ 0097 public function getRawMessage() 0098 { 0099 return $this->_rawResponse; 0100 } 0101 0102 /** 0103 * @return string 0104 */ 0105 public function getProviderName() 0106 { 0107 return 'paypal'; 0108 } 0109 0110 public function getTransactionAmount() 0111 { 0112 return null; 0113 } 0114 0115 public function getTransactionReceiver() 0116 { 0117 return null; 0118 } 0119 0120 }