Pad last 4 card digits to a string of length 4, since we're storing it as an int

This commit is contained in:
Joshua Dwire 2016-05-10 19:17:55 -04:00
parent b8514436a9
commit 104264607b

View File

@ -71,6 +71,11 @@ class PaymentMethod extends EntityModel
return static::lookupBankData($this->routing_number); return static::lookupBankData($this->routing_number);
} }
public function getLast4Attribute($value)
{
return $value ? str_pad($value, 4, '0', STR_PAD_LEFT) : null;
}
public function scopeScope($query, $publicId = false, $accountId = false, $accountGatewayTokenId = false) public function scopeScope($query, $publicId = false, $accountId = false, $accountGatewayTokenId = false)
{ {
$query = parent::scopeScope($query, $publicId, $accountId); $query = parent::scopeScope($query, $publicId, $accountId);