Exemplo n.º 1
0
        public CreditResult Credit(int transactionNumber, long amount, string orderId, int vatAmount, string additionalValues)
        {
            Log.InfoFormat("Calling Credit for TransactionNumber:{0}. Amount:{1}. OrderId:{2}. VatAmount:{3}. AdditionalValues:{4}",
                           transactionNumber, amount, orderId, vatAmount, additionalValues);

            string hash      = _hasher.Create(_payExSettings.AccountNumber, transactionNumber, amount, orderId, vatAmount, additionalValues, _payExSettings.EncryptionKey);
            string xmlResult = _orderFacade.Credit(_payExSettings.AccountNumber, transactionNumber, amount, orderId, vatAmount,
                                                   additionalValues, hash);

            CreditResult result = _resultParser.Deserialize <CreditResult>(xmlResult);

            if (result.Success)
            {
                Log.InfoFormat("Successfully called Credit for TransactionNumber:{0}. Amount:{1}. OrderId:{2}. VatAmount:{3}. AdditionalValues:{4}. Result:{5}",
                               transactionNumber, amount, orderId, vatAmount, additionalValues, xmlResult);
            }
            else
            {
                Log.ErrorFormat("Error when calling Credit for TransactionNumber:{0}. Amount:{1}. OrderId:{2}. VatAmount:{3}. AdditionalValues:{4}. Result:{5}",
                                transactionNumber, amount, orderId, vatAmount, additionalValues, xmlResult);
            }
            return(result);
        }