Skip to content

Commit

Permalink
Merge pull request #642 from codex-team/fix/business-operations
Browse files Browse the repository at this point in the history
fix(payments): Hide card linking business operation
  • Loading branch information
TatianaFomina authored Jan 25, 2025
2 parents c60a6c2 + 27acb8d commit af49c87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 36 deletions.
39 changes: 3 additions & 36 deletions src/components/modals/PaymentDetailsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -414,34 +414,6 @@ export default Vue.extend({
return this.isAcceptedPaymentAgreement;
},
/**
* True if user pays for the current tariff plan (no plan-changing)
*/
isPaymentForCurrentTariffPlan(): boolean {
return this.workspace.plan.id === this.plan.id;
},
/**
* True when we need to withdraw the amount only to validate the subscription
*/
isOnlyCardValidationNeeded(): boolean {
/**
* In case of not recurrent payment we need to withdraw full amount
*/
if (!this.isRecurrent) {
return false;
}
/**
* In case when user pays for another tariff plan we need to withdraw full amount
*/
if (!this.isPaymentForCurrentTariffPlan) {
return false;
}
return !this.isTariffPlanExpired;
},
},
watch: {
/**
Expand Down Expand Up @@ -567,7 +539,7 @@ export default Vue.extend({
const widget = new window.cp.CloudPayments({ language: this.$i18n.locale });
const paymentData: PlanProlongationPayload = {
checksum: data.checksum,
checksum: data.checksum
};
const interval = this.workspace.isDebug ? 'Day' : 'Month';
Expand All @@ -586,13 +558,8 @@ export default Vue.extend({
}
}
let amount = data.plan.monthlyCharge;
if (this.isOnlyCardValidationNeeded) {
amount = AMOUNT_FOR_CARD_VALIDATION;
}
const method = this.isOnlyCardValidationNeeded ? 'auth' : 'charge'
const amount = data.isCardLinkOperation ? AMOUNT_FOR_CARD_VALIDATION : data.plan.monthlyCharge;
const method = data.isCardLinkOperation ? 'auth' : 'charge'
widget.pay(method,
{
Expand Down
6 changes: 6 additions & 0 deletions src/types/before-payment-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ export interface BeforePaymentPayload {
* Hash to check data consistency
*/
checksum: string;

/**
* True if this is card linking operation.
* Charging minimal amount of money that will be returned
*/
isCardLinkOperation: boolean;
}

0 comments on commit af49c87

Please sign in to comment.