Skip to content

Commit

Permalink
Merge pull request #45 from snappmarket/feture/add_return_cancel_amou…
Browse files Browse the repository at this point in the history
…nt_method

feature add return cancel amount method
  • Loading branch information
salehimehdi authored Sep 5, 2022
2 parents e924ee4 + 5b2ad4a commit 2174fcf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Treasury/Communicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use SnappMarket\Treasury\Dto\CancelSnappCreditReservationForOrderDto;
use SnappMarket\Treasury\Dto\OrderUpdateDto;
use SnappMarket\Treasury\Dto\PaymentInfoUpdateDto;
use SnappMarket\Treasury\Dto\ReturnCancelAmountToSnappCredit;
use SnappMarket\Treasury\Dto\StoreUserDebtDto;
use SnappMarket\Treasury\Dto\TransactionListDto;
use SnappMarket\Treasury\Dto\UpdateSnappCreditAmountForOrderDto;
Expand Down Expand Up @@ -395,6 +396,17 @@ public function getAlreadyRefundedAmountForOrder(GetAlreadyRefundedAmountForOrde
return false;
}

public function returnCancelAmountToSnappCredit(ReturnCancelAmountToSnappCredit $dto): bool
{
$uri = 'api/v1/orders/' . $dto->getOrderId() . '/return-cancel-amount-to-snappcredit';

$response = $this->request(static::METHOD_POST, $uri, [
'creator_id' => $dto->getCreatorId()
]);

return $response->getStatusCode() == 200;
}

public function storeUserDebt(StoreUserDebtDto $dto): bool
{
$uri = 'api/v1/orders/user-debt/payment/' . $dto->getPaymentId();
Expand Down
36 changes: 36 additions & 0 deletions src/Treasury/Dto/ReturnCancelAmountToSnappCredit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace SnappMarket\Treasury\Dto;

class ReturnCancelAmountToSnappCredit
{
/** @var int */
private $orderId;

/** @var int */
private $creatorId;

public function setOrderId(int $value)
{
$this->orderId = $value;

return $this;
}

public function getOrderId()
{
return $this->orderId;
}

public function setCreatorId(int $value)
{
$this->creatorId = $value;

return $this;
}

public function getCreatorId()
{
return $this->creatorId;
}
}

0 comments on commit 2174fcf

Please sign in to comment.