UNPKG

@atlas-kitchen/adyen-web

Version:
3 lines (2 loc) 2.56 kB
import{httpPost as e}from"../../core/Services/http.js";import{pick as t}from"../../utils/commonUtils.js";import{THREEDS2_FINGERPRINT_SUBMIT as r}from"./constants.js";import{ANALYTICS_ERROR_TYPE as n,Analytics3DS2Errors as o}from"../../core/Analytics/constants.js";import{API_ERROR_CODE as i}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as s}from"../../core/Analytics/AnalyticsErrorEvent.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c({data:c}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:i.submitThreeDS2Fingerprint},function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){a(e,t,r[t])}))}return e}({},c)).then((e=>{var i,a;let c;if("completed"===e.type){const{details:t}=e;return e.details?this.onComplete({data:{details:t}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',e),c=new s({code:o.NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:n.apiError,message:`${r}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(c))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),c=new s({code:o.NO_ACTION_FOR_CHALLENGE,errorType:n.apiError,message:`${r}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(c);var l;const d=null!==(l=this.props.elementRef)&&void 0!==l?l:this;return d?"threeDS2"===(null===(i=e.action)||void 0===i?void 0:i.type)?d.handleAction(e.action,t("challengeWindowSize").from(this.props)):"redirect"===(null===(a=e.action)||void 0===a?void 0:a.type)?d.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),c=new s({code:o.NO_COMPONENT_FOR_ACTION,errorType:n.sdkError,message:`${r}: no component defined to handle the action response`}),void this.submitAnalytics(c))})).catch((e=>{this.handleError(e)}))}export{c as default}; //# sourceMappingURL=callSubmit3DS2Fingerprint.js.map