public void GivenSHA1AndSomeInputVariables_WhenICallGetStringToHash_ThenItGeneratesCorrectly2()
        {
            string hashDigest = HashDigestFactory.GetStringToHash(_formValues,
                                                                  "WwUbLs5oGMQqZVVHvw4XgxMefcWE2TXfW5zEUP/tzIqf+iBm5iUn85+sBkTeK3NFfrjVmzRHqTkR91oOesJR", "1q2aW3zSe4");

            Assert.That(hashDigest,
                        Is.EqualTo(
                            "PreSharedKey=WwUbLs5oGMQqZVVHvw4XgxMefcWE2TXfW5zEUP/tzIqf+iBm5iUn85+sBkTeK3NFfrjVmzRHqTkR91oOesJR&MerchantID=Test-2994724&Password=1q2aW3zSe4&Amount=100&CurrencyCode=826&EchoAVSCheckResult=&EchoCV2CheckResult=&EchoThreeDSecureAuthenticationCheckResult=&EchoFraudProtectionCheckResult=&EchoCardType=&EchoCardNumberFirstSix=&EchoCardNumberLastFour=&EchoCardExpiryDate=&EchoDonationAmount=&AVSOverridePolicy=EFFF&CV2OverridePolicy=FF&ThreeDSecureOverridePolicy=&OrderID=109j98nm9ij98v8v8v7-123dcvgff&TransactionType=SALE&TransactionDateTime=2018-02-03 14:15:00 +01:00&DisplayCancelButton=&CallbackURL=https://www.google.com/orders/109j98nm9ij98v8v8v7-123dcvgff&OrderDescription=Sale of Chilled Meat Products&LineItemSalesTaxAmount=&LineItemSalesTaxDescription=&LineItemQuantity=&LineItemAmount=&LineItemDescription=&CustomerName=&DisplayBillingAddress=&Address1=&Address2=&Address3=&Address4=&City=&State=&PostCode=&CountryCode=&EmailAddress=&PhoneNumber=&DateOfBirth=&DisplayShippingDetails=&ShippingName=&ShippingAddress1=&ShippingAddress2=&ShippingAddress3=&ShippingAddress4=&ShippingCity=&ShippingState=&ShippingPostCode=&ShippingCountryCode=&ShippingEmailAddress=&ShippingPhoneNumber=&CustomerNameEditable=&EmailAddressEditable=&PhoneNumberEditable=&DateOfBirthEditable=&CV2Mandatory=true&Address1Mandatory=true&CityMandatory=true&PostCodeMandatory=true&StateMandatory=true&CountryMandatory=true&ShippingAddress1Mandatory=&ShippingCityMandatory=&ShippingPostCodeMandatory=&ShippingStateMandatory=&ShippingCountryMandatory=&ResultDeliveryMethod=SERVER&ServerResultURL=https://www.google.com/confirmpayment&PaymentFormDisplaysResult=false&ServerResultURLCookieVariables=&ServerResultURLFormVariables=&ServerResultURLQueryStringVariables=&PrimaryAccountName=&PrimaryAccountNumber=&PrimaryAccountDateOfBirth=&PrimaryAccountPostCode=&Skin=&PaymentFormContentMode=&BreakoutOfIFrameOnCallback="));
        }
        public string GivenSHA1AndSomeInputVariables_WhenICallGetStringToHash_ThenItGeneratesCorrectly(
            string merchantId, int amount, int currencyCode, string orderId, string password, string preSharedKey
            )
        {
            Dictionary <string, object> formValues = new Dictionary <string, object>
            {
                { "MerchantID", merchantId },
                { "Amount", amount },
                { "CurrencyCode", currencyCode },
                { "OrderID", orderId }
            };

            string hashDigest = HashDigestFactory.GetStringToHash(formValues, preSharedKey, password);

            return(hashDigest);
        }
 public void Setup()
 {
     _hashDigestFactory = new HashDigestFactory();
 }
Ejemplo n.º 4
0
 public OrdersController(IOptions <ServerSettings> serverSettings)
 {
     _serverUrl         = serverSettings.Value.Url;
     _hashDigestFactory = new HashDigestFactory();
 }