00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_AmazonPayments_Model_Api_Asp_Fps_Response_Abstract extends Varien_Object
00035 {
00036
00037
00038
00039 const STATUS_CANCELLED = 'Cancelled';
00040 const STATUS_FAILURE = 'Failure';
00041 const STATUS_PENDING = 'Pending';
00042 const STATUS_RESERVED = 'Reserved';
00043 const STATUS_SUCCESS = 'Success';
00044 const STATUS_ERROR = 'Error';
00045
00046
00047
00048
00049
00050
00051
00052 public function init($responseBody)
00053 {
00054 if (!$this->parse($responseBody)) {
00055 return false;
00056 }
00057 return $this;
00058 }
00059
00060
00061
00062
00063
00064
00065
00066 protected function parse($responseBody)
00067 {
00068 $responseId = (string)$responseBody->ResponseMetadata->RequestId;
00069 if($responseId == '') {
00070 return false;
00071 }
00072 $this->setData('Id', $responseId);
00073
00074 if (!$status = $this->getData('Status')) {
00075 return false;
00076 }
00077 if ($status != self::STATUS_CANCELLED &&
00078 $status != self::STATUS_FAILURE &&
00079 $status != self::STATUS_PENDING &&
00080 $status != self::STATUS_RESERVED &&
00081 $status != self::STATUS_SUCCESS) {
00082 return false;
00083 }
00084 return true;
00085 }
00086
00087
00088
00089
00090
00091
00092 public function getStatus()
00093 {
00094 return $this->getData('Status');
00095 }
00096
00097
00098
00099
00100
00101
00102 public function getId()
00103 {
00104 return $this->getData('Id');
00105 }
00106
00107 }