1 | <?php |
||
12 | class Refund extends MoipResource |
||
13 | { |
||
14 | /** |
||
15 | * @const string |
||
16 | */ |
||
17 | const PATH = 'refunds'; |
||
18 | |||
19 | /** |
||
20 | * Refunds means. |
||
21 | * |
||
22 | * @const string |
||
23 | */ |
||
24 | const METHOD_CREDIT_CARD = 'CREDIT_CARD'; |
||
25 | |||
26 | /** |
||
27 | * Refunds means. |
||
28 | * |
||
29 | * @const string |
||
30 | */ |
||
31 | const METHOD_BANK_ACCOUNT = 'BANK_ACCOUNT'; |
||
32 | |||
33 | /** |
||
34 | * Refunds means. |
||
35 | * |
||
36 | * @const string |
||
37 | */ |
||
38 | const METHOD_MONEY_ORDER = 'MONEY_ORDER'; |
||
39 | |||
40 | /** |
||
41 | * @var \Moip\Resource\Orders |
||
42 | */ |
||
43 | private $order; |
||
44 | |||
45 | /** |
||
46 | * @var \Moip\Resource\Payment |
||
47 | */ |
||
48 | private $payment; |
||
49 | |||
50 | /** |
||
51 | * Initializes new instances. |
||
52 | */ |
||
53 | public function initialize() |
||
57 | |||
58 | /** |
||
59 | * Mount refund structure. |
||
60 | * |
||
61 | * @param \stdClass $response |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | protected function populate(stdClass $response) |
||
105 | |||
106 | /** |
||
107 | * Get id MoIP refund. |
||
108 | * |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getId() |
||
116 | |||
117 | /** |
||
118 | * Create a new refund in api MoIP. |
||
119 | * |
||
120 | * @param stdClass $data |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | private function execute(stdClass $data = null) |
||
131 | |||
132 | /** |
||
133 | * Checks path that will be the request. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | private function getPath() |
||
145 | |||
146 | /** |
||
147 | * Bank account is the bank address of a particular vendor or a customer. |
||
148 | * |
||
149 | * @param string $type Kind of refund. possible values: FULL, PARTIAL. |
||
150 | * @param string $bankNumber Bank number. possible values: 001, 237, 341, 041. |
||
151 | * @param int $agencyNumber Branch number. |
||
152 | * @param int $agencyCheckNumber Checksum of the agency. |
||
153 | * @param int $accountNumber Account number. |
||
154 | * @param int $accountCheckNumber Digit account checker. |
||
155 | * @param \Moip\Resource\Customer $holder |
||
156 | * |
||
157 | * @return \stdClass |
||
158 | */ |
||
159 | private function bankAccount($type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder) |
||
178 | |||
179 | /** |
||
180 | * Making a full refund to the bank account. |
||
181 | * |
||
182 | * @param string $type Kind of refund. possible values: FULL, PARTIAL. |
||
183 | * @param string $bankNumber Bank number. possible values: 001, 237, 341, 041. |
||
184 | * @param int $agencyNumber Branch number. |
||
185 | * @param int $agencyCheckNumber Checksum of the agency. |
||
186 | * @param int $accountNumber Account number. |
||
187 | * @param int $accountCheckNumber Digit account checker. |
||
188 | * @param \Moip\Resource\Customer $holder |
||
189 | * |
||
190 | * @return Refund |
||
191 | */ |
||
192 | public function bankAccountFull($type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder) |
||
198 | |||
199 | /** |
||
200 | * Making a partial refund in the bank account. |
||
201 | * |
||
202 | * @param string $type Kind of refund. possible values: FULL, PARTIAL. |
||
203 | * @param string $bankNumber Bank number. possible values: 001, 237, 341, 041. |
||
204 | * @param int $agencyNumber Branch number. |
||
205 | * @param int $agencyCheckNumber Checksum of the agency. |
||
206 | * @param int $accountNumber Account number. |
||
207 | * @param int $accountCheckNumber Digit account checker. |
||
208 | * @param \Moip\Resource\Customer $holder |
||
209 | * |
||
210 | * @return Refund |
||
211 | */ |
||
212 | public function bankAccountPartial($amount, $type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder) |
||
219 | |||
220 | /** |
||
221 | * Making a full refund in credit card. |
||
222 | * |
||
223 | * @return \Moip\Resource\Refund |
||
224 | */ |
||
225 | public function creditCardFull() |
||
229 | |||
230 | /** |
||
231 | * Making a partial refund in credit card. |
||
232 | * |
||
233 | * @param int|float $amount value of refund. |
||
234 | * |
||
235 | * @return \Moip\Resource\Refund |
||
236 | */ |
||
237 | public function creditCardPartial($amount) |
||
244 | |||
245 | /** |
||
246 | * Get iterator. |
||
247 | * |
||
248 | * @return \ArrayIterator |
||
249 | */ |
||
250 | public function getIterator() |
||
260 | |||
261 | /** |
||
262 | * Set order. |
||
263 | * |
||
264 | * @param \Moip\Resource\Orders $order |
||
265 | */ |
||
266 | public function setOrder(Orders $order) |
||
270 | |||
271 | /** |
||
272 | * Set payment. |
||
273 | * |
||
274 | * @param \Moip\Resource\Payment $payment |
||
275 | */ |
||
276 | public function setPayment(Payment $payment) |
||
280 | } |
||
281 |