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

Refactor product move tests #2012

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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 @@ -208,7 +208,7 @@ object ToRecurringContribution {
private def getActiveRatePlanAndCharge(
ratePlanAmendments: List[GetSubscription.RatePlan],
): Option[(GetSubscription.RatePlan, GetSubscription.RatePlanCharge)] = (for {
ratePlan <- ratePlanAmendments
ratePlan <- ratePlanAmendments.filter(_.lastChangeType != Some("Remove"))
ratePlanCharge <- ratePlan.ratePlanCharges
if ratePlanCharge.chargedThroughDate.isDefined
} yield (ratePlan, ratePlanCharge)).headOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ case class ChargeOverrides(
)

given JsonEncoder[ChargeOverrides] = DeriveJsonEncoder.gen[ChargeOverrides]
given JsonDecoder[ChargeOverrides] = DeriveJsonDecoder.gen[ChargeOverrides]

case class ZuoraAccountId(value: String) extends AnyVal
case class CaseId(value: String) extends AnyVal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ case class SubscriptionUpdateInvoice(
invoiceItems: List[SubscriptionUpdateInvoiceItem],
)
given JsonEncoder[SubscriptionUpdateRequest] = DeriveJsonEncoder.gen[SubscriptionUpdateRequest]
given JsonDecoder[SubscriptionUpdateRequest] = DeriveJsonDecoder.gen[SubscriptionUpdateRequest]
given JsonDecoder[SubscriptionUpdateResponse] = DeriveJsonDecoder.gen[SubscriptionUpdateResponse]
given JsonDecoder[SubscriptionUpdatePreviewResponse] = DeriveJsonDecoder.gen[SubscriptionUpdatePreviewResponse]
given JsonDecoder[SubscriptionUpdateInvoice] = DeriveJsonDecoder.gen[SubscriptionUpdateInvoice]
given JsonDecoder[SubscriptionUpdateInvoiceItem] = DeriveJsonDecoder.gen[SubscriptionUpdateInvoiceItem]
given JsonEncoder[AddRatePlan] = DeriveJsonEncoder.gen[AddRatePlan]
given JsonEncoder[RemoveRatePlan] = DeriveJsonEncoder.gen[RemoveRatePlan]

given JsonDecoder[AddRatePlan] = DeriveJsonDecoder.gen[AddRatePlan]
given JsonDecoder[RemoveRatePlan] = DeriveJsonDecoder.gen[RemoveRatePlan]
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
{
"basicInfo": {
"id": "id",
"name": "0015I00000du5mfQAA",
"accountNumber": "accNum",
"balance": 0,
"lastInvoiceDate": "2023-06-02",
"lastPaymentDate": "2023-06-02",
"lastPaymentAmount": 4,
"purchaseOrderNumber": null,
"currency": "EUR",
"status": "Active",
"batch": "Batch1",
"billCycleDay": 2,
"autoPay": true,
"invoiceDeliveryPrefsPrint": false,
"invoiceDeliveryPrefsEmail": false,
"additionalEmailAddresses": [],
"IdentityId__c": "101388443",
"sfContactId__c": "0035I00000Wum13QAB",
"CCURN__c": null,
"SpecialDeliveryInstructions__c": null,
"NonStandardDataReason__c": null,
"ProcessingAdvice__c": "NoAdvice",
"CreatedRequestId__c": "c539c98b-90c9-7698-0000-000000022b2e",
"RetryStatus__c": null,
"defaultPaymentMethod": {
"id": "id",
"paymentMethodType": "BankTransfer",
"creditCardNumber": null,
"creditCardExpirationMonth": null,
"creditCardExpirationYear": null,
"creditCardType": null
}
},
"billToContact": {
"id": "id",
"firstName": "JON",
"lastName": "HEE",
"address1": null,
"address2": null,
"city": null,
"county": null,
"state": null,
"zipCode": null,
"country": "Netherlands",
"workEmail": "jon@gmail.com",
"workPhone": null,
"taxRegion": null,
"fax": null,
"Company_Name__c": null,
"SpecialDeliveryInstructions__c": null,
"Title__c": null
},
"soldToContact": {
"id": "id",
"firstName": "JON",
"lastName": "HEE",
"address1": null,
"address2": null,
"city": null,
"county": null,
"state": null,
"zipCode": null,
"country": "Netherlands",
"workEmail": "jon@gmail.com",
"workPhone": null,
"taxRegion": null,
"fax": null,
"Company_Name__c": null,
"SpecialDeliveryInstructions__c": null,
"Title__c": null
},
"taxInfo": null,
"subscriptions": [
{
"id": "id",
"subscriptionNumber": "subNum",
"ratePlans": [
{
"productId": "2c92a0fe5aacfabe015ad24bf6e15ff6",
"productName": "Contributor",
"productSku": "ABC-00000028",
"productRatePlanId": "2c92a0fc5aacfadd015ad24db4ff5e97",
"ratePlanName": "Monthly Contribution"
}
],
"subscriptionStartDate": "2022-10-02",
"initialTerm": 12,
"autoRenew": true,
"renewalTerm": 12,
"termStartDate": "2022-10-02",
"termEndDate": "2023-10-02",
"status": "Active",
"termType": "TERMED",
"TrialPeriodPrice__c": null,
"CanadaHandDelivery__c": null,
"QuoteNumber__QT": null,
"GifteeIdentityId__c": null,
"OpportunityName__QT": null,
"GiftNotificationEmailDate__c": null,
"Gift_Subscription__c": "No",
"TrialPeriodDays__c": null,
"CreatedRequestId__c": "c539c98b-90c9-7698-0000-000000022b2e",
"AcquisitionSource__c": null,
"CreatedByCSR__c": null,
"CASSubscriberID__c": null,
"LastPriceChangeDate__c": null,
"InitialPromotionCode__c": null,
"CpqBundleJsonId__QT": null,
"RedemptionCode__c": null,
"QuoteType__QT": null,
"GiftRedemptionDate__c": null,
"QuoteBusinessType__QT": null,
"SupplierCode__c": null,
"legacy_cat__c": null,
"AcquisitionCase__c": null,
"ReaderType__c": "Direct",
"ActivationDate__c": null,
"UserCancellationReason__c": null,
"OpportunityCloseDate__QT": null,
"IPaddress__c": null,
"IPCountry__c": null,
"PromotionCode__c": null,
"OriginalSubscriptionStartDate__c": null,
"LegacyContractStartDate__c": null,
"CancellationReason__c": null
}
],
"invoices": [
{
"id": "id",
"invoiceNumber": "INV30831480",
"invoiceDate": "2023-06-02",
"dueDate": "2023-06-02",
"amount": 4,
"balance": 0,
"status": "Posted"
},
{
"id": "id",
"invoiceNumber": "INV30258211",
"invoiceDate": "2023-05-02",
"dueDate": "2023-05-02",
"amount": 4,
"balance": 0,
"status": "Posted"
},
{
"id": "id",
"invoiceNumber": "INV29686748",
"invoiceDate": "2023-04-02",
"dueDate": "2023-04-02",
"amount": 4,
"balance": 0,
"status": "Posted"
},
{
"id": "id",
"invoiceNumber": "INV29114346",
"invoiceDate": "2023-03-02",
"dueDate": "2023-03-02",
"amount": 4,
"balance": 0,
"status": "Posted"
},
{
"id": "id",
"invoiceNumber": "INV28553566",
"invoiceDate": "2023-02-02",
"dueDate": "2023-02-02",
"amount": 4,
"balance": 0,
"status": "Posted"
},
{
"id": "id",
"invoiceNumber": "INV27983268",
"invoiceDate": "2023-01-02",
"dueDate": "2023-01-02",
"amount": 4,
"balance": 0,
"status": "Posted"
}
],
"payments": [
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-32640017",
"effectiveDate": "2023-06-02",
"paidInvoices": [
{
"invoiceId": "8a129b5d8856013601887a90f7995719",
"invoiceNumber": "INV30831480",
"appliedPaymentAmount": 4
}
]
},
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-31920327",
"effectiveDate": "2023-05-02",
"paidInvoices": [
{
"invoiceId": "8a12837687cae92f0187dae3aa472af7",
"invoiceNumber": "INV30258211",
"appliedPaymentAmount": 4
}
]
},
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-31185474",
"effectiveDate": "2023-04-02",
"paidInvoices": [
{
"invoiceId": "8a1285dd873770a4018740655e5565b7",
"invoiceNumber": "INV29686748",
"appliedPaymentAmount": 4
}
]
},
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-30427251",
"effectiveDate": "2023-03-02",
"paidInvoices": [
{
"invoiceId": "8a129d4e86a05d1c0186a0fb4ebe344b",
"invoiceNumber": "INV29114346",
"appliedPaymentAmount": 4
}
]
},
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-29709985",
"effectiveDate": "2023-02-02",
"paidInvoices": [
{
"invoiceId": "8a128d8b860becda018610c795b44761",
"invoiceNumber": "INV28553566",
"appliedPaymentAmount": 4
}
]
},
{
"id": "id",
"paymentType": "Electronic",
"status": "Processed",
"paymentNumber": "P-28982113",
"effectiveDate": "2023-01-02",
"paidInvoices": [
{
"invoiceId": "8a1295bc855e5ccd01857125258523d0",
"invoiceNumber": "INV27983268",
"appliedPaymentAmount": 4
}
]
}
],
"usage": [],
"success": true
}
Loading