Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions client-app/pages/account/order-payment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@
@fail="failure = true"
/>

<PaymentProcessingDatatrans
v-else-if="paymentMethodCode === 'DatatransPaymentMethod'"
:order="order"
@success="success = true"
@fail="failure = true"
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Conditional Rendering Issue in Payment Component

The PaymentProcessingDatatrans component uses v-else-if, unlike other payment processing components that use v-if. This creates an incorrect conditional chain, which prevents the Datatrans component from rendering when paymentMethodCode is 'DatatransPaymentMethod' if a preceding payment method is active.

Fix in Cursor Fix in Web


<ExtensionPointList
v-else-if="
paymentMethodCode &&
Expand Down Expand Up @@ -321,6 +328,7 @@ import type { Optional } from "utility-types";
import AddOrUpdateAddressModal from "@/shared/account/components/add-or-update-address-modal.vue";
import PaymentProcessingAuthorizeNet from "@/shared/payment/components/payment-processing-authorize-net.vue";
import PaymentProcessingCyberSource from "@/shared/payment/components/payment-processing-cyber-source.vue";
import PaymentProcessingDatatrans from "@/shared/payment/components/payment-processing-datatrans.vue";
import PaymentProcessingSkyflow from "@/shared/payment/components/payment-processing-skyflow.vue";

interface IProps {
Expand Down Expand Up @@ -374,6 +382,9 @@ const paymentMethodType = computed<number | undefined>(() => payment.value?.paym
const paymentMethodCode = computed<string | undefined>(() => payment.value?.paymentMethod?.code);

function tryAgain() {
const url = new URL(globalThis.location.href);
url.search = "";
globalThis.history.replaceState({}, document.title, url.toString());
location.reload();
}

Expand Down
7 changes: 7 additions & 0 deletions client-app/pages/checkout/payment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
@success="onPaymentResult(true)"
@fail="onPaymentResult(false)"
/>
<PaymentProcessingDatatrans
v-else-if="paymentTypeName === 'DatatransPaymentMethod'"
:order="placedOrder"
@success="onPaymentResult(true)"
@fail="onPaymentResult(false)"
/>
<ExtensionPointList
v-else-if="
paymentTypeName &&
Expand Down Expand Up @@ -70,6 +76,7 @@ import { PaymentActionType, PaymentProcessingRedirection } from "@/shared/paymen
import type { PaymentInType } from "@/core/api/graphql/types";
import PaymentProcessingAuthorizeNet from "@/shared/payment/components/payment-processing-authorize-net.vue";
import PaymentProcessingCyberSource from "@/shared/payment/components/payment-processing-cyber-source.vue";
import PaymentProcessingDatatrans from "@/shared/payment/components/payment-processing-datatrans.vue";
import PaymentProcessingSkyflow from "@/shared/payment/components/payment-processing-skyflow.vue";

const router = useRouter();
Expand Down
1 change: 1 addition & 0 deletions client-app/shared/payment/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as PaymentProcessingDatatrans } from "./payment-processing-datatrans.vue";
export { default as PaymentProcessingManual } from "./payment-processing-manual.vue";
export { default as PaymentProcessingRedirection } from "./payment-processing-redirection.vue";
export { default as PaymentProcessingSkyflow } from "./payment-processing-skyflow.vue";
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
data-test-id="pay-now-button"
@click="sendPaymentData"
>
{{ $t("shared.payment.authorize_net.pay_now_button") }}
{{ $t("shared.payment.bank_card_form.pay_now_button") }}
</VcButton>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
data-test-id="pay-now-button"
@click="sendPaymentData"
>
{{ $t("shared.payment.authorize_net.pay_now_button") }}
{{ $t("shared.payment.bank_card_form.pay_now_button") }}
</VcButton>
</div>
</template>
Expand Down Expand Up @@ -259,7 +259,6 @@ async function createToken(options: Record<string, unknown>): Promise<string> {
return new Promise((resolve, reject) => {
microform.createToken(options, (err: unknown, token: string) => {
if (err) {
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(err);
} else {
resolve(token);
Expand Down Expand Up @@ -376,8 +375,8 @@ async function useDynamicScript(url: string, integrity?: string): Promise<void>
}

function removeScript() {
if (scriptTag.value && scriptTag.value.parentNode) {
scriptTag.value.parentNode.removeChild(scriptTag.value);
if (scriptTag.value) {
scriptTag.value.remove();
}
}

Expand Down
Loading