Skip to content

Commit e4580db

Browse files
committed
new: description for txn type = ASSET_MOVEMENT
Ref: gboudreau/ws-api-python#28
1 parent a4d1ebf commit e4580db

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/WealthsimpleAPI.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function getActivities($account_id, int $how_many = 50, string $order_by
228228

229229
private function _activityAddDescription(&$act) {
230230
$act->description = "$act->type: $act->subType";
231-
if ($act->type === 'INTERNAL_TRANSFER') {
231+
if ($act->type === 'INTERNAL_TRANSFER' || $act->type === 'ASSET_MOVEMENT') {
232232
$accounts = $this->getAccounts(FALSE);
233233
$matching = array_filter($accounts, fn($acc) => $acc->id === $act->opposingAccountId);
234234
$target_account = array_pop($matching);
@@ -237,11 +237,8 @@ private function _activityAddDescription(&$act) {
237237
} else {
238238
$account_description = $act->opposingAccountId;
239239
}
240-
if ($act->subType === 'SOURCE') {
241-
$act->description = "Transfer out: Transfer to Wealthsimple $account_description";
242-
} else {
243-
$act->description = "Transfer in: Transfer from Wealthsimple $account_description";
244-
}
240+
$direction = $act->subType === 'SOURCE' ? 'to' : 'from';
241+
$act->description = "Money transfer: $direction Wealthsimple $account_description";
245242
} elseif ($act->type === 'DIY_BUY' || $act->type === 'DIY_SELL') {
246243
$verb = ucfirst(strtolower(str_replace('_', ' ', $act->subType)));
247244
$action = $act->type === 'DIY_BUY' ? 'buy' : 'sell';

0 commit comments

Comments
 (0)