예제 #1
0
        public CaptureResponse Capture(CaptureRequest captureRequest)
        {
            // Validate request
            RequestValidator.ValidateCaptureRequest(captureRequest);
            // Map input request in the XML Request
            var request = RequestMapper.MapCaptureRequest(captureRequest, _shopId);

            //calculate 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);
            var objectResponse = XmlTool.Deserialize <BPWXmlResponse <DataManageOperation> >(xmlResponse);

            // Verify Mac Response
            VerifyMacResponse(objectResponse);
            VerifyOperation(objectResponse.Data.Operation);
            return(ResponseMapper.MapCaptureResponse(objectResponse));
        }