Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b734b4f2
Commit
b734b4f2
authored
May 06, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add payment form URL
parent
b59a8cc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
lib/gitlab/subscription_portal.rb
lib/gitlab/subscription_portal.rb
+5
-0
spec/lib/gitlab/subscription_portal_spec.rb
spec/lib/gitlab/subscription_portal_spec.rb
+37
-0
No files found.
lib/gitlab/subscription_portal.rb
View file @
b734b4f2
...
...
@@ -9,8 +9,13 @@ module Gitlab
def
self
.
subscriptions_url
ENV
.
fetch
(
'CUSTOMER_PORTAL_URL'
,
default_subscriptions_url
)
end
def
self
.
payment_form_url
"
#{
self
.
subscriptions_url
}
/payment_forms/cc_validation"
end
end
end
Gitlab
::
SubscriptionPortal
.
prepend_mod
Gitlab
::
SubscriptionPortal
::
SUBSCRIPTIONS_URL
=
Gitlab
::
SubscriptionPortal
.
subscriptions_url
.
freeze
Gitlab
::
SubscriptionPortal
::
PAYMENT_FORM_URL
=
Gitlab
::
SubscriptionPortal
.
payment_form_url
.
freeze
spec/lib/gitlab/subscription_portal_spec.rb
View file @
b734b4f2
...
...
@@ -40,5 +40,42 @@ RSpec.describe ::Gitlab::SubscriptionPortal do
end
end
end
describe
'.payment_form_url'
do
subject
{
described_class
.
payment_form_url
}
context
'on non test and non dev environments'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
it
'returns URL to production payment form'
do
is_expected
.
to
eq
(
'https://customers.gitlab.com/payment_forms/cc_validation'
)
end
end
context
'on dev environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
true
)
end
it
'returns URL to staging payment form'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
)
end
end
context
'on test environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
true
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
it
'returns URL to staging payment form'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment