-
+
-
-
+
+
{
}
async function updatePaymentMethod(): Promise {
+ if (!defaultCreditCardSelection.value) {
+ notify.error('Default card is not selected', AnalyticsErrorEventSource.BILLING_PAYMENT_METHODS_TAB);
+ return;
+ }
+
+ const card = creditCards.value.find(c => c.id === defaultCreditCardSelection.value);
+ if (card && card.isDefault) {
+ notify.error('Chosen card is already default', AnalyticsErrorEventSource.BILLING_PAYMENT_METHODS_TAB);
+ return;
+ }
+
try {
await billingStore.makeCardDefault(defaultCreditCardSelection.value);
notify.success('Default payment card updated');
@@ -485,6 +495,8 @@ function paginationController(page: number, limit: number): void {
}
onMounted((): void => {
+ defaultCreditCardSelection.value = creditCards.value.find(c => c.isDefault)?.id ?? '';
+
if (route.query.action === 'token history') {
showTransactionsTable();
}
@@ -541,16 +553,17 @@ $align: center;
}
.change-default-input-container {
+ font-family: 'font_regular', sans-serif;
display: $flex;
- flex-direction: row;
- align-items: flex-start;
+ align-items: center;
padding: 16px;
gap: 10px;
- width: 300px;
- height: 10px;
+ width: 100%;
+ box-sizing: border-box;
border: 1px solid var(--c-grey-4);
border-radius: 8px;
margin: 7px auto auto;
+ cursor: pointer;
}
.change-default-input {
@@ -562,23 +575,15 @@ $align: center;
.default-card-button {
margin-top: 20px;
- margin-bottom: 20px;
cursor: pointer;
- margin-left: 112px;
- display: $flex;
- grid-column: 1;
- grid-row: 5;
- width: 132px;
height: 24px;
padding: 16px;
- gap: 8px;
background: var(--c-blue-3);
box-shadow: 0 0 1px rgb(9 28 69 / 80%);
border-radius: 8px;
font-family: 'font_bold', sans-serif;
font-size: 14px;
line-height: 24px;
- align-items: $align;
letter-spacing: -0.02em;
color: white;
@@ -589,16 +594,9 @@ $align: center;
.remove-card-button {
cursor: pointer;
- margin-left: 130px;
- margin-top: 15px;
- margin-bottom: 21px;
- grid-column: 1;
- grid-row: 5;
- width: 111px;
- height: 24px;
padding: 16px;
- gap: 8px;
background: #fff;
+ gap: 8px;
border: 1px solid var(--c-grey-3);
box-shadow: 0 0 3px rgb(0 0 0 / 8%);
border-radius: 8px;
@@ -623,23 +621,16 @@ $align: center;
cursor: pointer;
}
-.card-icon {
- margin-top: 20px;
- margin-left: 168px;
- grid-column: 1;
- grid-row: 1;
-}
-
-.card-icon-default {
- margin-top: 35px;
- margin-bottom: 10px;
- margin-left: 168px;
-}
-
.change-default-modal-container {
- width: 400px;
- background: #f5f6fa;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ width: 320px;
+ padding: 20px;
+ box-sizing: border-box;
+ background: var(--c-white);
border-radius: 6px;
+ position: relative;
}
.edit_payment_method {
@@ -652,15 +643,10 @@ $align: center;
justify-content: $align;
&__header-change-default {
- margin-top: -6px;
- margin-left: 141px;
- grid-column: 1;
- grid-row: 4;
+ margin: 16px 0;
}
&__header {
- grid-column: 1;
- grid-row: 2;
font-family: 'font_bold', sans-serif;
font-size: 24px;
line-height: 31px;
@@ -668,11 +654,11 @@ $align: center;
letter-spacing: -0.02em;
color: #1b2533;
align-self: center;
+ margin-top: 16px;
}
- &__header-subtext {
- grid-column: 1;
- grid-row: 3;
+ &__header-subtext,
+ &__header-subtext-default {
font-family: 'font_regular', sans-serif;
font-size: 14px;
line-height: 20px;
@@ -680,49 +666,23 @@ $align: center;
color: var(--c-grey-6);
}
- &__header-subtext-default {
- margin-left: 94px;
- font-family: 'font_regular', sans-serif;
- font-size: 14px;
- line-height: 20px;
- color: var(--c-grey-6);
- }
-
&__container {
- display: grid;
- grid-template-columns: auto;
- grid-template-rows: 1fr 60px 30px auto auto;
- width: 400px;
- background: #f5f6fa;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ width: 320px;
+ padding: 20px;
+ box-sizing: border-box;
+ background: var(--c-white);
border-radius: 6px;
+ position: relative;
- &__close-cross-container {
- margin-top: 22px;
- margin-left: 357px;
- grid-column: 1;
- grid-row: 1;
- height: 24px;
- width: 24px;
- cursor: pointer;
-
- &:hover .close-cross-svg-path {
- fill: #2683ff;
- }
- }
-
+ &__close-cross-container,
&__close-cross-container-default {
position: absolute;
- margin-top: -58px;
- margin-left: 357px;
- grid-column: 1;
- grid-row: 1;
- height: 24px;
- width: 24px;
+ top: 20px;
+ right: 20px;
cursor: pointer;
-
- &:hover .close-cross-svg-path {
- fill: #2683ff;
- }
}
}
}