| @@ 91-104 (lines=14) @@ | ||
| 88 | * @throws HttpException |
|
| 89 | * @throws ResponseException |
|
| 90 | */ |
|
| 91 | public function payout(string $orderId, string $cardId, int $amount, array $extra = []): Payment |
|
| 92 | { |
|
| 93 | $response = $this->init($orderId, $cardId, $amount, $extra); |
|
| 94 | if ($response->hasError() || 'CHECKED' !== $response->getStatus()) { |
|
| 95 | throw new ResponseException($response); |
|
| 96 | } |
|
| 97 | ||
| 98 | $response = $this->payment($response->getPaymentId()); |
|
| 99 | if ($response->hasError()) { |
|
| 100 | throw new ResponseException($response); |
|
| 101 | } |
|
| 102 | ||
| 103 | return $response; |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Make a new http request. |
|
| @@ 116-129 (lines=14) @@ | ||
| 113 | * @throws HttpException |
|
| 114 | * @throws ResponseException |
|
| 115 | */ |
|
| 116 | public function recurrent($rebillId, string $orderId, int $amount, array $extra = []): Charge |
|
| 117 | { |
|
| 118 | $response = $this->init($orderId, $amount, $extra); |
|
| 119 | if ($response->hasError()) { |
|
| 120 | throw new ResponseException($response); |
|
| 121 | } |
|
| 122 | ||
| 123 | $response = $this->charge($response->getPaymentId(), $rebillId); |
|
| 124 | if ($response->hasError()) { |
|
| 125 | throw new ResponseException($response); |
|
| 126 | } |
|
| 127 | ||
| 128 | return $response; |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * Send confirm request. |
|