-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
New columns to sp_return_logs #10510
Conversation
changelog: Internal, Reporting,add new columns to spreturnlogs
create( | ||
:profile, :active, :verified, user: current_user, | ||
initiating_service_provider: current_sp | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personal style, I would line up all the args
create( | |
:profile, :active, :verified, user: current_user, | |
initiating_service_provider: current_sp | |
) | |
create( | |
:profile, | |
:active, | |
:verified, | |
user: current_user, | |
initiating_service_provider: current_sp, | |
) |
# Do session_started_at and profile_verified_at need to be different, is there some relationship | ||
# to be account for in tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
profile_verified_at
is when the user finished IDV.
session_started_at
is for the current start of this particular session, which may have no IDV
profile_id: current_user&.active_profile&.id, | ||
profile_verified_at: current_user&.active_profile&.verified_at, | ||
profile_requested_issuer: current_user&.active_profile&.initiating_service_provider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, current_user
should always be present, so there should be no need for the &
directly after it.
Second, we are not always returning profile attributes to partners, maybe we could only check for active_profile
if ial > 1
?
profile_id: current_user&.active_profile&.id, | |
profile_verified_at: current_user&.active_profile&.verified_at, | |
profile_requested_issuer: current_user&.active_profile&.initiating_service_provider, | |
profile_id: current_user.active_profile&.id, | |
profile_verified_at: current_user.active_profile&.verified_at, | |
profile_requested_issuer: current_user.active_profile&.initiating_service_provider, |
changelog: Internal, Reporting,add new columns to spreturnlogs
user_session[session_has_been_billed_flag_key] == true | ||
user_session[session_has_been_billed_flag_key] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we change this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes needed on this.Reverting this change.
it 'does not fail if SpReturnLog row already exists' do | ||
let(:ial_context) { IalContext.new(ial: 2, service_provider: current_sp) } | ||
it 'does not fail if SpReturnLog row already exists and ial 2' do | ||
# binding.pry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this
# binding.pry |
SpReturnLog.create( | ||
request_id: request_id, | ||
user_id: current_user.id, | ||
billable: true, | ||
ial: ial_context.ial, | ||
issuer: current_sp.issuer, | ||
requested_at: session_started_at, | ||
returned_at: Time.zone.now, | ||
profile_id: active_profile.id, | ||
profile_verified_at: active_profile.verified_at, | ||
profile_requested_issuer: active_profile.initiating_service_provider.issuer, | ||
) | ||
|
||
expect do | ||
instance.track_billing_events | ||
end.to_not(change { SpReturnLog.count }.from(1)) | ||
sp_return_log = SpReturnLog.last | ||
expect(sp_return_log.profile_id).to eq active_profile.id | ||
expect(sp_return_log.profile_verified_at).to eq active_profile.verified_at | ||
expect(sp_return_log.profile_requested_issuer). | ||
to eq active_profile.initiating_service_provider.issuer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
let's add a spec that shows the new attributes (
profile_id
,profile_verified_at
,profile_requested_issuer
) being added? this spec seems to only show that they do not change right? -
let's save the assignment to make it clearer we're referencing the same row
SpReturnLog.create( | |
request_id: request_id, | |
user_id: current_user.id, | |
billable: true, | |
ial: ial_context.ial, | |
issuer: current_sp.issuer, | |
requested_at: session_started_at, | |
returned_at: Time.zone.now, | |
profile_id: active_profile.id, | |
profile_verified_at: active_profile.verified_at, | |
profile_requested_issuer: active_profile.initiating_service_provider.issuer, | |
) | |
expect do | |
instance.track_billing_events | |
end.to_not(change { SpReturnLog.count }.from(1)) | |
sp_return_log = SpReturnLog.last | |
expect(sp_return_log.profile_id).to eq active_profile.id | |
expect(sp_return_log.profile_verified_at).to eq active_profile.verified_at | |
expect(sp_return_log.profile_requested_issuer). | |
to eq active_profile.initiating_service_provider.issuer | |
sp_return_log = SpReturnLog.create( | |
request_id: request_id, | |
user_id: current_user.id, | |
billable: true, | |
ial: ial_context.ial, | |
issuer: current_sp.issuer, | |
requested_at: session_started_at, | |
returned_at: Time.zone.now, | |
profile_id: active_profile.id, | |
profile_verified_at: active_profile.verified_at, | |
profile_requested_issuer: active_profile.initiating_service_provider.issuer, | |
) | |
expect do | |
instance.track_billing_events | |
end.to_not(change { SpReturnLog.count }.from(1)) | |
sp_return_log.reload | |
expect(sp_return_log.profile_id).to eq active_profile.id | |
expect(sp_return_log.profile_verified_at).to eq active_profile.verified_at | |
expect(sp_return_log.profile_requested_issuer). | |
to eq active_profile.initiating_service_provider.issuer |
let(:active_profile) do | ||
create( | ||
:profile, | ||
:active, | ||
:verified, | ||
user: current_user, | ||
initiating_service_provider: current_sp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's link this to a different service provider (this helps us make sure if we ever added a bug that mixed up SPs, that we'd still catch it
let(:active_profile) do | |
create( | |
:profile, | |
:active, | |
:verified, | |
user: current_user, | |
initiating_service_provider: current_sp, | |
let(:profile_sp) { create(:service_provider) } | |
let(:active_profile) do | |
create( | |
:profile, | |
:active, | |
:verified, | |
user: current_user, | |
initiating_service_provider: profile_sp, |
changelog: Internal, Reporting,add new columns to spreturnlogs
expect(sp_return_log.respond_to?(:profile_id)).to be true | ||
expect(sp_return_log.respond_to?(:profile_verified_at)).to be true | ||
expect(sp_return_log.respond_to?(:profile_requested_issuer)).to be true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these assertions are basically checking if the migrations ran, I think we should check the values inside the columns to make sure they're what we expect.
For context, these values are what we're going to generate billing reports later on from, so we want to make sure they are correct
These are the assertions from later in the file
expect(sp_return_log.respond_to?(:profile_id)).to be true | |
expect(sp_return_log.respond_to?(:profile_verified_at)).to be true | |
expect(sp_return_log.respond_to?(:profile_requested_issuer)).to be true | |
expect(sp_return_log.profile_id).to eq active_profile.profile_id | |
expect(sp_return_log.profile_verified_at).to eq active_profile.verified_at | |
expect(sp_return_log.profile_requested_issuer). | |
to eq active_profile.profile_requested_issuer |
馃帿 Ticket
Link to the relevant ticket:
LG-13011
馃洜 Summary of changes
Three new columns been added to sp_return_logs for billing report
馃摐 Testing Plan
Provide a checklist of steps to confirm the changes.