Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breaking GQL changes #1826

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ fragment ContractFragment on Contract {
masterInceptionDate
terminationDate
exposureDisplayName
supportsAddressChange
upcomingRenewal {
renewalDate
}
supportsMoving
currentAgreement {
...AgreementFragment
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ query GetUpcomingRenewalReminder {
displayName
}
}
upcomingRenewal {
renewalDate
draftCertificateUrl
upcomingChangedAgreement {
activeFrom
certificateUrl
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mutation MemberDeviceRegister($token: String!) {
memberDeviceRegister(input: {type: "ANDROID", token: $token})
memberDeviceRegister(input: {platform: ANDROID, token: $token})
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private fun ContractFragment.toContract(isTerminated: Boolean = false): Insuranc
displayName = currentAgreement.productVariant.displayName,
exposureDisplayName = exposureDisplayName,
inceptionDate = masterInceptionDate,
renewalDate = upcomingRenewal.renewalDate,
renewalDate = upcomingChangedAgreement?.activeFrom,
terminationDate = terminationDate,
currentAgreement = Agreement(
activeFrom = currentAgreement.activeFrom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ internal class GetUpcomingRenewalRemindersUseCaseImpl(
.activeContracts

val upcomingRenewals: NonEmptyList<UpcomingRenewal>? = contracts
.map { contract ->
.mapNotNull { contract ->
val upcomingChangedAgreement = contract.upcomingChangedAgreement ?: return@mapNotNull null
UpcomingRenewal(
contract.currentAgreement.productVariant.displayName,
contract.upcomingRenewal.renewalDate,
contract.upcomingRenewal.draftCertificateUrl,
upcomingChangedAgreement.activeFrom,
upcomingChangedAgreement.certificateUrl,
)
}
.filter { upcomingRenewal ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import kotlinx.datetime.toLocalDateTime
import octopus.GetUpcomingRenewalReminderQuery
import octopus.type.buildAgreement
import octopus.type.buildContract
import octopus.type.buildContractRenewal
import octopus.type.buildMember
import octopus.type.buildProductVariant
import org.junit.Rule
Expand Down Expand Up @@ -56,9 +55,9 @@ class GetUpcomingRenewalRemindersUseCaseTest {
displayName = "display name"
}
}
upcomingRenewal = buildContractRenewal {
renewalDate = upcomingRenewalLocalDate
draftCertificateUrl = "draftUrl"
upcomingChangedAgreement = buildAgreement {
activeFrom = upcomingRenewalLocalDate
certificateUrl = "draftUrl"
}
},
)
Expand Down Expand Up @@ -91,9 +90,9 @@ class GetUpcomingRenewalRemindersUseCaseTest {
displayName = "#$index"
}
}
upcomingRenewal = buildContractRenewal {
renewalDate = clock.now().plus((index + 1).days).toLocalDateTime(TimeZone.UTC).date
draftCertificateUrl = "url#$index"
upcomingChangedAgreement = buildAgreement {
activeFrom = clock.now().plus((index + 1).days).toLocalDateTime(TimeZone.UTC).date
certificateUrl = "url#$index"
}
}
}
Expand Down Expand Up @@ -133,9 +132,9 @@ class GetUpcomingRenewalRemindersUseCaseTest {
displayName = "display name"
}
}
upcomingRenewal = buildContractRenewal {
renewalDate = upcomingRenewalLocalDate
draftCertificateUrl = "draftUrl"
upcomingChangedAgreement = buildAgreement {
activeFrom = upcomingRenewalLocalDate
certificateUrl = "draftUrl"
}
}
}
Expand Down Expand Up @@ -166,9 +165,9 @@ class GetUpcomingRenewalRemindersUseCaseTest {
displayName = "#$index"
}
}
upcomingRenewal = buildContractRenewal {
renewalDate = clock.now().minus(index.days).toLocalDateTime(TimeZone.UTC).date
draftCertificateUrl = "url#$index"
upcomingChangedAgreement = buildAgreement {
activeFrom = clock.now().minus(index.days).toLocalDateTime(TimeZone.UTC).date
certificateUrl = "url#$index"
}
}
}
Expand Down Expand Up @@ -206,9 +205,9 @@ class GetUpcomingRenewalRemindersUseCaseTest {
displayName = "#$index"
}
}
upcomingRenewal = buildContractRenewal {
renewalDate = (clock.now() + renewalOffsets[index]!!).toLocalDateTime(TimeZone.UTC).date
draftCertificateUrl = "url#$index"
upcomingChangedAgreement = buildAgreement {
activeFrom = (clock.now() + renewalOffsets[index]!!).toLocalDateTime(TimeZone.UTC).date
certificateUrl = "url#$index"
}
}
}
Expand Down
Loading