Skip to content

Commit

Permalink
Merge pull request #1826 from HedvigInsurance/fix/backend_breaking_ch…
Browse files Browse the repository at this point in the history
…anges

Fix breaking GQL changes
  • Loading branch information
StylianosGakis authored Oct 12, 2023
2 parents 17b06ff + 9354478 commit 55c7adb
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 28 deletions.
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

0 comments on commit 55c7adb

Please sign in to comment.