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 @@
%strong
= credit_card_validation.credit_card_validated_at.to_s(:medium)
- if credit_card_validation.holder_name
- if credit_card_validation&.holder_name
%li
%span.light= _('Holder name:')
%strong
= 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
%span.light= _('Card number:')
%strong
= credit_card_validation.last_digits.to_s.rjust(4, '0')
- if credit_card_validation.expiration_date
- if credit_card_validation&.expiration_date
%li
%span.light= _('Expiration date:')
%strong
......
......@@ -19,6 +19,7 @@
%thead
%th= _('ID')
%th= _('User')
%th= _('Card holder name')
%th.gl-text-right= _('Validated at')
%th.gl-text-right= _('User created at')
%th.gl-text-right= _('Current sign-in ip')
......@@ -31,7 +32,9 @@
%td
= link_to(user.username, admin_user_path(user))
- if user == @user
= _('(target)')
= _('(this user)')
%td
= credit_card_validation.holder_name
%td.gl-text-right
= validated_at.to_s(:medium)
\/
......@@ -41,7 +44,7 @@
- if 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'
* All times are in UTC unless specified
= _('* All times are in UTC unless specified')
= paginate @similar_credit_card_validations, theme: 'gitlab'
.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 ""
msgid "(revoked)"
msgstr ""
msgid "(target)"
msgid "(this user)"
msgstr ""
msgid "(we need your current password to confirm your changes)"
msgstr ""
msgid "* All times are in UTC unless specified"
msgstr ""
msgid "+ %{amount} more"
msgstr ""
......@@ -6331,6 +6334,9 @@ msgstr ""
msgid "Capacity threshold"
msgstr ""
msgid "Card holder name"
msgstr ""
msgid "Card number:"
msgstr ""
......@@ -22563,6 +22569,9 @@ msgstr ""
msgid "Network"
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}"
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