Subversion Repositories SmartDukaan

Rev

Rev 34798 | Rev 35002 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34798 Rev 34805
Line 115... Line 115...
115
            {Object.keys(this.props.plans).map((planName, i) =>
115
            {Object.keys(this.props.plans).map((planName, i) =>
116
                this.props.plans[planName].map((plan, j) => {
116
                this.props.plans[planName].map((plan, j) => {
117
                    const quoted = this.state.quotedPlans[plan.productId];
117
                    const quoted = this.state.quotedPlans[plan.productId];
118
                    const isQuoted = !!quoted;
118
                    const isQuoted = !!quoted;
119
                    const displayPremium = isQuoted ? quoted.premium : (plan.premium || 0);
119
                    const displayPremium = isQuoted ? quoted.premium : (plan.premium || 0);
120
                    const displayDP = isQuoted ? quoted.premium : (plan.dp || 0);
120
                    const displayDP = isQuoted ? quoted.dp : (plan.dp || 0);
121
 
121
 
122
                    return (
122
                    return (
123
                        <tr key={`${i}-${j}`}>
123
                        <tr key={`${i}-${j}`}>
124
                            <td>{planName}</td>
124
                            <td>{planName}</td>
125
                            <td>{plan.duration}</td>
125
                            <td>{plan.duration}</td>
Line 205... Line 205...
205
            `${context}/getPlanQuote?planCode=${planCode}&itemId=${itemId}&sumInsured=${devicePrice}&manufacturedDate=${manuFacturedDate}`,
205
            `${context}/getPlanQuote?planCode=${planCode}&itemId=${itemId}&sumInsured=${devicePrice}&manufacturedDate=${manuFacturedDate}`,
206
            (responseText) => {
206
            (responseText) => {
207
                const response = JSON.parse(responseText);
207
                const response = JSON.parse(responseText);
208
                console.log("quote call back", response);
208
                console.log("quote call back", response);
209
 
209
 
210
                if (response.statusMessage === "Success" && response.policyStatus === "APPROVE") {
210
                if (response.afinityQuoteModel.statusMessage === "Success" && response.afinityQuoteModel.policyStatus === "APPROVE") {
211
                    const updatedPlan = {
211
                    const updatedPlan = {
212
                        premium: response.totalPremium,
212
                        premium: response.afinityQuoteModel.totalPremium,
-
 
213
                        dp: response.planDp,
213
                        correlationId: response.correlationId
214
                        correlationId: response.afinityQuoteModel.correlationId
214
                    };
215
                    };
215
 
216
 
216
                    this.setState((prevState) => ({
217
                    this.setState((prevState) => ({
217
                        quotedPlans: {
218
                        quotedPlans: {
218
                            ...prevState.quotedPlans,
219
                            ...prevState.quotedPlans,
219
                            [planCode]: updatedPlan
220
                            [planCode]: updatedPlan
220
                        }
221
                        }
221
                    }));
222
                    }));
222
                } else {
223
                } else {
223
                    bootbox.alert("Quote failed: " + (response.message || "Unknown error"));
224
                    bootbox.alert("Quote failed: " + (response.afinityQuoteModel.message || "Unknown error"));
224
                }
225
                }
225
            }
226
            }
226
        );
227
        );
227
    }
228
    }
228
}
229
}