public void DuplicatedOrder_BuyNow() { BAPoints point = new BAPoints(); point.Identifier = "174IG322ASL4JBRAQQHNDPM3H2FTMFLNQ8I"; point.Profile = profile; point.ImportedDate = DateTime.UtcNow; insertToDatabase(point); NameValueCollection requestData = new NameValueCollection(); requestData.Add("buyerEmail", "*****@*****.**"); requestData.Add("transactionId", "174IG322ASL4JBRAQQHNDPM3H2FTMFLNQ8I"); requestData.Add("status", "PS"); requestData.Add("transactionAmount", "USD 5.000000"); requestData.Add("paymentReason", "BAPoints_30"); requestData.Add("operation", "pay"); requestData.Add("referenceId", profile.GlobalId.ToString()); requestData.Add("signatureVersion", "2"); requestData.Add("certificateUrl", "https://fps.sandbox.amazonaws.com/certs/090911/PKICert.pem%3frequestId%3d15n8qoapsoddqfe380kvbpmb4h0cy47zhl9n1f1tv07aofo"); requestData.Add("paymentMethod", "CC"); requestData.Add("signatureMethod", "RSA-SHA1"); requestData.Add("recipientEmail", "*****@*****.**"); requestData.Add("transactionDate", "1344945621"); requestData.Add("buyerName", "Darth Vader"); requestData.Add("signature", "pHaRbT6UjbHEykNhatobDr8TVVTRdrAM2Xr3mRzTgEbeWk8flESxznXO4EfDDiM5b0u0YLeJoJTj%0ar6hihivc1bZqMZ6XuBTS/qWK/aO6KHzGUVtAEwWt1mCtLaJBdxlJrrO86F/GkYmg9mBwQw9847gl%0abyDetj1ntIa%2bHS8RN4M%3d"); var handler = new TestableAmazonHandler(manager, "*****@*****.**"); handler.AmazonResponse = true; var serviceSession = sessionFactory.OpenSession(); using (serviceSession) { try { handler.ProcessOrderRequest(serviceSession, requestData, null); Assert.Fail(); } catch (UniqueException) { } } Session.Clear(); var baPoints = Session.QueryOver <BAPoints>().RowCount(); Assert.AreEqual(1, baPoints); }
public void CompletedOrder_BuyNow() { NameValueCollection requestData = new NameValueCollection(); requestData.Add("buyerEmail", "*****@*****.**"); requestData.Add("transactionId", "174IG322ASL4JBRAQQHNDPM3H2FTMFLNQ8I"); requestData.Add("status", "PS"); requestData.Add("transactionAmount", "USD 5.000000"); requestData.Add("paymentReason", "BAPoints_30"); requestData.Add("operation", "pay"); requestData.Add("referenceId", profile.GlobalId.ToString()); requestData.Add("signatureVersion", "2"); requestData.Add("certificateUrl", "https://fps.sandbox.amazonaws.com/certs/090911/PKICert.pem%3frequestId%3d15n8qoapsoddqfe380kvbpmb4h0cy47zhl9n1f1tv07aofo"); requestData.Add("paymentMethod", "CC"); requestData.Add("signatureMethod", "RSA-SHA1"); requestData.Add("recipientEmail", "*****@*****.**"); requestData.Add("transactionDate", "1344945621"); requestData.Add("buyerName", "Darth Vader"); requestData.Add("signature", "pHaRbT6UjbHEykNhatobDr8TVVTRdrAM2Xr3mRzTgEbeWk8flESxznXO4EfDDiM5b0u0YLeJoJTj%0ar6hihivc1bZqMZ6XuBTS/qWK/aO6KHzGUVtAEwWt1mCtLaJBdxlJrrO86F/GkYmg9mBwQw9847gl%0abyDetj1ntIa%2bHS8RN4M%3d"); var handler = new TestableAmazonHandler(manager, "*****@*****.**"); handler.AmazonResponse = true; var serviceSession = sessionFactory.OpenSession(); using (serviceSession) { handler.ProcessOrderRequest(serviceSession, requestData, null); } Session.Clear(); var dbProfile = Session.Get <Profile>(profile.GlobalId); Assert.AreEqual(30, dbProfile.Licence.BAPoints); Assert.AreEqual(DateTime.MinValue, dbProfile.Licence.LastPointOperationDate); var baPoints = Session.QueryOver <BAPoints>().SingleOrDefault(); Assert.AreEqual(30, baPoints.Points); Assert.AreEqual(dbProfile.GlobalId, baPoints.Profile.GlobalId); Assert.AreEqual(requestData["transactionId"], baPoints.Identifier); Assert.AreEqual(BAPointsType.PayPal, baPoints.Type); }