Commit 4acea5e9 authored by Mark Harding's avatar Mark Harding

(fix): whitespace issues

parent 9a5aee8b
No related merge requests found
Pipeline #81797954 failed with stages
in 4 minutes and 18 seconds
......@@ -20,17 +20,17 @@ class transactions implements Interfaces\Api
$connectManager = new Stripe\Connect\Manager();
try {
try {
$account = $connectManager->getByUser($user);
} catch (\Exception $e) {
return Factory::response([
'status' => 'error',
'message' => 'There was an error returning the usd account',
]);
}
}
$transactionsManger = new Stripe\Transactions\Manager();
$transactions = $transactionsManger->getByAccount($account);
$transactions = $transactionsManger->getByAccount($account);
return Factory::response([
'transactions' => Factory::exportable($transactions),
......@@ -49,7 +49,6 @@ class transactions implements Interfaces\Api
public function delete($pages)
{
return Factory::response([]);
return Factory::response([]);
}
}
......@@ -6,7 +6,7 @@ use Minds\Core\Config\Config;
use Minds\Core\Di\Di;
/**
* @method ChargeInstance retrieve()
* @method ChargeInstance retrieve()
*/
class ChargeInstance extends StaticToInstance
{
......@@ -17,4 +17,3 @@ class ChargeInstance extends StaticToInstance
$this->setClass(new \Stripe\Charge);
}
}
......@@ -6,7 +6,7 @@ use Minds\Core\Config\Config;
use Minds\Core\Di\Di;
/**
* @method TransferInstance all()
* @method TransferInstance all()
*/
class TransferInstance extends StaticToInstance
{
......@@ -17,4 +17,3 @@ class TransferInstance extends StaticToInstance
$this->setClass(new \Stripe\Transfer);
}
}
......@@ -12,36 +12,36 @@ class Manager
/** @var EntitiesBuilder $entitiesBuilder */
private $entitiesBuilder;
/** @var TransferInstance $transferInstance */
private $transferInstance;
/** @var TransferInstance $transferInstance */
private $transferInstance;
/** @var ChargeInstance $chargeInstance */
private $chargeInstance;
/** @var ChargeInstance $chargeInstance */
private $chargeInstance;
public function __construct($entitiesBuilder = null, $transferInstance = null, $chargeInstance = null)
public function __construct($entitiesBuilder = null, $transferInstance = null, $chargeInstance = null)
{
$this->entitiesBuilder = $entitiesBuilder ?? Di::_()->get('EntitiesBuilder');
$this->transferInstance = $transferInstance ?? new TransferInstance();
$this->chargeInstance = $chargeInstance ?? new ChargeInstance();
}
$this->transferInstance = $transferInstance ?? new TransferInstance();
$this->chargeInstance = $chargeInstance ?? new ChargeInstance();
}
/**
/**
* Return transactions from an account object
* @param Account $account
* @return Response[Transaction]
*/
public function getByAccount(Account $account): Response
{
$transfers = $this->transferInstance->all([ 'destination' => $account->getId() ]);
{
$transfers = $this->transferInstance->all([ 'destination' => $account->getId() ]);
$response = new Response();
$response = new Response();
foreach ($transfers->autoPagingIterator() as $transfer) {
try {
$payment = $this->chargeInstance->retrieve($transfer->source_transaction);
} catch (\Exception $e) {
continue;
$payment = $this->chargeInstance->retrieve($transfer->source_transaction);
} catch (\Exception $e) {
continue;
}
$transaction = new Transaction();
$transaction = new Transaction();
$transaction->setId($transfer->id)
->setTimestamp($transfer->created)
->setGross($payment->amount)
......@@ -50,10 +50,8 @@ class Manager
->setCurrency($transfer->currency)
->setCustomerUserGuid($payment->metadata['user_guid'])
->setCustomerUser($this->entitiesBuilder->single($payment->metadata['user_guid']));
$response[] = $transaction;
}
return $response;
}
$response[] = $transaction;
}
return $response;
}
}
......@@ -32,7 +32,7 @@ class Transaction
/** @var User $customerUser */
private $customerUser;
/**
/**
* Expose to the public apis
* @param array $extend
* @return array
......@@ -50,6 +50,4 @@ class Transaction
'customer_user' => $this->customerUser ? $this->customerUser->export() : null,
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment