private static CardDebit AcceseazaCardDebit(Date db) { CardDebit cardDebit = null; Console.WriteLine("Intrudu numarul de card:"); string numarCard = Console.ReadLine(); Console.WriteLine("Introdu pin ul de la card"); string pinCard = Console.ReadLine(); foreach (var cont in db.ConturiBancare) { if (cont == null) { continue; } foreach (var card in cont.CarduriDebit) { if (card.NumarCard == numarCard && card.PIN == pinCard) { cardDebit = card; return(cardDebit); } } } return(null); }
public void TestOrderNewMaestroCard() { SetUpTestCase(); var cardPinAssignment = new CardPinAssignment( CardPinAssignmentTypePrimary ) { PinCode = PinCode, MonetaryAccountId = BunqContext.UserContext.PrimaryMonetaryAccountBank.Id }; var allCardPinAssignments = new List <CardPinAssignment> { cardPinAssignment }; var cardDebit = CardDebit.Create( GenerateRandomSecondLine(), GetAnAllowedName(), GetAlias(), CardTypeMaestro, allCardPinAssignments ).Value; Assert.True(cardDebit.Id != null); var cardFromCardEndpoint = Card.Get(cardDebit.Id.Value).Value; Assert.Equal(cardDebit.SecondLine, cardFromCardEndpoint.SecondLine); Assert.Equal(cardDebit.Created, cardFromCardEndpoint.Created); Assert.Equal(cardDebit.NameOnCard, cardFromCardEndpoint.NameOnCard); }
private static void CreeazaCardDebit(Date db) { ContBancar cont = LogheazaUtilizator(db); if (cont != null) { CardDebit cardDebit = new CardDebit(cont); cont.CarduriDebit.Add(cardDebit); Console.WriteLine($"Aproape a fost creat card ul de debit pentru clientul {cont.Nume}"); Console.WriteLine("Din motive de securitate trebuie sa iti setezi un pin si un cod de card:"); Console.WriteLine("Introdu un pin nou si apasa enter"); string pin = Console.ReadLine(); if (cardDebit.SchimbaPin("0000", pin)) { Console.WriteLine("Introdu un cod de card nou si apaasa enter"); string codCard = Console.ReadLine(); cardDebit.CodCard = codCard; string msg1 = "Card ul de debit a fost creat!"; Console.WriteLine(msg1); log.Info(msg1); db.SaveData(); } else { string msg = "Pin ul nu a putut fi schimbat"; Console.WriteLine(msg); log.Warn(msg); return; } } log.Warn($"Cont ul nu a fost gasit in baza de date"); Console.WriteLine("Cont ul nu a fost gasit in baza de date"); }
private static void StergeCardDebit(Date db, CardDebit cardDeSters) { cardDeSters.ContBancar.CarduriDebit.Remove(cardDeSters); db.SaveData(); log.Info($"Cardul {cardDeSters.NumarCard} a fost sters."); Console.WriteLine($"Cardul {cardDeSters.NumarCard} a fost sters."); }
static void TestCard() { ContBancar cb = new ContBancar(); cb.Nume = "ana"; cb.DepunereNumerar(100); CardDebit cardDebit = new CardDebit(cb); decimal sold = cardDebit.Sold; sold = cardDebit.ContBancar.Sold; string nume = cardDebit.Nume; nume = cardDebit.ContBancar.Nume; }
public void TestOrderNewMaestroCard() { var cardDebitMap = new Dictionary <string, object> { { CardDebit.FIELD_ALIAS, GetAlias() }, { CardDebit.FIELD_NAME_ON_CARD, GetAnAllowedName() }, { CardDebit.FIELD_PIN_CODE, PIN_CODE }, { CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine() } }; var cardDebit = CardDebit.Create(API_CONTEXT, cardDebitMap, USER_ID).Value; var cardFromCardEndpoint = Card.Get(API_CONTEXT, USER_ID, cardDebit.Id.Value).Value; Assert.Equal(cardDebit.SecondLine, cardFromCardEndpoint.SecondLine); Assert.Equal(cardDebit.Created, cardFromCardEndpoint.Created); Assert.Equal(cardDebit.NameOnCard, cardFromCardEndpoint.NameOnCard); }
private static void IntraInCardDebit(Date db) { CardDebit card = AcceseazaCardDebit(db); if (card != null) { Console.WriteLine("Care este operatiunea pe care vreti sa o faceti pe card?"); Console.WriteLine("1. Sterge card \n 2. Verifica sold card \n 3. Depune numerar pe card \n 4. Retrage numerar dupa card \n 5. Schimba pin card"); ConsoleKeyInfo tastaApasata = Console.ReadKey(); switch (tastaApasata.Key) { case ConsoleKey.D1: StergeCardDebit(db, card); break; case ConsoleKey.D2: VerificaSoldCard(card); break; case ConsoleKey.D3: ModificareNumerarCardDebit(db, TipModificareNumerar.Depunere, card); break; case ConsoleKey.D4: ModificareNumerarCardDebit(db, TipModificareNumerar.Retragere, card); break; case ConsoleKey.D5: SchimbaPinCardDebit(db, card); break; default: Console.WriteLine("Nu ati selectat nici o optiune valida"); break; } } else { string msg = "Cardul nu a fost gasit in baza de date"; Console.WriteLine(msg); log.Warn(msg); } }
private const int USER_ITEM_ID = 0; // Put your user ID here public void Run() { var apiContext = ApiContext.Restore(); var requestMap = new Dictionary <string, object> { { CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY }, { CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine() }, { CardDebit.FIELD_PIN_CODE, PIN_CODE }, { CardDebit.FIELD_ALIAS, new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) { Name = POINTER_NAME_TEST } }, }; Console.WriteLine(CardDebit.Create(apiContext, requestMap, USER_ITEM_ID)); }
private const int MONETARY_ACCOUNT_ID = 0; // Put your monetaryAccount ID here public void Run() { BunqContext.LoadApiContext(ApiContext.Restore()); var cardPinAssignment = new CardPinAssignment( CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, PIN_CODE, MONETARY_ACCOUNT_ID ); var allCardPinAssignments = new List <CardPinAssignment> { cardPinAssignment }; Console.WriteLine(CardDebit.Create(GenerateRandomSecondLine(), NAME_YOUR_COMPANY, new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) { Name = POINTER_NAME_TEST }, pinCodeAssignment: allCardPinAssignments)); }
public void TestOrderNewMaestroCard() { var cardPinAssignment = new CardPinAssignment( CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, PIN_CODE, Config.GetMonetarytAccountId()); var allCardPinAssignments = new List <CardPinAssignment> { cardPinAssignment }; var cardDebit = CardDebit.Create(GenerateRandomSecondLine(), GetAnAllowedName(), GetAlias(), CardTypeMaestro, allCardPinAssignments).Value; Assert.True(cardDebit.Id != null); var cardFromCardEndpoint = Card.Get(cardDebit.Id.Value).Value; Assert.Equal(cardDebit.SecondLine, cardFromCardEndpoint.SecondLine); Assert.Equal(cardDebit.Created, cardFromCardEndpoint.Created); Assert.Equal(cardDebit.NameOnCard, cardFromCardEndpoint.NameOnCard); }
private static void SchimbaPinCardDebit(Date db, CardDebit card) { string msg1 = "Pin ul a fost schimbat cu succes"; string msg2 = "Pin ul nu a putut fi schimbat"; Console.WriteLine("Introdu pin-ul vechi:"); string pinVechi = Console.ReadLine(); Console.WriteLine("Introdu pin-ul now"); string pinNou = Console.ReadLine(); if (card.SchimbaPin(pinVechi, pinNou)) { Console.WriteLine(msg1); log.Info(msg1); db.SaveData(); } else { Console.WriteLine(msg2); log.Warn(msg2); return; } }
private static void VerificaSoldCard(CardDebit card) { Console.WriteLine($"Sold ul cardului {card.NumarCard} este {card.Sold}"); }
private static void ModificareNumerarCardDebit(Date db, TipModificareNumerar tipMod, CardDebit card) { string msg = "Suma introdusa de tine nu este valida"; if (tipMod == TipModificareNumerar.Depunere) { string sumaDepusa = Console.ReadLine(); int suma = 0; if (int.TryParse(sumaDepusa, out suma)) { if (card.DepunereNumerar(suma)) { string msg1 = "Suma a fost depusa cu succes"; Console.WriteLine(msg1); log.Info(msg1); db.SaveData(); return; } else { string msg2 = "Suma nu a fost depusa"; Console.WriteLine(msg2); log.Warn(msg2); return; } } else { Console.WriteLine(msg); log.Warn(msg); return; } } else if (tipMod == TipModificareNumerar.Retragere) { string sumaRetrasa = Console.ReadLine(); int sumaR = 0; if (int.TryParse(sumaRetrasa, out sumaR)) { if (card.RetragereNumerar(sumaR)) { string msg4 = "Suma a fost retrasa cu succes!"; Console.WriteLine(msg4); log.Info(msg4); db.SaveData(); } else { string msg3 = "Suma nu a fost retrasa"; Console.WriteLine(msg3); log.Warn(msg3); return; } } else { Console.WriteLine(msg); log.Warn(msg); return; } } return; }