Skip to content

Commit

Permalink
Merge pull request #1068 from guardian/ph-20240828-1113-fix
Browse files Browse the repository at this point in the history
NotificationHandler update for Membership2023
  • Loading branch information
shtukas authored Aug 29, 2024
2 parents 17ef15a + 6f8966a commit e16f683
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,22 @@ object NotificationHandler extends CohortHandler {
cohortSpec: CohortSpec,
contact: SalesforceContact
): Either[NotificationHandlerFailure, SalesforceAddress] = {
def targetAddressMembership2023(
contact: SalesforceContact
): Either[NotificationHandlerFailure, SalesforceAddress] = {
(for {
billingAddress <- requiredField(contact.OtherAddress, "Contact.OtherAddress")
_ <- requiredField(billingAddress.street, "Contact.OtherAddress.street")
_ <- requiredField(billingAddress.city, "Contact.OtherAddress.city")
} yield billingAddress).left.flatMap(_ =>
Right(SalesforceAddress(Some(""), Some(""), Some(""), Some(""), Some("")))
)
}

MigrationType(cohortSpec) match {
case DigiSubs2023 => Right(SalesforceAddress(Some(""), Some(""), Some(""), Some(""), Some("")))
case DigiSubs2023 => Right(SalesforceAddress(Some(""), Some(""), Some(""), Some(""), Some("")))
case Membership2023Monthlies => targetAddressMembership2023(contact)
case Membership2023Annuals => targetAddressMembership2023(contact)
case _ =>
(for {
billingAddress <- requiredField(contact.OtherAddress, "Contact.OtherAddress")
Expand Down

0 comments on commit e16f683

Please sign in to comment.