mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-08 13:54:36 -04:00
Scaffold refunds
This commit is contained in:
parent
a6051330fc
commit
028f63a418
@ -95,7 +95,26 @@ class SquarePaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function refund(Payment $payment, $amount, $return_client_response = false)
|
public function refund(Payment $payment, $amount, $return_client_response = false)
|
||||||
{
|
{
|
||||||
//this is your custom implementation from here
|
$this->init();
|
||||||
|
|
||||||
|
$amount_money = new \Square\Models\Money();
|
||||||
|
$amount_money->setAmount($this->convertAmount($amount));
|
||||||
|
$amount_money->setCurrency($this->square_driver->client->currency()->code);
|
||||||
|
|
||||||
|
$body = new \Square\Models\RefundPaymentRequest(\Illuminate\Support\Str::random(32), $amount_money, $payment->transaction_reference);
|
||||||
|
|
||||||
|
/** @var ApiResponse */
|
||||||
|
$response = $this->square->getRefundsApi()->refund($body);
|
||||||
|
|
||||||
|
// if ($response->isSuccess()) {
|
||||||
|
// return [
|
||||||
|
// 'transaction_reference' => $refund->action_id,
|
||||||
|
// 'transaction_response' => json_encode($response),
|
||||||
|
// 'success' => $checkout_payment->status == 'Refunded',
|
||||||
|
// 'description' => $checkout_payment->status,
|
||||||
|
// 'code' => $checkout_payment->http_code,
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user