Commit a9d489ca authored by Mark Chao's avatar Mark Chao

Admin: card match can have different holder name

List all card holder name in the table since they can be different.

Changelog: changed
EE: true
parent 3ebd5476
...@@ -17,19 +17,25 @@ ...@@ -17,19 +17,25 @@
%strong %strong
= credit_card_validation.credit_card_validated_at.to_s(:medium) = credit_card_validation.credit_card_validated_at.to_s(:medium)
- if credit_card_validation.holder_name - if credit_card_validation&.holder_name
%li %li
%span.light= _('Holder name:') %span.light= _('Holder name:')
%strong %strong
= credit_card_validation.holder_name = credit_card_validation.holder_name
- if credit_card_validation.last_digits - if credit_card_validation&.network
%li
%span.light= _('Network:')
%strong
= credit_card_validation.network.camelcase
- if credit_card_validation&.last_digits
%li %li
%span.light= _('Card number:') %span.light= _('Card number:')
%strong %strong
= credit_card_validation.last_digits.to_s.rjust(4, '0') = credit_card_validation.last_digits.to_s.rjust(4, '0')
- if credit_card_validation.expiration_date - if credit_card_validation&.expiration_date
%li %li
%span.light= _('Expiration date:') %span.light= _('Expiration date:')
%strong %strong
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
%thead %thead
%th= _('ID') %th= _('ID')
%th= _('User') %th= _('User')
%th= _('Card holder name')
%th.gl-text-right= _('Validated at') %th.gl-text-right= _('Validated at')
%th.gl-text-right= _('User created at') %th.gl-text-right= _('User created at')
%th.gl-text-right= _('Current sign-in ip') %th.gl-text-right= _('Current sign-in ip')
...@@ -31,7 +32,9 @@ ...@@ -31,7 +32,9 @@
%td %td
= link_to(user.username, admin_user_path(user)) = link_to(user.username, admin_user_path(user))
- if user == @user - if user == @user
= _('(target)') = _('(this user)')
%td
= credit_card_validation.holder_name
%td.gl-text-right %td.gl-text-right
= validated_at.to_s(:medium) = validated_at.to_s(:medium)
\/ \/
...@@ -41,7 +44,7 @@ ...@@ -41,7 +44,7 @@
- if user.current_sign_in_ip - if user.current_sign_in_ip
= user.current_sign_in_ip = user.current_sign_in_ip
= link_to sprite_icon('earth'), "https://api.hostip.info/country.php?ip=#{user.current_sign_in_ip}", target: '_blank', rel: 'noreferrer' = link_to sprite_icon('earth'), "https://api.hostip.info/country.php?ip=#{user.current_sign_in_ip}", target: '_blank', rel: 'noreferrer'
* All times are in UTC unless specified = _('* All times are in UTC unless specified')
= paginate @similar_credit_card_validations, theme: 'gitlab' = paginate @similar_credit_card_validations, theme: 'gitlab'
.gl-float-right .gl-float-right
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/users/_credit_card_info.html.haml', :saas do
include ApplicationHelper
let_it_be(:user, reload: true) { create(:user) }
def render
super(
partial: 'admin/users/credit_card_info.html.haml',
locals: { user: user }
)
end
it 'shows not validated' do
render
expect(rendered).to match /\bNo\b/
expect(rendered.scan(/<li\b/m).size).to eq(1)
end
context 'when user is validated' do
let!(:credit_card_validation) do
create(
:credit_card_validation,
user: user,
network: 'AmericanExpress',
last_digits: 2
)
end
it 'shows card data' do
render
expect(rendered.scan(/<li\b/m).size).to eq(5)
expect(rendered).to match /\b0002\b/
expect(rendered).to match /\bAmericanExpress\b/
expect(rendered).to include(credit_card_validation.holder_name)
expect(rendered).not_to match /\bNo\b/
end
context 'when network is missing' do
let!(:credit_card_validation) do
create(:credit_card_validation, user: user, network: nil)
end
it 'does not show network' do
render
expect(rendered).not_to match /\bAmericanExpress\b/
expect(rendered.scan(/<li\b/m).size).to eq(4)
end
end
end
end
...@@ -1128,12 +1128,15 @@ msgstr "" ...@@ -1128,12 +1128,15 @@ msgstr ""
msgid "(revoked)" msgid "(revoked)"
msgstr "" msgstr ""
msgid "(target)" msgid "(this user)"
msgstr "" msgstr ""
msgid "(we need your current password to confirm your changes)" msgid "(we need your current password to confirm your changes)"
msgstr "" msgstr ""
msgid "* All times are in UTC unless specified"
msgstr ""
msgid "+ %{amount} more" msgid "+ %{amount} more"
msgstr "" msgstr ""
...@@ -6331,6 +6334,9 @@ msgstr "" ...@@ -6331,6 +6334,9 @@ msgstr ""
msgid "Capacity threshold" msgid "Capacity threshold"
msgstr "" msgstr ""
msgid "Card holder name"
msgstr ""
msgid "Card number:" msgid "Card number:"
msgstr "" msgstr ""
...@@ -22563,6 +22569,9 @@ msgstr "" ...@@ -22563,6 +22569,9 @@ msgstr ""
msgid "Network" msgid "Network"
msgstr "" msgstr ""
msgid "Network:"
msgstr ""
msgid "NetworkPolicies|%{ifLabelStart}if%{ifLabelEnd} %{ruleType} %{isLabelStart}is%{isLabelEnd} %{ruleDirection} %{ruleSelector} %{directionLabelStart}and is inbound from a%{directionLabelEnd} %{rule} %{portsLabelStart}on%{portsLabelEnd} %{ports}" msgid "NetworkPolicies|%{ifLabelStart}if%{ifLabelEnd} %{ruleType} %{isLabelStart}is%{isLabelEnd} %{ruleDirection} %{ruleSelector} %{directionLabelStart}and is inbound from a%{directionLabelEnd} %{rule} %{portsLabelStart}on%{portsLabelEnd} %{ports}"
msgstr "" msgstr ""
......
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