Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Fix checkout review description for adyen
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechdev committed Aug 18, 2020
1 parent 21f8a6b commit a473966
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
const gatewayRef = useRef<HTMLDivElement>(null);

useEffect(() => {
console.log(
"adyen state effect update",
adyenClientKey,
parsedAdyenConfig,
dropin,
gatewayRef.current
);
if (adyenClientKey && parsedAdyenConfig && !dropin && gatewayRef.current) {
const link = document.createElement("link");
link.rel = "stylesheet";
Expand Down Expand Up @@ -108,7 +101,6 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
paymentMethodsResponse: parsedAdyenConfig,
showPayButton: false,
onSubmit: (state: any, dropin: any) => {
console.log("submit adyen", state, dropin);
if (!state?.isValid) {
onError([new Error("Invalid payment submission")]);
} else {
Expand All @@ -117,20 +109,8 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
if (value.error) {
onError([value.error]);
} else if (!value?.confirmationNeeded) {
console.log(
"dropin onSubmitPayment no confirmation",
value,
state,
dropin
);
submitPaymentSuccess(value?.order);
} else {
console.log(
"dropin onSubmitPayment confirmation needed",
value,
state,
dropin
);
const paymentAction =
value?.confirmationData &&
JSON.parse(value?.confirmationData);
Expand All @@ -143,7 +123,6 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
}
},
onAdditionalDetails: (state: any, dropin: any) => {
console.log("additional details adyen", state, dropin);
if (!state?.isValid) {
onError([new Error("Invalid payment submission")]);
} else {
Expand All @@ -152,20 +131,8 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
if (value.error) {
onError([value.error]);
} else if (!value?.confirmationNeeded) {
console.log(
"dropin additionalDetails onSubmitPayment no confirmation",
value,
state,
dropin
);
submitPaymentSuccess(value?.order);
} else {
console.log(
"dropin additionalDetails onSubmitPayment confirmation needed",
value,
state,
dropin
);
const paymentAction =
value?.confirmationData &&
JSON.parse(value?.confirmationData);
Expand All @@ -188,7 +155,6 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
if (dropinElement && !dropin && gatewayRef.current) {
dropinElement?.mount(gatewayRef.current);
setDropin(dropinElement);
console.log(dropinElement, "dropin element set");
}
};

Expand All @@ -201,7 +167,6 @@ const AdyenPaymentGateway: React.FC<IProps> = ({
useEffect(() => {
if (dropin) {
(formRef?.current as any)?.addEventListener("submitComplete", () => {
console.log("event submitComplete");
dropin.submit();
});
}
Expand Down
10 changes: 0 additions & 10 deletions src/@next/pages/CheckoutPage/CheckoutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,6 @@ const CheckoutPage: React.FC<IProps> = ({}: IProps) => {
data?: object
) => {
const activeStepIndex = getActiveStepIndex();
console.log(
"handleStepSubmitSuccess",
data,
activeStepIndex,
steps,
location.pathname,
currentStep
);
if (
currentStep === CheckoutStep.Review ||
location.pathname === "/checkout/payment-confirm"
Expand Down Expand Up @@ -314,7 +306,6 @@ const CheckoutPage: React.FC<IProps> = ({}: IProps) => {
}
};
const handleSubmitPayment = async (paymentData?: object) => {
console.log("handleSubmitPayment");
const response = await completeCheckout({ paymentData });
return {
confirmationData: response.data?.confirmationData,
Expand All @@ -326,7 +317,6 @@ const CheckoutPage: React.FC<IProps> = ({}: IProps) => {
const handleSubmitPaymentSuccess = (
order?: CompleteCheckout_checkoutComplete_order
) => {
console.log("handleSubmitPaymentSuccess");
setSubmitInProgress(false);
setPaymentGatewayErrors([]);
handleStepSubmitSuccess(CheckoutStep.Review, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ const CheckoutReviewSubpageWithRef: RefForwardingComponent<
)?.label
}`;
}
if (payment?.gateway === "mirumee.payments.adyen") {
return `Adyen payments`;
}
if (payment?.creditCard) {
return `Ending in ${payment?.creditCard.lastDigits}`;
}
Expand Down

0 comments on commit a473966

Please sign in to comment.