@@ -16,9 +16,9 @@ func FromPlan(p plan.Plan) (api.BillingPlan, error) {
1616 validationIssues , _ := p .AsProductCatalogPlan ().ValidationErrors ()
1717
1818 resp := api.BillingPlan {
19- BillingCadence : api . ISO8601Duration ( p .BillingCadence .String () ),
19+ BillingCadence : p .BillingCadence .String (),
2020 CreatedAt : lo .ToPtr (p .CreatedAt ),
21- Currency : api . CurrencyCode ( p .Currency .String () ),
21+ Currency : p .Currency .String (),
2222 DeletedAt : p .DeletedAt ,
2323 Description : p .Description ,
2424 EffectiveFrom : p .EffectiveFrom ,
@@ -102,7 +102,7 @@ func fromRateCard(rc productcatalog.RateCard) (api.BillingRateCard, error) {
102102 switch rc .Type () {
103103 case productcatalog .FlatFeeRateCardType :
104104 if bc := rc .GetBillingCadence (); bc != nil {
105- result .BillingCadence = lo .ToPtr (api . ISO8601Duration ( bc .ISOString ().String () ))
105+ result .BillingCadence = lo .ToPtr (bc .ISOString ().String ())
106106 }
107107
108108 if meta .Price != nil {
@@ -120,7 +120,7 @@ func fromRateCard(rc productcatalog.RateCard) (api.BillingRateCard, error) {
120120 return result , fmt .Errorf ("usage-based rate card %q missing billing cadence" , meta .Key )
121121 }
122122
123- result .BillingCadence = lo .ToPtr (api . ISO8601Duration ( bc .ISOString ().String () ))
123+ result .BillingCadence = lo .ToPtr (bc .ISOString ().String ())
124124
125125 if meta .Price != nil {
126126 result .Commitments = fromBillingCommitments (meta .Price .GetCommitments ())
@@ -161,7 +161,7 @@ func fromBillingPrice(p *productcatalog.Price) (api.BillingPrice, error) {
161161 }
162162
163163 if err = result .FromBillingPriceFlat (api.BillingPriceFlat {
164- Amount : api . Numeric ( flat .Amount .String () ),
164+ Amount : flat .Amount .String (),
165165 Type : api .BillingPriceFlatType ("flat" ),
166166 }); err != nil {
167167 return result , fmt .Errorf ("failed to set flat price: %w" , err )
@@ -174,7 +174,7 @@ func fromBillingPrice(p *productcatalog.Price) (api.BillingPrice, error) {
174174 }
175175
176176 if err = result .FromBillingPriceUnit (api.BillingPriceUnit {
177- Amount : api . Numeric ( unit .Amount .String () ),
177+ Amount : unit .Amount .String (),
178178 Type : api .BillingPriceUnitType ("unit" ),
179179 }); err != nil {
180180 return result , fmt .Errorf ("failed to set unit price: %w" , err )
@@ -229,19 +229,19 @@ func fromBillingPriceTiers(tiers []productcatalog.PriceTier) []api.BillingPriceT
229229 tier := api.BillingPriceTier {}
230230
231231 if t .UpToAmount != nil {
232- tier .UpToAmount = lo .ToPtr (api . Numeric ( t .UpToAmount .String () ))
232+ tier .UpToAmount = lo .ToPtr (t .UpToAmount .String ())
233233 }
234234
235235 if t .FlatPrice != nil {
236236 tier .FlatPrice = & api.BillingPriceFlat {
237- Amount : api . Numeric ( t .FlatPrice .Amount .String () ),
237+ Amount : t .FlatPrice .Amount .String (),
238238 Type : api .BillingPriceFlatType ("flat" ),
239239 }
240240 }
241241
242242 if t .UnitPrice != nil {
243243 tier .UnitPrice = & api.BillingPriceUnit {
244- Amount : api . Numeric ( t .UnitPrice .Amount .String () ),
244+ Amount : t .UnitPrice .Amount .String (),
245245 Type : api .BillingPriceUnitType ("unit" ),
246246 }
247247 }
@@ -283,7 +283,7 @@ func fromBillingDiscounts(d productcatalog.Discounts) *api.BillingRateCardDiscou
283283 }
284284
285285 if d .Usage != nil {
286- result .Usage = lo .ToPtr (api . Numeric ( d .Usage .Quantity .String () ))
286+ result .Usage = lo .ToPtr (d .Usage .Quantity .String ())
287287 }
288288
289289 return result
@@ -297,11 +297,11 @@ func fromBillingCommitments(c productcatalog.Commitments) *api.BillingSpendCommi
297297 result := & api.BillingSpendCommitments {}
298298
299299 if c .MinimumAmount != nil {
300- result .MinimumAmount = lo .ToPtr (api . Numeric ( c .MinimumAmount .String () ))
300+ result .MinimumAmount = lo .ToPtr (c .MinimumAmount .String ())
301301 }
302302
303303 if c .MaximumAmount != nil {
304- result .MaximumAmount = lo .ToPtr (api . Numeric ( c .MaximumAmount .String () ))
304+ result .MaximumAmount = lo .ToPtr (c .MaximumAmount .String ())
305305 }
306306
307307 return result
0 commit comments