Overview

Classes

  • Syspay_Merchant_AstroPayBanksRequest
  • Syspay_Merchant_BillingAgreementCancellationRequest
  • Syspay_Merchant_BillingAgreementInfoRequest
  • Syspay_Merchant_BillingAgreementListRequest
  • Syspay_Merchant_BillingAgreementRequest
  • Syspay_Merchant_ChargebackInfoRequest
  • Syspay_Merchant_ChargebackListRequest
  • Syspay_Merchant_Client
  • Syspay_Merchant_ConfirmRequest
  • Syspay_Merchant_EMS
  • Syspay_Merchant_Entity
  • Syspay_Merchant_Entity_AstroPayBank
  • Syspay_Merchant_Entity_BillingAgreement
  • Syspay_Merchant_Entity_Chargeback
  • Syspay_Merchant_Entity_Creditcard
  • Syspay_Merchant_Entity_Customer
  • Syspay_Merchant_Entity_Eterminal
  • Syspay_Merchant_Entity_Payment
  • Syspay_Merchant_Entity_PaymentMethod
  • Syspay_Merchant_Entity_PaymentRecipient
  • Syspay_Merchant_Entity_Plan
  • Syspay_Merchant_Entity_Refund
  • Syspay_Merchant_Entity_Subscription
  • Syspay_Merchant_Entity_SubscriptionEvent
  • Syspay_Merchant_EterminalRequest
  • Syspay_Merchant_IpAddressesRequest
  • Syspay_Merchant_PaymentInfoRequest
  • Syspay_Merchant_PaymentListRequest
  • Syspay_Merchant_PaymentRequest
  • Syspay_Merchant_PlanInfoRequest
  • Syspay_Merchant_PlanRequest
  • Syspay_Merchant_PlanUpdateRequest
  • Syspay_Merchant_RebillRequest
  • Syspay_Merchant_Redirect
  • Syspay_Merchant_RefundInfoRequest
  • Syspay_Merchant_RefundListRequest
  • Syspay_Merchant_RefundRequest
  • Syspay_Merchant_Request
  • Syspay_Merchant_SubscriptionCancellationRequest
  • Syspay_Merchant_SubscriptionInfoRequest
  • Syspay_Merchant_SubscriptionRebillRequest
  • Syspay_Merchant_SubscriptionRequest
  • Syspay_Merchant_Utils
  • Syspay_Merchant_VoidRequest

Interfaces

  • Syspay_Merchant_Entity_ReturnedEntityInterface

Exceptions

  • Syspay_Merchant_EMSException
  • Syspay_Merchant_RedirectException
  • Syspay_Merchant_RequestException
  • Syspay_Merchant_UnexpectedResponseException
  • Overview
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Process a refund
  5:  * @see  https://app.syspay.com/bundles/emiuser/doc/merchant_api.html#make-a-refund
  6:  */
  7: class Syspay_Merchant_RefundRequest extends Syspay_Merchant_Request
  8: {
  9:     const METHOD = 'POST';
 10:     const PATH   = '/api/v1/merchant/refund';
 11: 
 12:     /**
 13:      * @var integer
 14:      */
 15:     private $paymentId;
 16: 
 17:     /**
 18:      * @var Syspay_Merchant_Entity_Refund
 19:      */
 20:     private $refund;
 21: 
 22:     /**
 23:      * @var string
 24:      */
 25:     private $emsUrl;
 26: 
 27:     /**
 28:      * {@inheritDoc}
 29:      */
 30:     public function getMethod()
 31:     {
 32:         return self::METHOD;
 33:     }
 34: 
 35:     /**
 36:      * {@inheritDoc}
 37:      */
 38:     public function getPath()
 39:     {
 40:         return self::PATH;
 41:     }
 42: 
 43:     /**
 44:      * {@inheritDoc}
 45:      */
 46:     public function buildResponse(stdClass $response)
 47:     {
 48:         if (!isset($response->refund)) {
 49:             throw new Syspay_Merchant_UnexpectedResponseException(
 50:                 'Unable to retrieve "refund" data from response',
 51:                 $response
 52:             );
 53:         }
 54: 
 55:         $refund = Syspay_Merchant_Entity_Refund::buildFromResponse($response->refund);
 56: 
 57:         return $refund;
 58:     }
 59: 
 60:     /**
 61:      * {@inheritDoc}
 62:      */
 63:     public function getData()
 64:     {
 65:         $data = $this->refund->toArray();
 66:         $data['payment_id'] = $this->paymentId;
 67: 
 68:         if (false === empty($this->emsUrl)) {
 69:             $data['ems_url'] = $this->emsUrl;
 70:         }
 71: 
 72:         return $data;
 73:     }
 74: 
 75: 
 76:     /**
 77:      * Gets the value of paymentId.
 78:      *
 79:      * @return integer
 80:      */
 81:     public function getPaymentId()
 82:     {
 83:         return $this->paymentId;
 84:     }
 85: 
 86:     /**
 87:      * Sets the value of paymentId.
 88:      *
 89:      * @param integer $paymentId the paymentId
 90:      *
 91:      * @return self
 92:      */
 93:     public function setPaymentId($paymentId)
 94:     {
 95:         $this->paymentId = $paymentId;
 96: 
 97:         return $this;
 98:     }
 99: 
100:     /**
101:      * Gets the value of refund.
102:      *
103:      * @return Syspay_Merchant_Entity_Refund
104:      */
105:     public function getRefund()
106:     {
107:         return $this->refund;
108:     }
109: 
110:     /**
111:      * Sets the value of refund.
112:      *
113:      * @param Syspay_Merchant_Entity_Refund $refund the refund
114:      *
115:      * @return self
116:      */
117:     public function setRefund(Syspay_Merchant_Entity_Refund $refund)
118:     {
119:         $this->refund = $refund;
120: 
121:         return $this;
122:     }
123: 
124:     /**
125:      * Gets the value of emsUrl.
126:      *
127:      * @return string
128:      */
129:     public function getEmsUrl()
130:     {
131:         return $this->emsUrl;
132:     }
133: 
134:     /**
135:      * Sets the value of emsUrl.
136:      *
137:      * @param string $emsUrl the emsUrl
138:      *
139:      * @return self
140:      */
141:     public function setEmsUrl($emsUrl)
142:     {
143:         $this->emsUrl = $emsUrl;
144: 
145:         return $this;
146:     }
147: }
148: 
Syspay Merchant SDK API documentation generated by ApiGen 2.8.0