Skip to content

Commit

Permalink
Revert "removing term check to fix month end nightly events"
Browse files Browse the repository at this point in the history
This reverts commit 7e7d23d.
  • Loading branch information
nisanthyaganti9 committed Jun 26, 2024
1 parent 7e7d23d commit 420b336
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion app/models/external_events/enrollment_event_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def drop_if_already_processed!
:enrollment_action_uri => enrollment_action
)
if found_event.any?
if is_reterm_with_earlier_date?
if is_eligible_term?
false
else
response_with_publisher do |result_publisher|
Expand Down Expand Up @@ -295,6 +295,15 @@ def is_reterm_with_earlier_date? # terminating policy again with earlier termina
(existing_policy.present? && existing_policy.terminated? && existing_policy.policy_end > extract_enrollee_end(subscriber))
end

def is_eligible_term?
return false unless is_termination?
return false unless extract_enrollee_end(subscriber).present?
return false if existing_policy.blank?
return true unless existing_policy.terminated?

existing_policy.terminated? && existing_policy.policy_end > extract_enrollee_end(subscriber)
end

def enrollment_action
@enrollment_action ||= extract_enrollment_action(enrollment_event_xml)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
allow(subject).to receive(:is_termination?).and_return(true)
allow(subject).to receive(:hbx_enrollment_id).and_return(hbx_enrollment_id)
allow(subject).to receive(:enrollment_action).and_return("urn:openhbx:terms:v1:enrollment#terminate_enrollment")
allow(subject).to receive(:is_reterm_with_earlier_date?).and_return(true)
allow(subject).to receive(:is_eligible_term?).and_return(true)
end

it "returns false" do
Expand All @@ -744,7 +744,7 @@
allow(subject).to receive('response_with_publisher').and_yield(result_publisher)
allow(subject).to receive(:hbx_enrollment_id).and_return(hbx_enrollment_id)
allow(subject).to receive(:enrollment_action).and_return("urn:openhbx:terms:v1:enrollment#terminate_enrollment")
allow(subject).to receive(:is_reterm_with_earlier_date?).and_return(false)
allow(subject).to receive(:is_eligible_term?).and_return(false)
end

it "returns notify event already processed" do
Expand Down

0 comments on commit 420b336

Please sign in to comment.