Skip to content

Commit

Permalink
Refunds support
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystian Bajno committed Apr 9, 2019
1 parent f90f155 commit 02cff2a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/DotpayApi/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct($username, $password, $base_url)
/**
* @param IRequest $request
* @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function makeRequest(IRequest $request)
{
Expand Down
9 changes: 6 additions & 3 deletions src/DotpayApi/DotpayApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct($config)
/**
* @param $payment
* @return mixed|string
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function createPayment($payment)
{
Expand All @@ -51,10 +52,13 @@ public function createPayment($payment)

/**
* @param $payment
* @param $operation_number
* @return mixed
* @throws \Evilnet\Dotpay\Exceptions\RequestIntegrityException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function refundPayment($payment){
return $this->client->makeRequest(new CreateRefund($this->config['shop_id'], $payment));
public function refundPayment($operation_number, $payment){
return $this->client->makeRequest(new CreateRefund($operation_number, $payment));
}

/**
Expand Down Expand Up @@ -82,5 +86,4 @@ public function verifyCallback($data)
{
return $this->validator->verify($data);
}

}
1 change: 0 additions & 1 deletion src/DotpayApi/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,4 @@ public function getOperationStatus()
{
return $this->data['operation_status'];
}

}
1 change: 0 additions & 1 deletion src/DotpayApi/UrlCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ public function getPaymentUrlWithCHK($payment)
{
return $payment->payment_url.'&chk='.hash('sha256', ($this->pin.$payment->token));
}

}
1 change: 0 additions & 1 deletion src/DotpayApi/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ public function verify($data)

return $data['signature'] === $hash;
}

}
8 changes: 6 additions & 2 deletions src/DotpayManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@ public function __construct(DotpayApi $dotpayApi)
/**
* @param $data
* @return mixed|string
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function createPayment($data)
{
return $this->dotpayApi->createPayment($data);
}

/**
* @param $operation_number
* @param $data
* @return mixed
* @throws Exceptions\RequestIntegrityException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function refundPayment($data){
return $this->dotpayApi->refundPayment($data);
public function refundPayment($operation_number, $data){
return $this->dotpayApi->refundPayment($operation_number, $data);
}


Expand Down

0 comments on commit 02cff2a

Please sign in to comment.