Ejemplo n.º 1
0
        public void CreateTransaction_UsingPreviousTranscactionId_Success()
        {
            var response = transactionService.CreateTransaction(createTransactionRequest);

            Assert.IsFalse(response.IsError);
            Assert.AreEqual(201, response.ResponseCode);
            Assert.IsNotNull(response.Content.Id);
        }
Ejemplo n.º 2
0
        public ProcessPaymentResult ProcessPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var result = new ProcessPaymentResult();

            var token = processPaymentRequest.CustomValues["paymenttoken"].ToString();
            var primaryStoreCurrency = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);
            int amount = (int)(Decimal.Round(processPaymentRequest.OrderTotal, 2) * 100);

            CreateTransactionRequest createTransactionRequest = new CreateTransactionRequest()
            {
                Amount     = amount,
                Currency   = primaryStoreCurrency.CurrencyCode,
                CardId     = token,
                MerchantId = _paylikePaymentSettings.MerchantId,
                Descriptor = string.Empty,
                Custom     = new Dictionary <string, string>()
                {
                }
            };

            createTransactionRequest.Custom.Add("NopOrderGuid", processPaymentRequest.OrderGuid.ToString());

            var createTransactionResponse = _paylikeTransactionService.CreateTransaction(createTransactionRequest);

            if (createTransactionResponse.IsError)
            {
                result.AddError(createTransactionResponse.ErrorMessage);
                result.AddError(createTransactionResponse.ErrorContent);
            }
            else
            {
                result.AuthorizationTransactionId = createTransactionResponse.Content.Id;
                result.NewPaymentStatus           = PaymentStatus.Authorized;
            }

            return(result);
        }