예제 #1
0
        public void CreatePayLink()
        {
            payLink.Type                  = PayLinkType.PAYMENT;
            payLink.UsageMode             = PaymentMethodUsageMode.Single;
            payLink.AllowedPaymentMethods = new PaymentMethodName[] { PaymentMethodName.Card };
            payLink.UsageLimit            = 1;
            payLink.Name                  = "Mobile Bill Payment";
            payLink.IsShippable           = true;
            payLink.ShippingAmount        = 1.23m;
            payLink.ExpirationDate        = DateTime.UtcNow.AddDays(10); //date('Y-m-d H:i:s') + 10;
            payLink.Images                = new string[] { "test", "test2", "test3" };
            payLink.ReturnUrl             = "https://www.example.com/returnUrl";
            payLink.StatusUpdateUrl       = "https://www.example.com/statusUrl";
            payLink.CancelUrl             = "https://www.example.com/returnUrl";

            var response = PayLinkService.Create(payLink, AMOUNT)
                           .WithCurrency(CURRENCY)
                           .WithClientTransactionId(GenerationUtils.GenerateRecurringKey())
                           .WithDescription("March and April Invoice")
                           .Execute();

            Assert.AreEqual("SUCCESS", response.ResponseCode);
            Assert.AreEqual(PayLinkStatus.ACTIVE.ToString().ToUpper(), response.ResponseMessage.ToUpper());
            Assert.AreEqual(AMOUNT, response.BalanceAmount);
            Assert.IsNotNull(response.PayLinkResponse.Url);
            Assert.IsNotNull(response.PayLinkResponse.Id);
        }
예제 #2
0
        private string ConvertResponse(JsonDoc request, Transaction trans)
        {
            var merchantId = request.GetValue <string>("MERCHANT_ID");
            var account    = request.GetValue <string>("ACCOUNT");

            // begin building response
            var response = new JsonDoc(JsonEncoders.Base64Encoder);

            response.Set("MERCHANT_ID", merchantId);
            response.Set("ACCOUNT", request.GetValue <string>("ACCOUNT"));
            response.Set("ORDER_ID", trans.OrderId);
            response.Set("TIMESTAMP", trans.Timestamp);
            response.Set("RESULT", trans.ResponseCode);
            response.Set("PASREF", trans.TransactionId);
            response.Set("AUTHCODE", trans.AuthorizationCode);
            response.Set("AVSPOSTCODERESULT", trans.AvsResponseCode);
            response.Set("CVNRESULT", trans.CvnResponseCode);
            response.Set("HPP_LANG", request.GetValue <string>("HPP_LANG"));
            response.Set("SHIPPING_CODE", request.GetValue <string>("SHIPPING_CODE"));
            response.Set("SHIPPING_CO", request.GetValue <string>("SHIPPING_CO"));
            response.Set("BILLING_CODE", request.GetValue <string>("BILLING_CODE"));
            response.Set("BILLING_CO", request.GetValue <string>("BILLING_CO"));
            response.Set("ECI", request.GetValue <string>("ECI"));
            response.Set("CAVV", request.GetValue <string>("CAVV"));
            response.Set("XID", request.GetValue <string>("XID"));
            response.Set("MERCHANT_RESPONSE_URL", request.GetValue <string>("MERCHANT_RESPONSE_URL"));
            response.Set("CARD_PAYMENT_BUTTON", request.GetValue <string>("CARD_PAYMENT_BUTTON"));
            response.Set("MESSAGE", trans.ResponseMessage);
            response.Set("AMOUNT", trans.AuthorizedAmount);
            response.Set("SHA1HASH", GenerationUtils.GenerateHash(_sharedSecret, trans.Timestamp, merchantId, trans.OrderId, trans.ResponseCode, trans.ResponseMessage, trans.TransactionId, trans.AuthorizationCode));

            return(response.ToString());
        }
        public void AdaptNodeOutput1To4PreviewWorks()
        {
            var node   = new TestNode();
            var result = GenerationUtils.AdaptNodeOutputForPreview(node, TestNode.V1Out);

            Assert.AreEqual(string.Format("half4({0}, {0}, {0}, 1.0)", node.GetVariableNameForSlot(TestNode.V1Out)), result);
        }
예제 #4
0
        public bool IsHashValid(string secret)
        {
            bool hashValid = false;

            //check for any null values and set them to empty string for hashing
            string timeStamp         = this.Timestamp ?? string.Empty;
            string merchantId        = this.MerchantId ?? string.Empty;
            string orderId           = this.OrderId ?? string.Empty;
            string result            = this.Result ?? string.Empty;
            string message           = this.Message ?? string.Empty;
            string paymentsReference = this.PaymentsReference ?? string.Empty;
            string authCode          = this.AuthCode ?? string.Empty;

            //create String to hash
            var toHash = new StringBuilder()
                         .Append(timeStamp).Append(".")
                         .Append(merchantId).Append(".")
                         .Append(orderId).Append(".")
                         .Append(result).Append(".")
                         .Append(message).Append(".")
                         .Append(paymentsReference).Append(".")
                         .Append(authCode).ToString();

            //check if calculated hash matches returned value
            string expectedHash = GenerationUtils.GenerateHash(toHash, secret);

            if (expectedHash == this.Hash)
            {
                hashValid = true;
            }

            return(hashValid);
        }
예제 #5
0
        private ILGenerator CreateNonQueryMethod()
        {
            TypeBuilder   typeBuilder   = GenerationUtils.GetTypeBuilder(typeof(IMixedOperations));
            MethodBuilder methodBuilder = typeBuilder.DefineMethod("NonQueryMethod", MethodAttributes.Public, typeof(int), new Type[0]);

            return(methodBuilder.GetILGenerator());
        }
예제 #6
0
        public void CreatePayLink_ThenCharge_WithTokenizedCard()
        {
            var response = PayLinkService.Create(payLink, AMOUNT)
                           .WithCurrency(CURRENCY)
                           .WithClientTransactionId(GenerationUtils.GenerateRecurringKey())
                           .WithDescription("March and April Invoice")
                           .Execute();

            AssertTransactionResponse(response);

            ServicesContainer.ConfigureService(SetupTransactionConfig(), "createTransaction");

            var tokenizedCard = new CreditCardData {
                Token = card.Tokenize("createTransaction")
            };

            var charge = tokenizedCard.Charge(AMOUNT)
                         .WithCurrency(CURRENCY)
                         .WithPaymentLinkId(response.PayLinkResponse.Id)
                         .Execute("createTransaction");

            Assert.IsNotNull(charge);
            Assert.AreEqual(SUCCESS, charge?.ResponseCode);
            Assert.AreEqual(GetMapping(TransactionStatus.Captured), charge?.ResponseMessage);

            Thread.Sleep(2000);

            var getPayLinkById = PayLinkService.PayLinkDetail(response.PayLinkResponse.Id)
                                 .Execute();

            Assert.IsNotNull(getPayLinkById);
            Assert.IsInstanceOfType(getPayLinkById, typeof(PayLinkSummary));
            Assert.AreEqual(response.PayLinkResponse.Id, getPayLinkById.Id);
            Assert.AreEqual(1, getPayLinkById.Transactions.Count);
        }
예제 #7
0
        public ThreeDSecureRequest GenerateHash(string secret)
        {
            string timestamp  = this.Timestamp ?? string.Empty;
            string merchantId = this.MerchantId ?? string.Empty;
            string orderId    = this.OrderId ?? string.Empty;
            string amount     = string.Empty;
            string currency   = string.Empty;

            if (this.Amount != null)
            {
                amount   = this.Amount.Amount == default(long) ? "" : this.Amount.Amount.ToString();
                currency = this.Amount.Currency ?? string.Empty;
            }

            string cardNumber = string.Empty;

            if (this.Card != null)
            {
                cardNumber = this.Card.Number ?? string.Empty;
            }

            string toHash = new StringBuilder()
                            .Append(timestamp).Append(".")
                            .Append(merchantId).Append(".")
                            .Append(orderId).Append(".")
                            .Append(amount).Append(".")
                            .Append(currency).Append(".")
                            .Append(cardNumber).ToString();

            this.Hash = GenerationUtils.GenerateHash(toHash, secret);
            return(this);
        }
예제 #8
0
        public void GenerateClasses_ForEmptyMetadata_Should_GenerateLogicalName()
        {
            // Arrange
            var metadata = new EntityMetadataProxy(new EntityMetadata
            {
                LogicalName = "uber_entity"
            });

            metadata.SetSelected(true);
            var values = new List <EntityMetadataProxy> {
                metadata
            };
            var    settings   = new Settings();
            var    fakeWriter = A.Fake <IConstantFileWriter>();
            string entity     = null;
            var    config     = A.CallTo(() => fakeWriter.WriteBlock(null, null, null))
                                .WithAnyArguments()
                                .Invokes((Settings s, string e, string f) => { entity = e; });

            // Act
            GenerationUtils.GenerateFiles(values, settings, fakeWriter);

            // Assert
            config.MustHaveHappened();
            Assert.IsTrue(entity.Contains("public const string EntityName = \"uber_entity\";"));
        }
        public void AdaptNodeOutput2To4Works()
        {
            var node   = new TestNode();
            var result = GenerationUtils.AdaptNodeOutput(node, TestNode.V2Out, ConcreteSlotValueType.Vector4);

            Assert.AreEqual(string.Format("($precision4({0}, 0.0, 1.0))", node.GetVariableNameForSlot(TestNode.V2Out)), result);
        }
        public void AdaptNodeOutput1To3Works()
        {
            var node   = new TestNode();
            var result = GenerationUtils.AdaptNodeOutput(node, TestNode.V1Out, ConcreteSlotValueType.Vector3);

            Assert.AreEqual(string.Format("({0}.xxx)", node.GetVariableNameForSlot(TestNode.V1Out)), result);
        }
예제 #11
0
        private static void CommonCode(string input)
        {
            AssemblyCompiler compiler = new AssemblyCompiler(input, true);

            compiler.Compile(true);

            Console.WriteLine(GenerationUtils.PrintCodeObject(compiler.CompileUnit));
        }
예제 #12
0
 public void CalculatesSha1HashCorrectlyInMultiThreadedEnvironment()
 {
     Parallel.For(1, 51, (i, state) =>
     {
         var result = GenerationUtils.GenerateHash(DataToHash, HashSecret);
         Assert.AreEqual(ExpectedHashResult, result);
     });
 }
        public void AdaptNodeOutput4To4PreviewWorks()
        {
            var node     = new TestNode();
            var expected = string.Format("half4({0}.x, {0}.y, {0}.z, 1.0)", node.GetVariableNameForSlot(TestNode.V4Out));
            var result   = GenerationUtils.AdaptNodeOutputForPreview(node, TestNode.V4Out);

            Assert.AreEqual(expected, result);
        }
예제 #14
0
        public Transaction ManageTransaction(ManagementBuilder builder)
        {
            var    et              = new ElementTree();
            string timestamp       = GenerationUtils.GenerateTimestamp();
            string orderId         = builder.OrderId ?? GenerationUtils.GenerateOrderId();
            string transactionType = MapManageRequestType(builder.TransactionType);

            // Build Request
            var request = et.Element("request")
                          .Set("timestamp", timestamp)
                          .Set("type", transactionType);

            et.SubElement(request, "merchantid").Text(MerchantId);
            et.SubElement(request, "account", AccountId);
            et.SubElement(request, "channel", Channel);
            et.SubElement(request, "orderid", orderId);
            et.SubElement(request, "pasref", builder.TransactionId);
            if (builder.Amount.HasValue)
            {
                et.SubElement(request, "amount", builder.Amount.ToNumericCurrencyString()).Set("currency", builder.Currency);
            }
            else if (builder.TransactionType == TransactionType.Capture)
            {
                throw new BuilderException("Amount cannot be null for capture.");
            }

            // payer authentication response
            if (builder.TransactionType == TransactionType.VerifySignature)
            {
                et.SubElement(request, "pares", builder.PayerAuthenticationResponse);
            }

            // rebate hash
            if (builder.TransactionType == TransactionType.Refund)
            {
                et.SubElement(request, "authcode").Text(builder.AuthorizationCode);
                et.SubElement(request, "refundhash", GenerationUtils.GenerateHash(RebatePassword ?? string.Empty));
            }

            // reason code
            if (builder.ReasonCode != null)
            {
                et.SubElement(request, "reasoncode").Text(builder.ReasonCode.ToString());
            }

            // TODO: needs to be multiple
            if (builder.Description != null)
            {
                var comments = et.SubElement(request, "comments");
                et.SubElement(comments, "comment", builder.Description).Set("id", "1");
            }

            et.SubElement(request, "sha1hash", GenerationUtils.GenerateHash(SharedSecret, timestamp, MerchantId, orderId, builder.Amount.ToNumericCurrencyString(), builder.Currency, ""));

            var response = DoTransaction(et.ToString(request));

            return(MapResponse(response, MapAcceptedCodes(transactionType)));
        }
예제 #15
0
        private static void CommonCode(string input)
        {
            input = Defaults.DefUsing + input;

            AssemblyCompiler compiler = new AssemblyCompiler(input, true);

            compiler.Compile(true);

            Assert.Pass(GenerationUtils.PrintCodeObject(compiler.CompileUnit));
        }
        bool GenerateShaderPass(ToonMasterNode masterNode, ShaderPass pass, GenerationMode mode, ShaderGenerator result, List <string> sourceAssetDependencyPaths)
        {
            UniversalShaderGraphUtilities.SetRenderState(masterNode.surfaceType, masterNode.alphaMode, masterNode.twoSided.isOn, ref pass);

            // apply master node options to active fields
            var activeFields = GetActiveFieldsFromMasterNode(masterNode, pass);

            return(GenerationUtils.GenerateShaderPass(masterNode, pass, mode, activeFields, result, sourceAssetDependencyPaths,
                                                      UniversalShaderGraphResources.s_Dependencies, UniversalShaderGraphResources.s_ResourceClassName, UniversalShaderGraphResources.s_AssemblyName));
        }
예제 #17
0
        public PaymentRequest GenerateHash(string secret)
        {
            string timestamp  = this.Timestamp ?? string.Empty;
            string merchantId = this.MerchantId ?? string.Empty;
            string orderId    = this.OrderId ?? string.Empty;
            string amount     = string.Empty;
            string currency   = string.Empty;
            string token      = this.Token ?? string.Empty;

            if (this.Amount != null)
            {
                amount   = this.Amount.Amount == default(long) ? string.Empty : this.Amount.Amount.ToString();
                currency = this.Amount.Currency ?? string.Empty;
            }

            string cardNumber = string.Empty;

            if (this.Card != null)
            {
                cardNumber = this.Card.Number ?? string.Empty;
            }

            string toHash = string.Empty;

            if (this.Type == PaymentType.AUTH_MOBILE)
            {
                toHash = new StringBuilder()
                         .Append(timestamp).Append(".")
                         .Append(merchantId).Append(".")
                         .Append(orderId).Append("...")
                         .Append(token).ToString();
            }
            else if (this.Type == PaymentType.OTB)
            {
                toHash = new StringBuilder()
                         .Append(timestamp).Append(".")
                         .Append(merchantId).Append(".")
                         .Append(orderId).Append(".")
                         .Append(cardNumber).ToString();
            }
            else
            {
                toHash = new StringBuilder()
                         .Append(timestamp).Append(".")
                         .Append(merchantId).Append(".")
                         .Append(orderId).Append(".")
                         .Append(amount).Append(".")
                         .Append(currency).Append(".")
                         .Append(cardNumber).ToString();
            }

            this.Hash = GenerationUtils.GenerateHash(toHash, secret);
            return(this);
        }
예제 #18
0
        private string ConvertResponse(JsonDoc request, Transaction trans)
        {
            var merchantId = request.GetValue <string>("MERCHANT_ID");
            var account    = request.GetValue <string>("ACCOUNT");

            // begin building response
            var response = new JsonDoc(JsonEncoders.Base64Encoder);

            response.Set("MERCHANT_ID", merchantId);
            response.Set("ACCOUNT", request.GetValue <string>("ACCOUNT"));
            response.Set("ORDER_ID", trans.OrderId);
            response.Set("TIMESTAMP", trans.Timestamp);
            response.Set("RESULT", trans.ResponseCode);
            response.Set("PASREF", trans.TransactionId);
            response.Set("AUTHCODE", trans.AuthorizationCode);
            response.Set("AVSPOSTCODERESULT", trans.AvsResponseCode);
            response.Set("CVNRESULT", trans.CvnResponseCode);
            response.Set("HPP_LANG", request.GetValue <string>("HPP_LANG"));
            response.Set("SHIPPING_CODE", request.GetValue <string>("SHIPPING_CODE"));
            response.Set("SHIPPING_CO", request.GetValue <string>("SHIPPING_CO"));
            response.Set("BILLING_CODE", request.GetValue <string>("BILLING_CODE"));
            response.Set("BILLING_CO", request.GetValue <string>("BILLING_CO"));
            response.Set("ECI", request.GetValue <string>("ECI"));
            response.Set("CAVV", request.GetValue <string>("CAVV"));
            response.Set("XID", request.GetValue <string>("XID"));
            response.Set("MERCHANT_RESPONSE_URL", request.GetValue <string>("MERCHANT_RESPONSE_URL"));
            response.Set("CARD_PAYMENT_BUTTON", request.GetValue <string>("CARD_PAYMENT_BUTTON"));
            response.Set("MESSAGE", trans.ResponseMessage);
            response.Set("AMOUNT", trans.AuthorizedAmount);
            response.Set("SHA1HASH", GenerationUtils.GenerateHash(_sharedSecret, trans.Timestamp, merchantId, trans.OrderId, trans.ResponseCode, trans.ResponseMessage, trans.TransactionId, trans.AuthorizationCode));
            response.Set("DCC_INFO_REQUST", request.GetValue <string>("DCC_INFO"));
            response.Set("HPP_FRAUDFILTER_MODE", request.GetValue <string>("HPP_FRAUDFILTER_MODE"));
            if (trans?.FraudResponse?.Rules != null)
            {
                response.Set("HPP_FRAUDFILTER_RESULT", trans.FraudResponse?.Result);

                foreach (var rule in trans.FraudResponse.Rules)
                {
                    response.Set("HPP_FRAUDFILTER_RULE_" + rule.Id, rule.Action);
                }
            }
            if (trans?.AlternativePaymentResponse != null)
            {
                AlternativePaymentResponse alternativePaymentResponse = trans.AlternativePaymentResponse;
                response.Set("HPP_CUSTOMER_FIRSTNAME", request.GetValue <string>("HPP_CUSTOMER_FIRSTNAME"));
                response.Set("HPP_CUSTOMER_LASTNAME", request.GetValue <string>("HPP_CUSTOMER_LASTNAME"));
                response.Set("HPP_CUSTOMER_COUNTRY", request.GetValue <string>("HPP_CUSTOMER_COUNTRY"));
                response.Set("PAYMENTMETHOD", alternativePaymentResponse.ProviderName);
                response.Set("PAYMENTPURPOSE", alternativePaymentResponse.PaymentPurpose);
                response.Set("HPP_CUSTOMER_BANK_ACCOUNT", alternativePaymentResponse.BankAccount);
            }

            return(response.ToString());
        }
 public async Task RevertGen()
 {
     if (await GenerationUtils.RevertGenerationAsync())
     {
         await BotUtils.ReplyAsync_Success(Context, string.Format("Successfully set generation back to **{0}**.", (await GenerationUtils.GetCurrentGenerationAsync()).Name));
     }
     else
     {
         await BotUtils.ReplyAsync_Warning(Context, "The current generation cannot be reverted further.");
     }
 }
예제 #20
0
        private static bool GenerateShaderPass(SGEUnlitMasterNode masterNode, ShaderPass pass, GenerationMode mode, ShaderGenerator result, List <string> sourceAssetDependencyPaths)
        {
            var options = masterNode.GetMaterialOptions();

            SGEShaderGraphUtilities.SetRenderState(options, ref pass);

            // apply master node options to active fields
            var activeFields = GetActiveFieldsFromMasterNode(masterNode, pass);

            // use standard shader pass generation
            return(GenerationUtils.GenerateShaderPass(masterNode, pass, mode, activeFields, result, sourceAssetDependencyPaths,
                                                      SGEShaderGraphResources.s_Dependencies, SGEShaderGraphResources.s_ResourceClassName, SGEShaderGraphResources.s_AssemblyName));
        }
예제 #21
0
 /// <summary>
 /// Get the request ready to send
 /// </summary>
 /// <param name="secret"></param>
 public void Prepare(string secret)
 {
     if (string.IsNullOrEmpty(Timestamp))
     {
         Timestamp = GenerationUtils.GenerateTimestamp();
     }
     if (string.IsNullOrEmpty(OrderID))
     {
         OrderID = GenerationUtils.GenerateOrderId();
     }
     InitHash(secret);
     IsReady = true;
 }
예제 #22
0
        public void CreatePayLink_MissingShippable()
        {
            payLink.IsShippable = null;

            var response = PayLinkService.Create(payLink, AMOUNT)
                           .WithCurrency(CURRENCY)
                           .WithClientTransactionId(GenerationUtils.GenerateRecurringKey())
                           .WithDescription("March and April Invoice")
                           .Execute();

            AssertTransactionResponse(response);
            Assert.IsFalse(response.PayLinkResponse.IsShippable != null && response.PayLinkResponse.IsShippable.Value);
        }
예제 #23
0
        public void FullCycleWithNoMerchantData()
        {
            var card = new CreditCardData {
                Number         = "4012001037141112",
                ExpMonth       = 12,
                ExpYear        = 2025,
                CardHolderName = "John Smith"
            };

            var amount   = 10m;
            var currency = "USD";
            var orderId  = GenerationUtils.GenerateOrderId();

            var enrolled = card.VerifyEnrolled(amount, currency, orderId);

            if (enrolled)
            {
                var secureEcom = card.ThreeDSecure;
                if (secureEcom != null)
                {
                    // authenticate
                    var    authClient   = new ThreeDSecureAcsClient(secureEcom.IssuerAcsUrl);
                    var    authResponse = authClient.Authenticate(secureEcom.PayerAuthenticationRequest, secureEcom.MerchantData.ToString());
                    string payerAuthenticationResponse = authResponse.pares;
                    string md = authResponse.md;

                    // verify signature
                    if (card.VerifySignature(payerAuthenticationResponse, amount, currency, orderId))
                    {
                        var response = card.Charge(amount)
                                       .WithCurrency(currency)
                                       .WithOrderId(orderId)
                                       .Execute();
                        Assert.IsNotNull(response);
                        Assert.AreEqual("00", response.ResponseCode);
                    }
                    else
                    {
                        Assert.Fail("Signature verification failed.");
                    }
                }
                else
                {
                    Assert.Fail("Secure3Data was null.");
                }
            }
            else
            {
                Assert.Fail("Card not enrolled.");
            }
        }
예제 #24
0
        public void CreatePayLink_MultipleUsage()
        {
            payLink.UsageMode  = PaymentMethodUsageMode.Multiple;
            payLink.UsageLimit = 2;

            var response = PayLinkService.Create(payLink, AMOUNT)
                           .WithCurrency(CURRENCY)
                           .WithClientTransactionId(GenerationUtils.GenerateRecurringKey())
                           .WithDescription("March and April Invoice")
                           .Execute();

            AssertTransactionResponse(response);
            Assert.AreEqual(2, response.PayLinkResponse.UsageLimit);
        }
        private string GenerateHash(string secret)
        {
            var hashFields = new List <string>();

            hashFields.AddRange(new string[]
            {
                Timestamp, MerchantID, OrderID, Result, Message, PASRef, AuthCode
            });

            // Join the fields with . separator and hash it
            var toHash = string.Join(".", hashFields);

            return(GenerationUtils.GenerateHash(toHash, secret));
        }
예제 #26
0
        public Transaction ParseResponse(string json, bool encoded = false)
        {
            var response = JsonDoc.Parse(json, encoded ? JsonEncoders.Base64Encoder : null);

            var timestamp     = response.GetValue <string>("TIMESTAMP");
            var merchantId    = response.GetValue <string>("MERCHANT_ID");
            var orderId       = response.GetValue <string>("ORDER_ID");
            var result        = response.GetValue <string>("RESULT");
            var message       = response.GetValue <string>("MESSAGE");
            var transactionId = response.GetValue <string>("PASREF");
            var authCode      = response.GetValue <string>("AUTHCODE");

            var sha1Hash = response.GetValue <string>("SHA1HASH");
            var hash     = GenerationUtils.GenerateHash(_config.SharedSecret, timestamp, merchantId, orderId, result, message, transactionId, authCode);

            if (!hash.Equals(sha1Hash))
            {
                throw new ApiException("Incorrect hash. Please check your code and the Developers Documentation.");
            }

            // remainder of the values
            var rvalues = new Dictionary <string, string>();

            foreach (var key in response.Keys)
            {
                var value = response.GetValue <string>(key);
                if (value != null)
                {
                    rvalues.Add(key, value);
                }
            }

            return(new Transaction {
                AuthorizedAmount = response.GetValue <decimal>("AMOUNT"),
                AutoSettleFlag = response.GetValue <string>("AUTO_SETTLE_FLAG"),
                CvnResponseCode = response.GetValue <string>("CVNRESULT"),
                ResponseCode = result,
                ResponseMessage = message,
                AvsResponseCode = response.GetValue <string>("AVSPOSTCODERESULT"),
                Timestamp = timestamp,
                TransactionReference = new TransactionReference {
                    AuthCode = authCode,
                    OrderId = orderId,
                    PaymentMethodType = PaymentMethodType.Credit,
                    TransactionId = transactionId
                },
                ResponseValues = rvalues
            });
        }
예제 #27
0
        public PaymentRequest GenerateDefaults(string secret)
        {
            if (Timestamp == null)
            {
                Timestamp = GenerationUtils.GenerateTimestamp();
            }

            if (OrderId == null)
            {
                OrderId = GenerationUtils.GenerateOrderId();
            }

            GenerateHash(secret);

            return(this);
        }
예제 #28
0
파일: LCGHelper.cs 프로젝트: rappen/LCG-UDG
        public void GenerateConstants()
        {
            // ToDo: Load CommonSettings
            LoadEntities();
            RestoreSelectedEntities();
            var writer = Settings.GetWriter(this.crmConnection.WebApplicationUrl);

            if (GenerationUtils.GenerateFiles(entities, Settings, writer))
            {
                Console.Write(writer.GetResult(Settings));
            }
            else
            {
                Console.WriteLine("Error");
            }
        }
예제 #29
0
        public ThreeDSecureRequest GenerateDefaults(string secret)
        {
            if (this.Timestamp == null)
            {
                this.Timestamp = GenerationUtils.GenerateTimestamp();
            }

            if (this.OrderId == null)
            {
                this.OrderId = GenerationUtils.GenerateOrderId();
            }

            GenerateHash(secret);

            return(this);
        }
예제 #30
0
        public void CreatePayLink_MissingDescription()
        {
            var exceptionCaught = false;

            try {
                PayLinkService.Create(payLink, AMOUNT)
                .WithCurrency(CURRENCY)
                .WithClientTransactionId(GenerationUtils.GenerateRecurringKey())
                .Execute();
            }
            catch (GatewayException e) {
                exceptionCaught = true;
                Assert.AreEqual("40005", e.ResponseMessage);
                Assert.AreEqual("Status Code: BadRequest - Request expects the following field description", e.Message);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }