예제 #1
0
        public AuthorizeResponse Authorize(AuthorizeRequest authorize)
        {
            // Validate request
            RequestValidator.ValidateAuthorizeRequest(authorize);
            // Map input request in the XML Request
            var request = RequestMapper.MapAuthorizeRequest(authorize, _shopId);

            // Calculate and set MAC
            request.Request.MAC = _encoder.GetMac(RequestHandler.GetMacDictionary(request), _apiResultKey);
            var xmlBody = XmlTool.Serialize(request);
            // Do call to VPOS
            var xmlResponse = _restClient.CallApi(_urlAPI, xmlBody);
            // Map response
            var objectResponse = XmlTool.Deserialize <BPWXmlResponse <DataAuthorize> >(xmlResponse);

            // Verify Response MAC
            VerifyMacResponse(objectResponse);
            VerifyAuthorization(objectResponse.Data.Authorization);
            VerifyPanAliasData(objectResponse.Data.PanAliasData);
            //Response Mapping
            return(ResponseMapper.MapAuthorize(objectResponse));;
        }