public async Task <IActionResult> PutPaymentCard(Guid id, PaymentCard paymentCard) { if (id != paymentCard.PaymentCardId) { return(BadRequest()); } _context.Entry(paymentCard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentCardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void TestIsValidExp() { string sValidExp = "", sMonth = ""; if (DateTime.Now.Month < 10) { sMonth = "0" + DateTime.Now.Month.ToString(); } else { sMonth = DateTime.Now.Month.ToString(); } sValidExp = sMonth + (DateTime.Now.Year - 1999).ToString(); Assert.IsTrue(PaymentCard.IsValidExp(sValidExp)); Assert.IsFalse(PaymentCard.IsValidExp(null)); Assert.IsFalse(PaymentCard.IsValidExp("")); Assert.IsFalse(PaymentCard.IsValidExp("111")); Assert.IsFalse(PaymentCard.IsValidExp("11111")); Assert.IsFalse(PaymentCard.IsValidExp("0000")); Assert.IsFalse(PaymentCard.IsValidExp("0101")); Assert.IsFalse(PaymentCard.IsValidExp("1320")); Assert.IsFalse(PaymentCard.IsValidExp(sMonth + (DateTime.Now.Year - 2001).ToString())); } // TestIsValidExp
public void AddMoneyToCard(PaymentCard card, double sum) { // ... money = money + sum; card.AddMoney(sum); }
public async Task <ActionResult <bool> > PostPaymentCard(PaymentCard paymentCard) { _context.PaymentCards.Add(paymentCard); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPaymentCard", new { id = paymentCard.PaymentCardId }, paymentCard)); }
public async Task <string> InsertStripeCardToCustomer(PaymentCard paymentCard, string stripeuserId) { FullAPIUri = new Uri(BaseAPIUri, $"{nameof(InsertStripeCardToCustomer)}/{stripeuserId}"); var serializeObj = JsonConvert .SerializeObject(paymentCard, Formatting.Indented, new JsonSerializerSettings { //ContractResolver = new JsonPrivateResolver(), ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, NullValueHandling = NullValueHandling.Include }); var buffer = System.Text.Encoding.UTF8.GetBytes(serializeObj); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); var response = await HttpClient.PostAsync(FullAPIUri, byteContent); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsStringAsync()); } else { return(string.Empty); } }
public void Should_Initialize_Threeds_With_Card_Token() { CreateConnectThreeDSInitializeRequest request = new CreateConnectThreeDSInitializeRequest(); request.Locale = Locale.TR.GetName(); request.ConversationId = "123456789"; request.BuyerEmail = "*****@*****.**"; request.BuyerId = "B2323"; request.BuyerIp = "127.0.0.1"; request.ConnectorName = "connector name"; request.Installment = 1; request.PaidPrice = "1.0"; request.Price = "1.0"; request.CallbackUrl = "https://www.merchant.com/callbackUrl"; PaymentCard paymentCard = new PaymentCard(); paymentCard.CardToken = "card token"; paymentCard.CardUserKey = "card user key"; request.PaymentCard = paymentCard; ConnectThreeDSInitialize connectThreeDSInitialize = ConnectThreeDSInitialize.Create(request, options); PrintResponse <ConnectThreeDSInitialize>(connectThreeDSInitialize); Assert.IsNotNull(connectThreeDSInitialize.SystemTime); Assert.AreEqual(Status.SUCCESS.ToString(), connectThreeDSInitialize.Status); Assert.AreEqual(Locale.TR.GetName(), connectThreeDSInitialize.Locale); Assert.AreEqual("123456789", connectThreeDSInitialize.ConversationId); }
public void TestEatLunchFromCardBooleanTrue() { PaymentTerminal terminal = new PaymentTerminal(); PaymentCard card = new PaymentCard(11); Assert.AreEqual(true, terminal.EatLunch(card), "Buying coffee should return true if balance is enough"); }
public void DeepCopyTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 6, 1, 82, 93, 102, 11, 12, 13, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xaa, 0xf5, 0xf6, 0xbb, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); string title = "Bank of Dragon"; PaymentCard paymentCard = new PaymentCard(title, "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, "does not matter", skaAES_CTR, derivedKey); // Act PaymentCardSecret paymentCardSecretCopy = new PaymentCardSecret(paymentCardSecret); string paymentCardTitle = paymentCardSecretCopy.GetTitle(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(paymentCardTitle)); Assert.AreEqual(title, paymentCardTitle); Assert.AreNotSame(paymentCardSecret.audalfData, paymentCardSecretCopy.audalfData, "AUDALF byte arrays should be in different memory locations"); CollectionAssert.AreEqual(paymentCardSecret.keyIdentifier, paymentCardSecretCopy.keyIdentifier); Assert.AreNotSame(paymentCardSecret.keyIdentifier, paymentCardSecretCopy.keyIdentifier, "Key identifier byte arrays should be in different memory locations"); Assert.AreEqual(paymentCardSecret.checksum, paymentCardSecretCopy.checksum); }
public void ChecksumSurvivesRoundtrip() { // Arrange byte[] derivedKey = new byte[16] { 15, 200, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xf3, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); PaymentCard paymentCard = new PaymentCard("Bank of Dragon", "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, "does not matter", skaAES_CTR, derivedKey); // Act string checksum1 = paymentCardSecret.GetChecksumAsHex(); string json = JsonConvert.SerializeObject(paymentCardSecret, Formatting.Indented); PaymentCardSecret paymentCardSecret2 = JsonConvert.DeserializeObject <PaymentCardSecret>(json); // Assert Assert.AreEqual(64, checksum1.Length); Assert.AreEqual(checksum1, paymentCardSecret2.GetChecksumAsHex()); }
public IHttpActionResult Put(int id, [FromBody] PaymentCardVM item) { if (item is null) { return(BadRequest(ErrorMsg.ItemDoesNotExist(TypeOfItems.PaymentCard))); } if (id != item.Id) { return(BadRequest(ErrorMsg.InvalidIdMatchingWith(TypeOfItems.PaymentCard))); } if (id <= 0) { return(BadRequest(ErrorMsg.InvalidId)); } var isModelValid = item.IsModelValid(); if (!string.IsNullOrEmpty(isModelValid)) { return(BadRequest(isModelValid)); } string userId = User.Identity.GetUserId(); PaymentCard cardToBeModified = db.PaymentCards.FirstOrDefault(w => w.Id == id && w.UserId == userId); if (cardToBeModified is null) { return(BadRequest(ErrorMsg.ItemNotFound(TypeOfItems.PaymentCard))); } cardToBeModified.ModifyTo(item); db.SaveChanges(); return(Ok()); }
public void CanBeDecryptedWithDerivedPassword() { byte[] derivedKey1 = new byte[16] { 11, 222, 31, 47, 75, 168, 78, 13, 61, 118, 221, 18, 213, 104, 15, 16 }; byte[] derivedKey2 = new byte[16] { 11, 222, 31, 47, 75, 168, 78, 13, 61, 118, 221, 18, 213, 104, 15, 15 }; byte[] initialCounter = new byte[] { 0xa7, 0xb1, 0xcb, 0xcd, 0xaa, 0xc5, 0xd3, 0xb5, 0x58, 0x51, 0x95, 0x2b, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 256, settingsAES_CTR); string keyIdentifier = "primary"; PaymentCard paymentCard = new PaymentCard("Bank of Dragon", "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); // Act PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, keyIdentifier, skaAES_CTR, derivedKey1); // Assert Assert.IsTrue(paymentCardSecret.CanBeDecryptedWithDerivedPassword(derivedKey1)); Assert.IsFalse(paymentCardSecret.CanBeDecryptedWithDerivedPassword(null)); Assert.IsFalse(paymentCardSecret.CanBeDecryptedWithDerivedPassword(new byte[] {})); Assert.IsFalse(paymentCardSecret.CanBeDecryptedWithDerivedPassword(derivedKey2)); }
public void Should_Pay_With_Card_token() { CreateConnectPaymentRequest request = new CreateConnectPaymentRequest(); request.Locale = Locale.TR.GetName(); request.ConversationId = "123456789"; request.BuyerEmail = "*****@*****.**"; request.BuyerId = "B2323"; request.BuyerIp = "127.0.0.1"; request.ConnectorName = "ISBANK"; request.Installment = 1; request.PaidPrice = "1.0"; request.Price = "1.0"; PaymentCard paymentCard = new PaymentCard(); paymentCard.CardToken = "cardToken"; paymentCard.CardUserKey = "cardUserKey"; request.PaymentCard = paymentCard; ConnectPaymentAuth connectPaymentAuth = ConnectPaymentAuth.Create(request, options); PrintResponse <ConnectPaymentAuth>(connectPaymentAuth); Assert.IsNotNull(connectPaymentAuth.SystemTime); Assert.AreEqual(Status.SUCCESS.ToString(), connectPaymentAuth.Status); Assert.AreEqual(Locale.TR.GetName(), connectPaymentAuth.Locale); Assert.AreEqual("123456789", connectPaymentAuth.ConversationId); }
public void PaymentCard_ShouldInitialiseCorrectly() { var card = new PaymentCard(); Assert.Equal(0, card.Balance); Assert.IsType <Guid>(card.AccountNumber); }
public bool Add(PaymentCard paymentCard) { NullCheck(paymentCard); NullCheck(paymentCard.Number); EmptyStringCheck(paymentCard.Number); //ToDo проверка формата номера карты NullCheck(paymentCard.FirstName); EmptyStringCheck(paymentCard.FirstName); paymentCard.FirstName = paymentCard.FirstName.ToUpper(); NullCheck(paymentCard.LastName); EmptyStringCheck(paymentCard.LastName); paymentCard.LastName = paymentCard.LastName.ToUpper(); //ToDo проверка формата имени-фамилии NegativeZeroSByteCheck(paymentCard.ExpirationMonth); NegativeZeroSByteCheck(paymentCard.ExpirationYear); //ToDo проверка месяца-года истечения карты NegativeZeroSByteCheck(paymentCard.VerificationValue); return(paymentCardDao.Add(paymentCard)); }
/// <summary> /// 获取电话卡用户基本信息 /// </summary> /// <param name="iPort">COM口号</param> /// <param name="bSection">扇区号</param> /// <returns></returns> public static PaymentCard GetUserBasicInfos(int iPort, byte bSection) { PaymentCard payCard = new PaymentCard(); Dictionary <byte, List <byte> > dicSection = EquipmentGeneral.GetCardSectionPieceList(); try { string strReturn = ReadCard(iPort, dicSection[bSection][1].ToString(), 2); if (strReturn.Length != 64) { if (strReturn.Length > 64) { strReturn = strReturn.Substring(0, 64); } else { return(null); } } //PaymentCard l_objCardInfo = new PaymentCard(); //解读第一块信息 EncodeBlock1(strReturn.Substring(0, 32), payCard); //解读第二块信息 EncodeBlock2(strReturn.Substring(32, 32), payCard); } catch (Exception ex) { throw ex; } return(payCard); }
/// <summary> /// 解读第一块信息 /// </summary> /// <param name="p_strCode">16进制信息</param> /// <param name="p_objCardInfo">卡</param> private static void EncodeBlock1(string p_strCode, PaymentCard p_objCardInfo) { //取得块1数据 string l_strTemp = p_strCode.Substring(0, 6); var l_arrTemp = l_strTemp.ToCharArray(); //取得卡号 p_objCardInfo.No = Convert.ToInt32(l_arrTemp[5].ToString() + l_arrTemp[2].ToString() + l_arrTemp[3].ToString() + l_arrTemp[0].ToString() + l_arrTemp[1].ToString(), 16); //取得状态 p_objCardInfo.Valid = l_arrTemp[4] == '8' ? true : false; //取得有效时间 l_strTemp = p_strCode.Substring(6, 6); p_objCardInfo.ExpiryDate = DateTime.ParseExact("20" + l_strTemp, "yyyyMMdd", null); //取得系统功能 //l_strTemp = Convert.ToString(Convert.ToInt32(p_strCode.Substring(12, 4), 16), 2); //p_objCardInfo.FunctionCode = ("0000000000000000").Substring(0, 16 - l_strTemp.Length) + l_strTemp; //p_objCardInfo.FunctionCode = p_strCode.Substring(12, 4); p_objCardInfo.FunctionCode = Convert.ToString(Convert.ToInt32(p_strCode.Substring(12, 4), 16), 2).PadLeft(16, '0'); //取得持卡人姓名 l_strTemp = p_strCode.Substring(16, 16); p_objCardInfo.Name = EquipmentGeneral.HexToStr(l_strTemp); }
/// <summary> /// 写卡片基本信息 /// </summary> /// <param name="p_intPort"></param> /// <param name="p_objCard"></param> /// <returns></returns> public static bool WriteCardInfo(int p_intPort, PaymentCard p_objCard) { bool lUserValid = p_objCard.Valid; string l_strCarNo = CardNoToHex(p_objCard.No, lUserValid); string l_strDate = p_objCard.ExpiryDate.Value.ToString("yyMMdd"); string l_strName = GetNameCode(p_objCard.Name); string l_strData = l_strCarNo + l_strDate + p_objCard.FunctionCode + l_strName; //string l_strMoneyLimit = EquipmentGeneral.IntToHex(int.Parse((p_objCard.LimitRemainder * 100).ToString()), 8); //string l_strMaxPayment = EquipmentGeneral.IntToHex(int.Parse((p_objCard.DailyMaxPayment * 100).ToString()), 8); string l_strMoneyLimit = EquipmentGeneral.IntToHex((int)(p_objCard.LimitRemainder * 100), 8); string l_strMaxPayment = EquipmentGeneral.IntToHex((int)(p_objCard.DailyMaxPayment * 100), 8); string l_strPaymentCount = EquipmentGeneral.IntToHex(p_objCard.Span1PaymentCount) + EquipmentGeneral.IntToHex(p_objCard.Span2PaymentCount) + EquipmentGeneral.IntToHex(p_objCard.Span3PaymentCount) + EquipmentGeneral.IntToHex(p_objCard.Span4PaymentCount); string l_strType = EquipmentGeneral.IntToHex(Convert.ToInt32(char.Parse(p_objCard.Type))); l_strData = l_strData + l_strMoneyLimit + p_objCard.PaymentPassword + l_strMaxPayment + l_strPaymentCount + l_strType; byte bSection = 0; WriteCard(p_intPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][1].ToString(), 2, l_strData); bSection = 1; CleanCardMoney(p_intPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0]); AddCardMoney(p_intPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0], (int)(p_objCard.Money * 100)); bSection = 2; CleanCardMoney(p_intPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0]); AddCardMoney(p_intPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0], (int)(p_objCard.Subsidize * 100)); return(true); }
public ActionResult Edit(NewPaymentViewModel viewModel) { PaymentCard paymentCard = new PaymentCard(); using (SussexDBEntities db = new SussexDBEntities()) { if (viewModel.PaymentCardId != 0) { paymentCard = db.PaymentCards.Where(w => w.PaymentCardId == viewModel.PaymentCardId).FirstOrDefault(); } paymentCard.PaymentCardIsDefault = true; paymentCard.PaymentCardHolderName = viewModel.PaymentCardHolderName; paymentCard.PaymentCardNumber = viewModel.PaymentCardNumber; paymentCard.PaymentCardExpireDate = viewModel.PaymentCardExpireDate; paymentCard.PaymentCardSecurityCode = viewModel.PaymentCardSecurityCode; paymentCard.UserId = viewModel.UserId; if (viewModel.PaymentCardId == 0) { db.PaymentCards.Add(paymentCard); } db.SaveChanges(); } return(Redirect(viewModel.ReturnUrl)); }
public void GetModificationTimeTest() { // Arrange byte[] derivedKey = new byte[16] { 15, 200, 3, 4, 15, 6, 7, 8, 9, 10, 11, 112, 139, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xf3, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); PaymentCard paymentCard = new PaymentCard("Bank of Dragon", "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, "does not matter", skaAES_CTR, derivedKey); // Act DateTimeOffset modificationTime1 = paymentCardSecret.GetModificationTime(derivedKey); Thread.Sleep(1100); paymentCardSecret.SetTitle("1234567", derivedKey); DateTimeOffset modificationTime2 = paymentCardSecret.GetModificationTime(derivedKey); // Assert Assert.Greater(modificationTime2, modificationTime1); }
public static Validator CreditCardCheckerRule(PaymentCard paymentCard) { if (!string.IsNullOrEmpty(paymentCard.HolderName) && !string.IsNullOrEmpty(paymentCard.CardNumber) && !string.IsNullOrEmpty(paymentCard.Month) && !string.IsNullOrEmpty(paymentCard.Year) && !string.IsNullOrEmpty(paymentCard.Cvc)) { if (paymentCard.CardNumber.Length >= 15 && paymentCard.CardNumber.Length <= 16) { if ((paymentCard.CardNumber.Length == 16 && paymentCard.Cvc.Length == 3) || (paymentCard.CardNumber.Length == 15 && paymentCard.Cvc.Length == 4)) { return(new Validator()); } else { return(new Validator() { HasError = true, ErrorMessage = "Card Number is in incorrect format check the card digits or the CVC , to continue." }); } } else { return(new Validator() { HasError = true, ErrorMessage = "Card number are invalid. Check again." }); } } else { return(new Validator() { HasError = true, ErrorMessage = "Values are empty." }); } }
public void SetPaymentCardTitleTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; SymmetricKeyAlgorithm ska = SymmetricKeyAlgorithm.GenerateNew(SymmetricEncryptionAlgorithm.AES_CTR); PaymentCard paymentCard = new PaymentCard("Bank of Dragon", "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, "does not matter", ska, derivedKey); string title = "future text that is happy and joyful for all holiday purposes..."; // Act bool shouldBeTrue = paymentCardSecret.SetTitle(title, derivedKey); string titleAfterModification = paymentCardSecret.GetTitle(derivedKey); bool shouldBeFalse = paymentCardSecret.SetTitle(title, new byte[] { 1, 2, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(titleAfterModification)); Assert.AreEqual(title, titleAfterModification); }
public void DoCardCheckout() { const string Otp = "1234"; var transactionId = "id"; const string ProductName = "awesomeproduct"; const string CurrencyCode = "NGN"; const decimal Amount = 7500.50M; const string Narration = "Buy Aluku Records"; var metadata = new Dictionary <string, string> { { "Parent Company", "Offering Records" }, { "C.E.O", "Boddhi Satva" } }; const short CardCvv = 123; const string CardNum = "123456789012345"; const string CountryCode = "NG"; const string CardPin = "1234"; const int ValidTillMonth = 9; const int ValidTillYear = 2019; var cardDetails = new PaymentCard(CardPin, CountryCode, CardCvv, ValidTillMonth, ValidTillYear, CardNum); CardCheckoutResults checkout = _atGWInstance.CardCheckout( ProductName, cardDetails, CurrencyCode, Amount, Narration, metadata); transactionId = checkout.TransactionId; var validate = _atGWInstance.ValidateCardOtp(transactionId, Otp); var res = JsonConvert.DeserializeObject(validate); var success = res["status"] == "Success" && checkout.Status == "PendingValidation"; Assert.IsTrue(success, "Should succesfully complete a Card checkout transaction"); }
public void SetPaymentCardNotesTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; SymmetricKeyAlgorithm ska = SymmetricKeyAlgorithm.GenerateNew(SymmetricEncryptionAlgorithm.AES_CTR); PaymentCard paymentCard = new PaymentCard("Bank of Dragon", "Cool Dragon", "Debit", "0000000000001234", "111", "11/20", "05/33", "Super cool card I have here"); PaymentCardSecret paymentCardSecret = new PaymentCardSecret(paymentCard, "does not matter", ska, derivedKey); string notes = "Yet another non useful note"; // Act bool shouldBeTrue = paymentCardSecret.SetNotes(notes, derivedKey); string notesAfterModification = paymentCardSecret.GetNotes(derivedKey); bool shouldBeFalse = paymentCardSecret.SetNotes(notes, new byte[] { 1, 2, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(notesAfterModification)); Assert.AreEqual(notes, notesAfterModification); }
public void TestEatLunchFromCardBooleanFalse() { PaymentTerminal terminal = new PaymentTerminal(); PaymentCard card = new PaymentCard(2); Assert.AreEqual(false, terminal.EatLunch(card), "Buying coffee should return false if balance is not enough"); }
public void Should_Initialize_Threeds_With_Card() { CreateConnectThreeDSInitializeRequest request = new CreateConnectThreeDSInitializeRequest(); request.Locale = Locale.TR.GetName(); request.ConversationId = "123456789"; request.BuyerEmail = "*****@*****.**"; request.BuyerId = "B2323"; request.BuyerIp = "127.0.0.1"; request.ConnectorName = "ISBANK"; request.Installment = 1; request.PaidPrice = "1.0"; request.Price = "1.0"; request.CallbackUrl = "https://www.merchant.com/callbackUrl"; PaymentCard paymentCard = new PaymentCard(); paymentCard.CardHolderName = "John Doe"; paymentCard.CardNumber = "5528790000000008"; paymentCard.ExpireMonth = "12"; paymentCard.ExpireYear = "2030"; paymentCard.Cvc = "123"; paymentCard.RegisterCard = 0; request.PaymentCard = paymentCard; ConnectThreeDSInitialize connectThreeDSInitialize = ConnectThreeDSInitialize.Create(request, options); PrintResponse <ConnectThreeDSInitialize>(connectThreeDSInitialize); Assert.IsNotNull(connectThreeDSInitialize.SystemTime); Assert.AreEqual(Status.SUCCESS.ToString(), connectThreeDSInitialize.Status); Assert.AreEqual(Locale.TR.GetName(), connectThreeDSInitialize.Locale); Assert.AreEqual("123456789", connectThreeDSInitialize.ConversationId); }
public async Task <IActionResult> Edit(int id, [Bind("PaymentCardID,CardType,CardName,CardNumber,ExpiryMonth,ExpiryYear,SecurityNumber")] PaymentCard paymentCard) { if (id != paymentCard.PaymentCardID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(paymentCard); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentCardExists(paymentCard.PaymentCardID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(paymentCard)); }
static void Main(string[] args) { int numErrors = 0; for (int i = 0; i < 1000; i++) { var password = RandomTextGenerator.GenerateRandomString(32); try { var paymentCard = new PaymentCard(); paymentCard.SetTestPaymentCard(); string text = paymentCard.ToEncryptedString("8UfROeJudbbl", password); var paymentCard2 = new PaymentCard(); paymentCard2.InitializeFromEncryptedString(text, "8UfROeJudbbl", password); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(password); numErrors++; } } }
public bool EatLunch(PaymentCard card) { // a lunch costs 10.30 euros // if the payment card has enough money, the balance of the card is decreased by the price, and the method returns true // otherwise false is returned return(false); }
public void MergeFrom(PaymentCardRefund other) { if (other == null) { return; } if (other.entityId_ != null) { if (entityId_ == null) { entityId_ = new global::HOLMS.Types.Money.Cards.Transactions.PaymentCardRefundIndicator(); } EntityId.MergeFrom(other.EntityId); } if (other.merchantId_ != null) { if (merchantId_ == null) { merchantId_ = new global::HOLMS.Types.Money.Cards.CardMerchantIndicator(); } MerchantId.MergeFrom(other.MerchantId); } if (other.refundedAmount_ != null) { if (refundedAmount_ == null) { refundedAmount_ = new global::HOLMS.Types.Primitive.MonetaryAmount(); } RefundedAmount.MergeFrom(other.RefundedAmount); } if (other.HostReferenceNumber.Length != 0) { HostReferenceNumber = other.HostReferenceNumber; } if (other.FolioBookingNumber.Length != 0) { FolioBookingNumber = other.FolioBookingNumber; } if (other.paymentCard_ != null) { if (paymentCard_ == null) { paymentCard_ = new global::HOLMS.Types.Money.Cards.GuestPaymentCard(); } PaymentCard.MergeFrom(other.PaymentCard); } if (other.postedAt_ != null) { if (postedAt_ == null) { postedAt_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } PostedAt.MergeFrom(other.PostedAt); } if (other.State != 0) { State = other.State; } }
public bool DrinkCoffee(PaymentCard card) { // a coffee costs 2.50 euros // if the payment card has enough money, the balance of the card is decreased by the price, and the method returns true // otherwise false is returned return(false); }
public void CreateTransaction(string from, string to, decimal value, string type, string paymentMethod, PaymentCard paymentDetails) { }
public ActionResult CardPayment(CardParameters cardParameters, int orderId) { IPayment<CardParameters> payment = new PaymentCard(); payment.Payment(orderId, cardParameters); return RedirectToAction("ShoppingList"); }
public ActionResult PayOff(string paymentMethod, int orderId) { IPayment<CardParameters> payment = new PaymentCard(); ViewBag.orderId = orderId; if (paymentMethod == "Card") { return View("CardPayment"); } return RedirectToAction("ShoppingList"); }