@@ -19,7 +19,10 @@ import {
19
19
LoadingState ,
20
20
useAsyncLoader ,
21
21
} from '@/client/utilities/hooks/useAsyncLoader' ;
22
- import { getDiscountMonthsForDigisub } from '@/client/utilities/pricingConfig/digisubDiscountPricing' ;
22
+ import {
23
+ getDiscountMonthsForDigisub ,
24
+ getDiscountRatePlanId ,
25
+ } from '@/client/utilities/pricingConfig/digisubDiscountPricing' ;
23
26
import { formatAmount } from '@/client/utilities/utils' ;
24
27
import type { PaidSubscriptionPlan } from '@/shared/productResponse' ;
25
28
import { getMainPlan } from '@/shared/productResponse' ;
@@ -145,6 +148,7 @@ export const DigiSubThankYouOffer = () => {
145
148
CancellationContext ,
146
149
) as CancellationContextInterface ;
147
150
const productDetail = cancellationContext . productDetail ;
151
+ const discountMonths = getDiscountMonthsForDigisub ( productDetail ) ;
148
152
149
153
const {
150
154
data,
@@ -159,9 +163,8 @@ export const DigiSubThankYouOffer = () => {
159
163
body : JSON . stringify ( {
160
164
subscriptionNumber :
161
165
productDetail . subscription . subscriptionId ,
162
- // Todo: make this fetch rate plan from config
163
166
discountProductRatePlanId :
164
- '2c92c0f962cec7990162d3882afc52dd' ,
167
+ getDiscountRatePlanId ( discountMonths ) ,
165
168
} ) ,
166
169
} ) ,
167
170
JsonResponseHandler ,
@@ -196,7 +199,6 @@ export const DigiSubThankYouOffer = () => {
196
199
productDetail . subscription ,
197
200
) as PaidSubscriptionPlan ;
198
201
199
- const discountMonths = getDiscountMonthsForDigisub ( productDetail ) ;
200
202
const newPrice =
201
203
( productDetail . subscription . nextPaymentPrice ?? mainPlan . price ) / 100 ;
202
204
@@ -216,7 +218,7 @@ export const DigiSubThankYouOffer = () => {
216
218
subscriptionNumber :
217
219
productDetail . subscription . subscriptionId ,
218
220
discountProductRatePlanId :
219
- '2c92c0f962cec7990162d3882afc52dd' ,
221
+ getDiscountRatePlanId ( discountMonths ) ,
220
222
} ) ,
221
223
} ,
222
224
) ;
0 commit comments