コード例 #1
0
        public ThreeDSAuthorization0Response ThreeDSAuthorize0(ThreeDSAuthorization0Request request)
        {
            // Validate request
            RequestValidator.ValidateThreeDSAuthorize0Request(request);
            // Map input request in the XML Request
            var requestXML = RequestMapper.MapThreeDSAuthorization0Request(request, _shopId, _apiResultKey);

            // Calculate and set MAC
            requestXML.Request.MAC = _encoder.GetMac(RequestHandler.GetMacDictionary(requestXML), _apiResultKey);
            // Url Encode ThreeDSData to correctly send it
            requestXML.Data.RequestTag.ThreeDSData = HttpUtility.UrlEncode(requestXML.Data.RequestTag.ThreeDSData);
            var xmlBody = XmlTool.Serialize(requestXML);
            // Do call
            var xmlResponse = _restClient.CallApi(_urlAPI, xmlBody);
            // Map response
            var objectResponse = XmlTool.Deserialize <BPWXmlResponse <Data3DSResponse> >(xmlResponse);

            // Verify Response MAC
            VerifyMacResponse(objectResponse);
            VerifyAuthorization(objectResponse.Data.Authorization);
            VerifyPanAliasData(objectResponse.Data.PanAliasData);
            VerifyThreeDSChallenge(objectResponse.Data.ThreeDSChallenge);
            VerifyThreeDSMethod(objectResponse.Data.ThreeDSMethod);
            return(ResponseMapper.MapThreeDSAuthorization0(objectResponse));
        }