From b8514436a9a2df1406b25e41b5e0df1c7b4568cc Mon Sep 17 00:00:00 2001 From: Joshua Dwire Date: Tue, 10 May 2016 19:17:41 -0400 Subject: [PATCH] Pad last 4 card digits to a string of length 4, since we're storing it as an int --- app/Models/Payment.php | 5 +++++ resources/views/payments/paymentmethods_list.blade.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Models/Payment.php b/app/Models/Payment.php index b0001569dc..9171c9d22c 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -174,6 +174,11 @@ class Payment extends EntityModel } return PaymentMethod::lookupBankData($this->routing_number); } + + public function getLast4Attribute($value) + { + return $value ? str_pad($value, 4, '0', STR_PAD_LEFT) : null; + } } Payment::creating(function ($payment) { diff --git a/resources/views/payments/paymentmethods_list.blade.php b/resources/views/payments/paymentmethods_list.blade.php index 1522f2ac0a..78b2653236 100644 --- a/resources/views/payments/paymentmethods_list.blade.php +++ b/resources/views/payments/paymentmethods_list.blade.php @@ -67,9 +67,9 @@ @elseif($paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFICATION_FAILED) ({{trans('texts.verification_failed')}}) @endif - @elseif($paymentMethod->type_id == PAYMENT_TYPE_ID_PAYPAL) + @elseif($paymentMethod->payment_type_id == PAYMENT_TYPE_ID_PAYPAL) {{ $paymentMethod->email }} - @else + @elseif($paymentMethod->expiration) {!! trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($paymentMethod->expiration, false)->format('m/y'))) !!} @endif @if($paymentMethod->id == $paymentMethod->account_gateway_token->default_payment_method_id)