| @@ 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. |
|
| @@ 99-112 (lines=14) @@ | ||
| 96 | * @throws HttpException |
|
| 97 | * @throws ResponseException |
|
| 98 | */ |
|
| 99 | public function payout(string $orderId, string $cardId, int $amount, array $extra = []): Payment |
|
| 100 | { |
|
| 101 | $response = $this->init($orderId, $cardId, $amount, $extra); |
|
| 102 | if ($response->hasError() || 'CHECKED' !== $response->getStatus()) { |
|
| 103 | throw new ResponseException($response); |
|
| 104 | } |
|
| 105 | ||
| 106 | $response = $this->payment($response->getPaymentId()); |
|
| 107 | if ($response->hasError()) { |
|
| 108 | throw new ResponseException($response); |
|
| 109 | } |
|
| 110 | ||
| 111 | return $response; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Make a new http request. |
|