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
49237198
Commit
49237198
authored
Jun 28, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send purchase source to customers API
Changelog: added EE: true
parent
3b143c7a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
28 additions
and
11 deletions
+28
-11
ee/app/assets/javascripts/subscriptions/new/store/getters.js
ee/app/assets/javascripts/subscriptions/new/store/getters.js
+1
-0
ee/app/assets/javascripts/subscriptions/new/store/state.js
ee/app/assets/javascripts/subscriptions/new/store/state.js
+2
-0
ee/app/controllers/subscriptions_controller.rb
ee/app/controllers/subscriptions_controller.rb
+1
-1
ee/app/helpers/subscriptions_helper.rb
ee/app/helpers/subscriptions_helper.rb
+2
-1
ee/app/services/subscriptions/create_service.rb
ee/app/services/subscriptions/create_service.rb
+2
-1
ee/spec/controllers/subscriptions_controller_spec.rb
ee/spec/controllers/subscriptions_controller_spec.rb
+4
-4
ee/spec/fixtures/create_service_params.json
ee/spec/fixtures/create_service_params.json
+2
-1
ee/spec/frontend/subscriptions/new/store/getters_spec.js
ee/spec/frontend/subscriptions/new/store/getters_spec.js
+2
-0
ee/spec/frontend/subscriptions/new/store/state_spec.js
ee/spec/frontend/subscriptions/new/store/state_spec.js
+5
-0
ee/spec/helpers/subscriptions_helper_spec.rb
ee/spec/helpers/subscriptions_helper_spec.rb
+2
-1
ee/spec/services/subscriptions/create_service_spec.rb
ee/spec/services/subscriptions/create_service_spec.rb
+2
-1
ee/spec/support/shared_examples/views/subscription_shared_examples.rb
...ort/shared_examples/views/subscription_shared_examples.rb
+3
-1
No files found.
ee/app/assets/javascripts/subscriptions/new/store/getters.js
View file @
49237198
...
...
@@ -26,6 +26,7 @@ export const confirmOrderParams = (state, getters) => ({
plan_id
:
state
.
selectedPlan
,
payment_method_id
:
state
.
paymentMethodId
,
quantity
:
state
.
numberOfUsers
,
source
:
state
.
source
,
},
});
...
...
ee/app/assets/javascripts/subscriptions/new/store/state.js
View file @
49237198
...
...
@@ -45,6 +45,7 @@ export default ({
fullName
,
newUser
,
groupData
=
'
[]
'
,
source
,
})
=>
{
const
availablePlans
=
parsePlanData
(
plansData
);
const
isNewUser
=
parseBoolean
(
newUser
);
...
...
@@ -76,5 +77,6 @@ export default ({
isConfirmingOrder
:
false
,
taxRate
:
TAX_RATE
,
startDate
:
new
Date
(
Date
.
now
()),
source
,
};
};
ee/app/controllers/subscriptions_controller.rb
View file @
49237198
...
...
@@ -79,7 +79,7 @@ class SubscriptionsController < ApplicationController
end
def
subscription_params
params
.
require
(
:subscription
).
permit
(
:plan_id
,
:payment_method_id
,
:quantity
)
params
.
require
(
:subscription
).
permit
(
:plan_id
,
:payment_method_id
,
:quantity
,
:source
)
end
def
find_group
...
...
ee/app/helpers/subscriptions_helper.rb
View file @
49237198
...
...
@@ -11,7 +11,8 @@ module SubscriptionsHelper
plan_id:
params
[
:plan_id
],
namespace_id:
params
[
:namespace_id
],
new_user:
new_user?
.
to_s
,
group_data:
present_groups
(
eligible_groups
).
to_json
group_data:
present_groups
(
eligible_groups
).
to_json
,
source:
params
[
:source
]
}
end
...
...
ee/app/services/subscriptions/create_service.rb
View file @
49237198
...
...
@@ -84,7 +84,8 @@ module Subscriptions
},
gl_namespace_id:
@group
.
id
,
gl_namespace_name:
@group
.
name
,
preview:
'false'
preview:
'false'
,
source:
subscription_params
[
:source
]
}
end
...
...
ee/spec/controllers/subscriptions_controller_spec.rb
View file @
49237198
...
...
@@ -177,7 +177,7 @@ RSpec.describe SubscriptionsController do
{
setup_for_company:
setup_for_company
,
customer:
{
company:
'My company'
,
country:
'NL'
},
subscription:
{
plan_id:
'x'
,
quantity:
2
}
subscription:
{
plan_id:
'x'
,
quantity:
2
,
source:
'some_source'
}
}
end
...
...
@@ -215,7 +215,7 @@ RSpec.describe SubscriptionsController do
{
setup_for_company:
setup_for_company
,
customer:
{
country:
'NL'
},
subscription:
{
plan_id:
'x'
,
quantity:
1
}
subscription:
{
plan_id:
'x'
,
quantity:
1
,
source:
'some_source'
}
}
end
...
...
@@ -282,7 +282,7 @@ RSpec.describe SubscriptionsController do
{
selected_group:
selected_group
.
id
,
customer:
{
country:
'NL'
},
subscription:
{
plan_id:
'x'
,
quantity:
1
}
subscription:
{
plan_id:
'x'
,
quantity:
1
,
source:
'another_source'
}
}
end
...
...
@@ -357,7 +357,7 @@ RSpec.describe SubscriptionsController do
{
selected_group:
non_existing_record_id
,
customer:
{
country:
'NL'
},
subscription:
{
plan_id:
'x'
,
quantity:
1
}
subscription:
{
plan_id:
'x'
,
quantity:
1
,
source:
'new_source'
}
}
end
...
...
ee/spec/fixtures/create_service_params.json
View file @
49237198
...
...
@@ -30,6 +30,7 @@
},
"gl_namespace_id"
:
222
,
"gl_namespace_name"
:
"Group name"
,
"preview"
:
"false"
"preview"
:
"false"
,
"source"
:
"some_source"
}
}
ee/spec/frontend/subscriptions/new/store/getters_spec.js
View file @
49237198
...
...
@@ -20,6 +20,7 @@ const state = {
organizationName
:
'
Organization name
'
,
paymentMethodId
:
'
Payment method ID
'
,
numberOfUsers
:
1
,
source
:
'
some_source
'
,
};
describe
(
'
Subscriptions Getters
'
,
()
=>
{
...
...
@@ -245,6 +246,7 @@ describe('Subscriptions Getters', () => {
plan_id
:
'
firstPlan
'
,
payment_method_id
:
'
Payment method ID
'
,
quantity
:
1
,
source
:
'
some_source
'
,
},
});
});
...
...
ee/spec/frontend/subscriptions/new/store/state_spec.js
View file @
49237198
...
...
@@ -22,6 +22,7 @@ describe('projectsSelector default state', () => {
setupForCompany
:
'
true
'
,
fullName
:
'
Full Name
'
,
newUser
:
'
true
'
,
source
:
'
some_source
'
,
};
const
currentDate
=
new
Date
(
'
2020-01-07T12:44:08.135Z
'
);
...
...
@@ -164,6 +165,10 @@ describe('projectsSelector default state', () => {
expect
(
state
.
startDate
).
toEqual
(
currentDate
);
});
it
(
'
sets the source to the initial value
'
,
()
=>
{
expect
(
state
.
source
).
toEqual
(
'
some_source
'
);
});
it
(
'
sets the paymentFormParams to an empty object
'
,
()
=>
{
expect
(
state
.
paymentFormParams
).
toEqual
({});
});
...
...
ee/spec/helpers/subscriptions_helper_spec.rb
View file @
49237198
...
...
@@ -37,7 +37,7 @@ RSpec.describe SubscriptionsHelper do
let_it_be
(
:group
)
{
create
(
:group
,
name:
'My Namespace'
)
}
before
do
allow
(
helper
).
to
receive
(
:params
).
and_return
(
plan_id:
'bronze_id'
,
namespace_id:
group
.
id
.
to_s
)
allow
(
helper
).
to
receive
(
:params
).
and_return
(
plan_id:
'bronze_id'
,
namespace_id:
group
.
id
.
to_s
,
source:
'some_source'
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
group
.
add_owner
(
user
)
group
.
add_guest
(
user2
)
...
...
@@ -50,6 +50,7 @@ RSpec.describe SubscriptionsHelper do
it
{
is_expected
.
to
include
(
available_plans:
'[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"name":"Bronze Plan"}]'
)
}
it
{
is_expected
.
to
include
(
plan_id:
'bronze_id'
)
}
it
{
is_expected
.
to
include
(
namespace_id:
group
.
id
.
to_s
)
}
it
{
is_expected
.
to
include
(
source:
'some_source'
)
}
it
{
is_expected
.
to
include
(
group_data:
%Q{[{"id":
#{
group
.
id
}
,"name":"My Namespace","users":2,"guests":1}]}
)
}
describe
'new_user'
do
...
...
ee/spec/services/subscriptions/create_service_spec.rb
View file @
49237198
...
...
@@ -25,7 +25,8 @@ RSpec.describe Subscriptions::CreateService do
{
plan_id:
'Plan ID'
,
payment_method_id:
'Payment method ID'
,
quantity:
123
quantity:
123
,
source:
'some_source'
}
end
...
...
ee/spec/support/shared_examples/views/subscription_shared_examples.rb
View file @
49237198
...
...
@@ -5,7 +5,8 @@ RSpec.shared_examples_for 'subscription form data' do |js_selector|
setup_for_company:
'true'
,
full_name:
'First Last'
,
plan_data:
'[{"id":"bronze_id","code":"bronze","price_per_year":48.0}]'
,
plan_id:
'bronze_id'
plan_id:
'bronze_id'
,
source:
'some_source'
)
end
...
...
@@ -15,4 +16,5 @@ RSpec.shared_examples_for 'subscription form data' do |js_selector|
it
{
is_expected
.
to
have_selector
(
"
#{
js_selector
}
[data-full-name='First Last']"
)
}
it
{
is_expected
.
to
have_selector
(
"
#{
js_selector
}
[data-plan-data='[{
\"
id
\"
:
\"
bronze_id
\"
,
\"
code
\"
:
\"
bronze
\"
,
\"
price_per_year
\"
:48.0}]']"
)
}
it
{
is_expected
.
to
have_selector
(
"
#{
js_selector
}
[data-plan-id='bronze_id']"
)
}
it
{
is_expected
.
to
have_selector
(
"
#{
js_selector
}
[data-source='some_source']"
)
}
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