Commit 31fdb7fc authored by Mark Harding's avatar Mark Harding

(fix): email issues with wire, and other patches

1 merge request!254WIP: &37 - Multi-currency
Pipeline #78660744 failed with stages
in 7 minutes and 26 seconds
......@@ -74,7 +74,7 @@ class usd implements Interfaces\Api
$response = array();
switch ($pages[0]) {
case "onboard":
case "onboarding":
$account = (new Payments\Stripe\Connect\Account())
->setUserGuid(Core\Session::getLoggedInUser()->guid)
->setUser(Core\Session::getLoggedInUser())
......@@ -95,7 +95,8 @@ class usd implements Interfaces\Api
try {
$stripeConnectManager = Core\Di\Di::_()->get('Stripe\Connect\Manager');
$id = $stripeConnectManager->add($account);
$account = $stripeConnectManager->add($account);
$response['account'] = $account->export();
} catch (\Exception $e) {
$response['status'] = "error";
......
......@@ -2,7 +2,7 @@
$wireUrl = "{$vars['site_url']}wallet/tokens/transactions/{$vars['contract']}?{$vars['tracking']}";
$avatarUrl = "{$vars['sender']->getIconUrl()}";
$wireDate = date('M d, Y', ($vars['timestamp']));
$amount = number_format($vars['amount'], 2);
$amount = $vars['amount'];
?>
<table cellspacing="8" cellpadding="8" border="0" width="600" align="center">
<tbody>
......
......@@ -2,7 +2,7 @@
$wireUrl = "{$vars['site_url']}wallet/tokens/transactions/{$vars['contract']}?{$vars['tracking']}";
$avatarUrl = "{$vars['receiver']->getIconUrl()}";
$wireDate = date('M d, Y', ($vars['timestamp']));
$amount = number_format($vars['amount'], 2);
$amount = $vars['amount'];
?>
<table cellspacing="8" cellpadding="8" border="0" width="600" align="center">
<tbody>
......
......@@ -69,7 +69,7 @@ class WireReceived extends EmailCampaign
public function send()
{
if ($this->canSend()) {
$this->mailer->queue($this->build());
$this->mailer->send($this->build());
}
}
......
......@@ -40,7 +40,6 @@ class WireSent extends EmailCampaign
];
$timestamp = gettype($this->wire->getTimestamp()) === 'object' ? $this->wire->getTimestamp()->time() : $this->wire->getTimestamp();
$amount = $this->wire->getMethod() === 'tokens' ? BigNumber::fromPlain($this->wire->getAmount(), 18)->toDouble() : $this->wire->getAmount();
$contract = $this->wire->getMethod() === 'onchain' ? 'wire' : 'offchain:wire';
......@@ -72,11 +71,9 @@ class WireSent extends EmailCampaign
public function send()
{
if ($this->canSend()) {
$this->mailer->queue($this->build());
$this->mailer->send($this->build());
}
}
<<<<<<< HEAD
=======
private function getAmountString($wire)
{
......@@ -94,5 +91,4 @@ class WireSent extends EmailCampaign
return "$amount $currency";
}
>>>>>>> d85a52e... (feat): wire emails support multiple currencies
}
......@@ -33,10 +33,10 @@ class Manager
/**
* Add a conenct account to stripe
* @param Account $account
* @return string
* @return Account
*/
public function add(Account $account): string
{
public function add(Account $account) : Account
{
$dob = explode('-', $account->getDateOfBirth());
$data = [
'managed' => true,
......@@ -89,14 +89,14 @@ class Manager
throw new \Exception($result->message);
}
$id = $result->id;
$account->setId($result->id);
// Save reference directly to user entity
$user = $account->getUser();
$user->setMerchant([
'service' => 'stripe',
'id' => $id
'id' => $result->id,
]);
$this->save->setEntity($user)
......@@ -106,7 +106,7 @@ class Manager
$this->notificationDelegate->onAccepted($account);
return $id;
return $account;
}
/**
......@@ -269,7 +269,7 @@ class Manager
// Delete id from user entity
$user = $account->getUser();
$user->setMerchant([]);
$user->setMerchant([ 'deleted' => true ]);
$this->save->setEntity($user)
->save();
......
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