@@ -98,10 +98,9 @@ func (s *TaxCodePersistenceTestSuite) TestFlatFeeChargePersistsTaxConfig() {
9898 flatFee , err := readBack .AsFlatFeeCharge ()
9999 s .NoError (err )
100100
101- s .Require ().NotNil (flatFee .Intent .TaxConfig , "TaxConfig must be populated on read" )
102101 s .Require ().NotNil (flatFee .Intent .TaxConfig .Behavior , "TaxBehavior must be persisted" )
103102 s .Equal (productcatalog .InclusiveTaxBehavior , * flatFee .Intent .TaxConfig .Behavior )
104- s .Require ().NotNil (flatFee .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
103+ s .Require ().NotEmpty (flatFee .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
105104 s .Equal (tc .ID , flatFee .Intent .TaxConfig .TaxCodeID )
106105 })
107106
@@ -135,7 +134,6 @@ func (s *TaxCodePersistenceTestSuite) TestFlatFeeChargePersistsTaxConfig() {
135134 s .NoError (err )
136135
137136 // nil TaxConfig intents get the namespace default invoicing TaxCodeID stamped.
138- s .Require ().NotNil (flatFee .Intent .TaxConfig , "TaxConfig must be stamped with the default invoicing tax code" )
139137 s .Require ().NotEmpty (flatFee .Intent .TaxConfig .TaxCodeID , "default invoicing TaxCodeID must be stamped" )
140138 s .Equal (defaults .InvoicingTaxCodeID , flatFee .Intent .TaxConfig .TaxCodeID )
141139 s .Nil (flatFee .Intent .TaxConfig .Behavior , "Behavior must remain nil when only default TaxCodeID is stamped" )
@@ -196,10 +194,9 @@ func (s *TaxCodePersistenceTestSuite) TestUsageBasedChargePersistsTaxConfig() {
196194 usageBased , err := readBack .AsUsageBasedCharge ()
197195 s .NoError (err )
198196
199- s .Require ().NotNil (usageBased .Intent .TaxConfig , "TaxConfig must be populated on read" )
200197 s .Require ().NotNil (usageBased .Intent .TaxConfig .Behavior , "TaxBehavior must be persisted" )
201198 s .Equal (productcatalog .ExclusiveTaxBehavior , * usageBased .Intent .TaxConfig .Behavior )
202- s .Require ().NotNil (usageBased .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
199+ s .Require ().NotEmpty (usageBased .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
203200 s .Equal (tc .ID , usageBased .Intent .TaxConfig .TaxCodeID )
204201 })
205202
@@ -233,7 +230,6 @@ func (s *TaxCodePersistenceTestSuite) TestUsageBasedChargePersistsTaxConfig() {
233230 s .NoError (err )
234231
235232 // nil TaxConfig intents get the namespace default invoicing TaxCodeID stamped.
236- s .Require ().NotNil (usageBased .Intent .TaxConfig , "TaxConfig must be stamped with the default invoicing tax code" )
237233 s .Require ().NotEmpty (usageBased .Intent .TaxConfig .TaxCodeID , "default invoicing TaxCodeID must be stamped" )
238234 s .Equal (defaults .InvoicingTaxCodeID , usageBased .Intent .TaxConfig .TaxCodeID )
239235 s .Nil (usageBased .Intent .TaxConfig .Behavior , "Behavior must remain nil when only default TaxCodeID is stamped" )
@@ -293,10 +289,9 @@ func (s *TaxCodePersistenceTestSuite) TestCreditPurchaseChargePersistsTaxConfig(
293289 cp , err := readBack .AsCreditPurchaseCharge ()
294290 s .NoError (err )
295291
296- s .Require ().NotNil (cp .Intent .TaxConfig , "TaxConfig must be populated on read" )
297292 s .Require ().NotNil (cp .Intent .TaxConfig .Behavior , "TaxBehavior must be persisted" )
298293 s .Equal (productcatalog .InclusiveTaxBehavior , * cp .Intent .TaxConfig .Behavior )
299- s .Require ().NotNil (cp .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
294+ s .Require ().NotEmpty (cp .Intent .TaxConfig .TaxCodeID , "TaxCodeID must be persisted as FK" )
300295 s .Equal (tc .ID , cp .Intent .TaxConfig .TaxCodeID )
301296 })
302297
@@ -333,7 +328,6 @@ func (s *TaxCodePersistenceTestSuite) TestCreditPurchaseChargePersistsTaxConfig(
333328 s .NoError (err )
334329
335330 // nil TaxConfig intents get the namespace default credit-grant TaxCodeID stamped.
336- s .Require ().NotNil (cp .Intent .TaxConfig , "TaxConfig must be stamped with the default credit grant tax code" )
337331 s .Require ().NotEmpty (cp .Intent .TaxConfig .TaxCodeID , "default credit grant TaxCodeID must be stamped" )
338332 s .Equal (defaults .CreditGrantTaxCodeID , cp .Intent .TaxConfig .TaxCodeID )
339333 s .Nil (cp .Intent .TaxConfig .Behavior , "Behavior must remain nil when only default TaxCodeID is stamped" )
@@ -471,7 +465,7 @@ func (s *TaxCodePersistenceTestSuite) TestCreditPurchaseInvoiceSettlementPropaga
471465}
472466
473467// TestCreditPurchaseInvoiceSettlementNilTaxConfigGetsDefaultCreditGrantTaxCodeStamped verifies that
474- // when Intent.TaxConfig is nil the gathering line's TaxConfig is populated with the namespace
468+ // when Intent.TaxConfig is zero the gathering line's TaxConfig is populated with the namespace
475469// default credit-grant tax code ID stamped by applyDefaultTaxCodes.
476470func (s * TaxCodePersistenceTestSuite ) TestCreditPurchaseInvoiceSettlementNilTaxConfigGetsDefaultCreditGrantTaxCodeStamped () {
477471 ctx := s .T ().Context ()
@@ -599,7 +593,6 @@ func (s *TaxCodePersistenceTestSuite) TestFlatFeeCreditOnlyHandlerReceivesTaxCon
599593 s .NoError (err )
600594 s .Require ().Len (advancedCharges , 1 )
601595
602- s .Require ().NotNil (capturedInput .Charge .Intent .TaxConfig , "handler must receive TaxConfig after DB roundtrip" )
603596 s .Require ().NotNil (capturedInput .Charge .Intent .TaxConfig .Behavior )
604597 s .Equal (productcatalog .InclusiveTaxBehavior , * capturedInput .Charge .Intent .TaxConfig .Behavior )
605598 s .Require ().NotEmpty (capturedInput .Charge .Intent .TaxConfig .TaxCodeID )
@@ -682,7 +675,6 @@ func (s *TaxCodePersistenceTestSuite) TestUsageBasedCreditOnlyHandlerReceivesTax
682675 _ , err = s .Charges .AdvanceCharges (ctx , charges.AdvanceChargesInput {Customer : cust .GetID ()})
683676 s .NoError (err )
684677
685- s .Require ().NotNil (capturedInput .Charge .Intent .TaxConfig , "handler must receive TaxConfig after DB roundtrip" )
686678 s .Require ().NotNil (capturedInput .Charge .Intent .TaxConfig .Behavior )
687679 s .Equal (productcatalog .ExclusiveTaxBehavior , * capturedInput .Charge .Intent .TaxConfig .Behavior )
688680 s .Require ().NotEmpty (capturedInput .Charge .Intent .TaxConfig .TaxCodeID )
@@ -893,12 +885,10 @@ func (s *TaxCodePersistenceTestSuite) TestTaxConfigInListCharges() {
893885
894886 if ff .Intent .Intent .UniqueReferenceID != nil && * ff .Intent .Intent .UniqueReferenceID == "flat-fee-list-no-taxcode" {
895887 // nil TaxConfig intents get the default invoicing TaxCodeID stamped.
896- s .Require ().NotNil (ff .Intent .TaxConfig , "flat fee charge without explicit tax config must have default invoicing TaxCodeID stamped" )
897888 s .Require ().NotEmpty (ff .Intent .TaxConfig .TaxCodeID )
898889 s .Equal (defaults .InvoicingTaxCodeID , ff .Intent .TaxConfig .TaxCodeID )
899890 s .Nil (ff .Intent .TaxConfig .Behavior )
900891 } else {
901- s .Require ().NotNil (ff .Intent .TaxConfig , "flat fee charge must carry TaxConfig in list response" )
902892 s .Require ().NotNil (ff .Intent .TaxConfig .Behavior )
903893 s .Equal (productcatalog .InclusiveTaxBehavior , * ff .Intent .TaxConfig .Behavior )
904894 s .Require ().NotEmpty (ff .Intent .TaxConfig .TaxCodeID )
@@ -908,7 +898,6 @@ func (s *TaxCodePersistenceTestSuite) TestTaxConfigInListCharges() {
908898 case meta .ChargeTypeUsageBased :
909899 ub , err := charge .AsUsageBasedCharge ()
910900 s .Require ().NoError (err )
911- s .Require ().NotNil (ub .Intent .TaxConfig , "usage-based charge must carry TaxConfig in list response" )
912901 s .Require ().NotNil (ub .Intent .TaxConfig .Behavior )
913902 s .Equal (productcatalog .InclusiveTaxBehavior , * ub .Intent .TaxConfig .Behavior )
914903 s .Require ().NotEmpty (ub .Intent .TaxConfig .TaxCodeID )
@@ -993,7 +982,7 @@ func (s *TaxCodePersistenceTestSuite) TestFlatFeeInvoiceSettlementPropagatesTaxC
993982}
994983
995984// TestFlatFeeInvoiceSettlementNilTaxConfigGetsDefaultInvoicingTaxCodeStampedOnGatheringLine verifies
996- // that when Intent.TaxConfig is nil , the flat-fee CreditThenInvoice gathering line's TaxConfig is
985+ // that when Intent.TaxConfig is zero , the flat-fee CreditThenInvoice gathering line's TaxConfig is
997986// populated with the namespace default invoicing tax code ID stamped by applyDefaultTaxCodes.
998987func (s * TaxCodePersistenceTestSuite ) TestFlatFeeInvoiceSettlementNilTaxConfigGetsDefaultInvoicingTaxCodeStampedOnGatheringLine () {
999988 ctx := s .T ().Context ()
0 commit comments