public CardInformation AddCardInformation(string firstName,
                                                  string lastName,
                                                  string expiryMonth,
                                                  string expiryYear,
                                                  string hashedCardNumber,
                                                  string maskedCardNumber)
        {
            //Not thread safe
            var maxId = 1;

            if (_cards.Any())
            {
                maxId = _cards.Max(c => c.CardInformationId) + 1;
            }

            var card = new CardInformation
            {
                CardInformationId = maxId,
                LastName          = lastName,
                FirstName         = firstName,
                ExpiryMonth       = expiryMonth,
                ExpiryYear        = expiryYear,
                CardNumberHash    = hashedCardNumber,
                CardNumberMask    = maskedCardNumber,
            };

            _cards.Add(card);

            return(card);
        }
예제 #2
0
        public IHttpActionResult PutCardInformation(int id, CardInformation cardInformation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cardInformation.CardID)
            {
                return(BadRequest());
            }

            db.Entry(cardInformation).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CardInformationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        private CardInformation InitCardInformationBlandText(Collection collection, long id)
        {
            Card c = collection.GetCard(id);
            Note n = c.LoadNote(false);

            var qA       = c.GetQuestionAndAnswer(false, true);
            var question = ReviewPage.TypeAnswerRegex.Replace(qA["q"], "");

            question = CleanMakeUp(question);

            StringBuilder answerBuilder = new StringBuilder();
            var           answer        = GetPureAnswer(qA["a"]);

            //Question is usually much shorter than answer so we decide
            //to search for cloze/type or not based on it.
            //Only invalid cards would not have cloze/type on question side anyway.
            if (ClozeRegex.IsMatch(qA["q"]))
            {
                ExpandCloze(qA["a"], answerBuilder);
            }
            if (ReviewPage.TypeAnswerRegex.IsMatch(qA["q"]))
            {
                ExpandType(n, qA["a"], answerBuilder);
                answer = ReviewPage.TypeAnswerRegex.Replace(answer, "");
            }
            answerBuilder.Append(answer);
            answer = CleanMakeUp(answerBuilder.ToString());

            var             dueStr = FindRealDueAndDueInString(c);
            CardInformation card   = new CardInformation(c.Id, c.NoteId, c.DeckId, c.OriginalDeckId, c.Due, dueStr, c.Ord, c.Type, c.Interval, c.Queue,
                                                         c.Lapses, question, answer, n.GetSFld());

            return(card);
        }
예제 #4
0
        public async Task Should_Create_User_And_Add_Card()
        {
            string          externalUserId  = RandomGenerator.RandomId;
            CardInformation cardInformation = CardInformationBuilder
                                              .Create()
                                              .Build();

            CreateCardRequest createCardRequest = CreateCardRequestBuilder.Create()
                                                  .Card(cardInformation)
                                                  .ExternalId(externalUserId)
                                                  .Email("*****@*****.**")
                                                  .Build();

            Card card = await Card.CreateAsync(createCardRequest, Options);

            PrintResponse(card);

            Assert.AreEqual(Locale.TR.ToString(), card.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), card.Status);
            Assert.NotNull(card.SystemTime);
            Assert.AreEqual("123456789", card.ConversationId);
            Assert.AreEqual("*****@*****.**", card.Email);
            Assert.AreEqual("552879", card.BinNumber);
            Assert.AreEqual("card alias", card.CardAlias);
            Assert.AreEqual("CREDIT_CARD", card.CardType);
            Assert.AreEqual("MASTER_CARD", card.CardAssociation);
            Assert.AreEqual("Paraf", card.CardFamily);
            Assert.AreEqual("Halk Bankası", card.CardBankName);
            Assert.True(card.CardBankCode.Equals(12L));
        }
예제 #5
0
        public void Should_Create_Card()
        {
            CardInformation cardInformation = new CardInformation();

            cardInformation.CardAlias      = "myAlias";
            cardInformation.CardHolderName = "John Doe";
            cardInformation.CardNumber     = "5528790000000008";
            cardInformation.ExpireMonth    = "12";
            cardInformation.ExpireYear     = "2030";

            CreateCardRequest request = new CreateCardRequest();

            request.Locale         = Locale.TR.GetName();
            request.ConversationId = "123456789";
            request.CardUserKey    = "myCardUserKey";
            request.Card           = cardInformation;

            Card card = Card.Create(request, options);

            PrintResponse <Card>(card);

            Assert.IsNotNull(card.SystemTime);
            Assert.AreEqual(Status.SUCCESS.ToString(), card.Status);
            Assert.AreEqual(Locale.TR.GetName(), card.Locale);
            Assert.AreEqual("123456789", card.ConversationId);
        }
예제 #6
0
 public Game2DCard(CardInformation cardInfo)
 {
     _CardInfo = cardInfo;
     texture = Resources.Load ("CardHelper/" + _CardInfo.clan + "/" + _CardInfo.mat) as Texture2D;
     _cardWidth  *= 0.2f;
     _cardHeight *= 0.2f;
 }
예제 #7
0
 public Card2D(CardInformation cardInfo, DeckEditorManager deck)
 {
     _DeckEditor = deck;
     _CardInfo = cardInfo;
     texture = Resources.Load ("CardHelper/" + _CardInfo.clan + "/" + _CardInfo.mat) as Texture2D;
     _cardWidth  *= 0.28f * _DeckEditor._xWindowScale;
     _cardHeight *= 0.28f * _DeckEditor._yWindowScale;
 }
예제 #8
0
 private void SuspendCardInfor(CardInformation card)
 {
     if (card.Queue > -1)
     {
         card.DueStr = "(" + card.DueStr + ")";
     }
     card.Queue = -1;
 }
예제 #9
0
 private void UnsuspendCardInfor(CardInformation card)
 {
     if (card.Queue < 0)
     {
         card.DueStr = card.DueStr.Substring(1, card.DueStr.Length - 2);
     }
     card.Queue = (int)card.Type;
 }
예제 #10
0
 private bool ValidateCard(CardInformation cardInfo)
 {
     if (cardInfo.CardNumber.StartsWith("0"))
     {
         return(false);
     }
     return(true);
 }
예제 #11
0
        public void TestPlayer_HintCardNumber()
        {
            Mock <IGame> game = new Mock <IGame>();
            Mock <IWebSocketConnection> socket = new Mock <IWebSocketConnection>();

            Player player = new Player(game.Object, socket.Object);

            Card card1 = new Card(new CardIdType(0), new CardIndexType(0), CardColorType.Blue, CardValueType.Value1);
            Card card2 = new Card(new CardIdType(1), new CardIndexType(1), CardColorType.Blue, CardValueType.Value1);
            Card card3 = new Card(new CardIdType(2), new CardIndexType(2), CardColorType.Blue, CardValueType.Value2);
            Card card4 = new Card(new CardIdType(3), new CardIndexType(3), CardColorType.Green, CardValueType.Value1);
            Card card5 = new Card(new CardIdType(4), new CardIndexType(4), CardColorType.Yellow, CardValueType.Value2);

            player.DrawCard(card1);
            player.DrawCard(card2);
            player.DrawCard(card3);
            player.DrawCard(card4);
            player.DrawCard(card5);
            player.HintCard(CardValueType.Value1);

            Debug.Assert(player.handCards.Count == 5);
            CardInformation hint1 = player.GetHandCard(card1.Index).hint;

            Debug.Assert(hint1.numberHints[CardValueType.Value1] == HintState.Sure);
            Debug.Assert(hint1.numberHints[CardValueType.Value2] == HintState.Impossible);
            Debug.Assert(hint1.numberHints[CardValueType.Value3] == HintState.Impossible);
            Debug.Assert(hint1.numberHints[CardValueType.Value4] == HintState.Impossible);
            Debug.Assert(hint1.numberHints[CardValueType.Value5] == HintState.Impossible);
            CardInformation hint2 = player.GetHandCard(card2.Index).hint;

            Debug.Assert(hint2.numberHints[CardValueType.Value1] == HintState.Sure);
            Debug.Assert(hint2.numberHints[CardValueType.Value2] == HintState.Impossible);
            Debug.Assert(hint2.numberHints[CardValueType.Value3] == HintState.Impossible);
            Debug.Assert(hint2.numberHints[CardValueType.Value4] == HintState.Impossible);
            Debug.Assert(hint2.numberHints[CardValueType.Value5] == HintState.Impossible);
            CardInformation hint3 = player.GetHandCard(card3.Index).hint;

            Debug.Assert(hint3.numberHints[CardValueType.Value1] == HintState.Impossible);
            Debug.Assert(hint3.numberHints[CardValueType.Value2] == HintState.Unknown);
            Debug.Assert(hint3.numberHints[CardValueType.Value3] == HintState.Unknown);
            Debug.Assert(hint3.numberHints[CardValueType.Value4] == HintState.Unknown);
            Debug.Assert(hint3.numberHints[CardValueType.Value5] == HintState.Unknown);
            CardInformation hint4 = player.GetHandCard(card4.Index).hint;

            Debug.Assert(hint4.numberHints[CardValueType.Value1] == HintState.Sure);
            Debug.Assert(hint4.numberHints[CardValueType.Value2] == HintState.Impossible);
            Debug.Assert(hint4.numberHints[CardValueType.Value3] == HintState.Impossible);
            Debug.Assert(hint4.numberHints[CardValueType.Value4] == HintState.Impossible);
            Debug.Assert(hint4.numberHints[CardValueType.Value5] == HintState.Impossible);
            CardInformation hint5 = player.GetHandCard(card5.Index).hint;

            Debug.Assert(hint5.numberHints[CardValueType.Value1] == HintState.Impossible);
            Debug.Assert(hint5.numberHints[CardValueType.Value2] == HintState.Unknown);
            Debug.Assert(hint5.numberHints[CardValueType.Value3] == HintState.Unknown);
            Debug.Assert(hint5.numberHints[CardValueType.Value4] == HintState.Unknown);
            Debug.Assert(hint5.numberHints[CardValueType.Value5] == HintState.Unknown);
        }
예제 #12
0
    void Update()
    {
        cardIndexSelected = gameObject.GetComponentInChildren <CardInformation>();
        childTransform    = gameObject.GetComponentInChildren <Transform>();


        CheckForValidLenght();
        //ReplaceCards();
    }
예제 #13
0
 void Start()
 {
     deckFill         = GameObject.FindGameObjectWithTag("Deck");
     scale            = transform.localScale;
     isSelected       = false;
     sendButton       = sendButon.GetComponent <SendButton2>();
     cardIndexToAdd   = GetComponent <CardInformation>();
     checkCombination = deckFill.GetComponent <CheckCombinations>();
 }
예제 #14
0
        public TransactionResponse Post([FromBody] CardInformation card)
        {
            var Errors = ValidateRequest(card);

            if (Errors.Count() > 0)
            {
                return(new TransactionResponse()
                {
                    Id = Guid.NewGuid(),
                    Message = "",
                    Errors = Errors
                });
            }
            else
            {
                Client.DefaultRequestHeaders.Accept.Clear();
                Client.BaseAddress = new Uri(BankPath);
                Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                string message = GetList().Result;
                if (message.Contains("Accepted"))
                {
                    if (Histories == null)
                    {
                        Histories = new List <TransactionHistory>();
                    }


                    Histories.Add(new TransactionHistory()
                    {
                        Id = Guid.NewGuid(), CardNumber = card.CardNumber, Amount = card.Amount, TransactionDate = DateTime.Now
                    });

                    if (SavetoDB)
                    {
                        using (Database = new BankContext(ConnectionString))
                        {
                            var payment = new Payment();
                            var temp    = Histories.Last();
                            payment.Id                = temp.Id.ToString();
                            payment.CardId            = temp.CardNumber;
                            payment.Amount            = decimal.Parse(temp.Amount.ToString());
                            payment.DateofTransaction = temp.TransactionDate;

                            Database.Payment.Add(payment);
                            Database.SaveChanges();
                        }
                    }
                }
                return(new TransactionResponse()
                {
                    Id = Guid.NewGuid(),
                    Message = message,
                    Errors = new List <ErrorInformation>()
                });
            }
        }
예제 #15
0
        public List <ErrorInformation> ValidateRequest(CardInformation card)
        {
            var Errors = new List <ErrorInformation>();

            try
            {
                if (string.IsNullOrEmpty(card.CardNumber.ToString()))
                {
                    Errors.Add(new ErrorInformation("Invalid Card"));
                }

                if (card.Amount <= 0)
                {
                    Errors.Add(new ErrorInformation("Invalid amount"));
                }

                if (card.Amount > 2000)
                {
                    Errors.Add(new ErrorInformation("Your limit is exceeded"));
                }

                if (string.IsNullOrEmpty(card.ExpiryDate))
                {
                    Errors.Add(new ErrorInformation("Card is expired"));
                }

                else if (!string.IsNullOrEmpty(card.ExpiryDate) && card.ExpiryDate.Length < 4)
                {
                    Errors.Add(new ErrorInformation("Card is expired"));
                }

                else if (!string.IsNullOrEmpty(card.ExpiryDate) && card.ExpiryDate.Length == 4)
                {
                    int Month = int.Parse(card.ExpiryDate.Substring(0, 2));
                    int Year  = int.Parse(card.ExpiryDate.Substring(2, 2));

                    int CurrentYear  = int.Parse(DateTime.Now.ToString("yy"));
                    int CurrentMonth = DateTime.Now.Month;

                    if (Year < CurrentYear)
                    {
                        Errors.Add(new ErrorInformation("Card is expired"));
                    }
                    else if (Year == CurrentYear && Month < CurrentMonth)
                    {
                        Errors.Add(new ErrorInformation("Card is expired"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(Errors);
        }
        public CardInformation Build()
        {
            CardInformation cardInformation = new CardInformation();

            cardInformation.CardAlias      = _cardAlias;
            cardInformation.CardNumber     = _cardNumber;
            cardInformation.ExpireYear     = _expireYear;
            cardInformation.ExpireMonth    = _expireMonth;
            cardInformation.CardHolderName = _cardHolderName;
            return(cardInformation);
        }
예제 #17
0
        private List <CardInformation> InitCardList(IEnumerable <long> cardId)
        {
            List <CardInformation> temp = new List <CardInformation>();

            foreach (var id in cardId)
            {
                CardInformation card = InitCardInformationBlandText(collection, id);
                temp.Add(card);
            }
            return(temp);
        }
 void Start()
 {
     PopupManager.SetUpPopupManager();
     TileInformation.SetUpTileInformation();
     TileManager.SetUpTiles();
     CardInformation.SetUpCardInformation();
     CardManager.SetUpCardManager();
     PlayerManager.PlacePlayersOnBoard();
     PlayerInformationManager.SetUpPlayerInformationManager(PlayerManager.GetPlayers().Length);
     GameLoop.SetUpGameLoop();
 }
예제 #19
0
        public IHttpActionResult GetCardInformation(int id)
        {
            CardInformation cardInformation = db.CardInformations.Find(id);

            if (cardInformation == null)
            {
                return(NotFound());
            }

            return(Ok(cardInformation));
        }
        private Card CreateCard()
        {
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .Email("*****@*****.**")
                                            .Build();

            return(Card.Create(cardRequest, Options));
        }
예제 #21
0
        private async Task <Card> CreateCard()
        {
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .Email("*****@*****.**")
                                            .Build();

            return(await Card.CreateAsync(cardRequest, Options));
        }
예제 #22
0
        public IHttpActionResult PostCardInformation(CardInformation cardInformation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CardInformations.Add(cardInformation);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = cardInformation.CardID }, cardInformation));
        }
예제 #23
0
        public async Task Should_Create_Payment_With_Registered_Card()
        {
            string          externalUserId  = RandomGenerator.RandomId;
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .ExternalId(externalUserId)
                                            .Email("*****@*****.**")
                                            .Build();

            Card card = await Card.CreateAsync(cardRequest, Options);

            PaymentCard paymentCard = PaymentCardBuilder.Create()
                                      .CardUserKey(card.CardUserKey)
                                      .CardToken(card.CardToken)
                                      .Build();

            CreatePaymentRequest request = CreatePaymentRequestBuilder.Create()
                                           .StandardListingPayment()
                                           .PaymentCard(paymentCard)
                                           .Build();

            Payment payment = await Payment.CreateAsync(request, Options);

            PrintResponse(payment);

            Assert.Null(payment.ConnectorName);
            Assert.AreEqual(Locale.TR.ToString(), payment.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), payment.Status);
            Assert.NotNull(payment.SystemTime);
            Assert.AreEqual("123456789", payment.ConversationId);
            Assert.Null(payment.ErrorCode);
            Assert.Null(payment.ErrorMessage);
            Assert.Null(payment.ErrorGroup);
            Assert.NotNull(payment.PaymentId);
            Assert.NotNull(payment.BasketId);
            Assert.AreEqual("1", payment.Price);
            Assert.AreEqual("1.1", payment.PaidPrice);
            Assert.AreEqual("0.02887500", payment.IyziCommissionRateAmount);
            Assert.AreEqual("0.25000000", payment.IyziCommissionFee);
            Assert.AreEqual("10.00000000", payment.MerchantCommissionRate);
            Assert.AreEqual("0.1", payment.MerchantCommissionRateAmount);
            Assert.AreEqual(0.028875, payment.IyziCommissionRateAmount.ParseDouble());
            Assert.AreEqual(0.25, payment.IyziCommissionFee.ParseDouble());
            Assert.AreEqual(10, payment.MerchantCommissionRate.ParseDouble());
            AssertDecimal.AreEqual(0.02887500M, payment.IyziCommissionRateAmount.ParseDecimal());
            AssertDecimal.AreEqual(0.25000000M, payment.IyziCommissionFee.ParseDecimal());
            AssertDecimal.AreEqual(10.00000000M, payment.MerchantCommissionRate.ParseDecimal());
            Assert.AreEqual(1, payment.Installment);
        }
 // แสดงผล Rank ของ card
 private void displayCardRank(CardInformation card)
 {
     if (card != null) {
         switch (card.Rank) {
             case 1: VisualStateManager.GoToState(this, OneStar.Name, true); break;
             case 2: VisualStateManager.GoToState(this, TwoStar.Name, true); break;
             case 3: VisualStateManager.GoToState(this, ThreeStar.Name, true); break;
             case 4: VisualStateManager.GoToState(this, FourStar.Name, true); break;
             case 5: VisualStateManager.GoToState(this, FiveStar.Name, true); break;
             default: VisualStateManager.GoToState(this, NoneStar.Name, true); break;
         }
     }
 }
예제 #25
0
 /// <summary>
 /// To the data contract.
 /// </summary>
 /// <param name="cardInformation">The card information.</param>
 /// <returns></returns>
 public static CardInformationContract ToDataContract(this CardInformation cardInformation)
 {
     return(null == cardInformation
               ? null
               : new CardInformationContract()
     {
         Balance = cardInformation.Balance,
         InterestRate = cardInformation.InterestRate,
         LessonUserId = cardInformation.UserId,
         MakesMinimumPayment = cardInformation.MakesMinimumPayment,
         MonthlyPaymentAmount = cardInformation.MonthlyPayment
     });
 }
예제 #26
0
        public IHttpActionResult DeleteCardInformation(int id)
        {
            CardInformation cardInformation = db.CardInformations.Find(id);

            if (cardInformation == null)
            {
                return(NotFound());
            }

            db.CardInformations.Remove(cardInformation);
            db.SaveChanges();

            return(Ok(cardInformation));
        }
예제 #27
0
    void ShowCards()//we can feed them manually
    {
        int cardCount = 0;

        foreach (int i in deck.GetCards())                //make 3 for loops for each row
        {
            float      co       = CardOffset * cardCount; //change later
            GameObject cardCopy = (GameObject)Instantiate(CardPrefab);
            Vector3    temp     = start + new Vector3(co, 0f);
            cardCopy.transform.position = temp;
            CardInformation cardModel = cardCopy.GetComponent <CardInformation>();
            cardModel.cardIndex = i;
            cardCount++;
        }
    }
        public static void SetUpCardManager()
        {
            _chanceDeck[0] = new MovementCard();
            _chanceDeck[1] = new MovementCard();
            _chanceDeck[2] = new MovementCard();
            _chanceDeck[3] = new MovementCard();
            _chanceDeck[4] = new MovementCard();
            _chanceDeck[5] = new MoneyCard();
            _chanceDeck[6] = new MoneyCard();
            _chanceDeck[7] = new MoneyCard();
            _chanceDeck[8] = new GetOutOfJailCard();

            //Sets up deck of chance cards

            _communityChestDeck[0]  = new MoneyCard();
            _communityChestDeck[1]  = new MoneyCard();
            _communityChestDeck[2]  = new MoneyCard();
            _communityChestDeck[3]  = new MoneyCard();
            _communityChestDeck[4]  = new MoneyCard();
            _communityChestDeck[5]  = new MoneyCard();
            _communityChestDeck[6]  = new MoneyCard();
            _communityChestDeck[7]  = new MoneyCard();
            _communityChestDeck[8]  = new MoneyCard();
            _communityChestDeck[9]  = new MoneyCard();
            _communityChestDeck[10] = new MoneyCard();
            _communityChestDeck[11] = new MovementCard();
            _communityChestDeck[12] = new GetOutOfJailCard();

            //Sets up deck of Community Chest cards

            (int, Sprite)cardInformation;

            for (int n = 0; n < 9; n++)
            {
                cardInformation = CardInformation.GetCardInformation(n);
                _chanceDeck[n].SetUpCard(cardInformation.Item1, cardInformation.Item2);
            }

            for (int n = 8; n < 21; n++)
            {
                cardInformation = CardInformation.GetCardInformation(n);
                _communityChestDeck[n - 8].SetUpCard(cardInformation.Item1, cardInformation.Item2);
            }

            ShuffleChance();
            ShuffleCommunityChest();
            //Shuffles decks before game starts
        }
예제 #29
0
        private int CompareSortField(CardInformation compared, CardInformation comparer)
        {
            long comparedNumber;
            var  isNumber = long.TryParse(compared.SortField, out comparedNumber);

            if (isNumber)
            {
                long comparerNumber;
                isNumber = long.TryParse(comparer.SortField, out comparerNumber);
                if (isNumber)
                {
                    return(sign * comparedNumber.CompareTo(comparerNumber));
                }
            }
            return(sign * compared.SortField.CompareTo(comparer.SortField));
        }
        public async Task Should_Create_User_And_Add_Card()
        {
            CreateCardRequest request = new CreateCardRequest
            {
                Locale         = Locale.TR.ToString(),
                ConversationId = "123456789",
                Email          = "*****@*****.**",
                ExternalId     = "external id"
            };

            CardInformation cardInformation = new CardInformation
            {
                CardAlias      = "card alias",
                CardHolderName = "John Doe",
                CardNumber     = "5528790000000008",
                ExpireMonth    = "12",
                ExpireYear     = "2030"
            };

            request.Card = cardInformation;

            Card card = await Card.CreateAsync(request, Options);

            PrintResponse(card);

            Assert.AreEqual(Status.SUCCESS.ToString(), card.Status);
            Assert.AreEqual(Locale.TR.ToString(), card.Locale);
            Assert.AreEqual("123456789", card.ConversationId);
            Assert.IsNotNull(card.SystemTime);
            Assert.IsNull(card.ErrorCode);
            Assert.IsNull(card.ErrorMessage);
            Assert.IsNull(card.ErrorGroup);
            Assert.AreEqual("552879", card.BinNumber);
            Assert.AreEqual("card alias", card.CardAlias);
            Assert.AreEqual("CREDIT_CARD", card.CardType);
            Assert.AreEqual("MASTER_CARD", card.CardAssociation);
            Assert.AreEqual("Paraf", card.CardFamily);
            Assert.AreEqual("Halk Bankası", card.CardBankName);
            Assert.AreEqual(12, card.CardBankCode);
            Assert.IsNotNull(card.CardUserKey);
            Assert.IsNotNull(card.CardToken);
            Assert.AreEqual("*****@*****.**", card.Email);
            Assert.AreEqual("external id", card.ExternalId);
        }
예제 #31
0
        public CardInformation PostCardInformation(CardInformation cardinformation)
        {
            var lessonUserId = GetUserLessonId();

            if (!lessonUserId.HasValue)
            {
                return(null);
            }

            var result = SaltServiceAgent.PostLesson2(new Lesson2()
            {
                CurrentBalance = cardinformation, User = new User()
                {
                    UserId = lessonUserId.Value
                }
            }.ToDataContract()).ToDomainObject();

            return(result.CurrentBalance);
        }
예제 #32
0
        //public Transform CreateGraphic(TextureAnimation animation)
        //{
        //    var graphicsObj = (Transform)Instantiate(UnitTemplate);
        //
        //}

        public void TransformCardToSpell(GameObject cardObj, Spell spell)
        {
            CardInformation cinfo = cardObj.GetComponent <CardInformation>();

            this.gameobjLookUp.Remove(cinfo.Card);

            var components = cardObj.GetComponents <MonoBehaviour>();

            foreach (var component in components)
            {
                component.enabled = false;
            }

            this.gameobjLookUp.Add(spell, cardObj);
            var spellinfo = cardObj.AddComponent <SpellInformation>();

            spellinfo.Spell = spell;
            cardObj.AddComponent <GuiSpellViewHandler>();
        }
예제 #33
0
        public void Should_Create_Card()
        {
            CreateCardRequest request = new CreateCardRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = "123456789";
            request.CardUserKey    = "card user key";

            CardInformation cardInformation = new CardInformation();

            cardInformation.CardAlias      = "card alias";
            cardInformation.CardHolderName = "John Doe";
            cardInformation.CardNumber     = "5528790000000008";
            cardInformation.ExpireMonth    = "12";
            cardInformation.ExpireYear     = "2030";
            request.Card = cardInformation;

            Card card = Card.Create(request, options);

            PrintResponse <Card>(card);

            Assert.AreEqual(Status.SUCCESS.ToString(), card.Status);
            Assert.AreEqual(Locale.TR.ToString(), card.Locale);
            Assert.AreEqual("123456789", card.ConversationId);
            Assert.IsNotNull(card.SystemTime);
            Assert.IsNull(card.ErrorCode);
            Assert.IsNull(card.ErrorMessage);
            Assert.IsNull(card.ErrorGroup);
            Assert.AreEqual("552879", card.BinNumber);
            Assert.AreEqual("card alias", card.CardAlias);
            Assert.AreEqual("CREDIT_CARD", card.CardType);
            Assert.AreEqual("MASTER_CARD", card.CardAssociation);
            Assert.AreEqual("Paraf", card.CardFamily);
            Assert.AreEqual("Halk Bankası", card.CardBankName);
            Assert.AreEqual(12, card.CardBankCode);
            Assert.IsNotNull(card.CardUserKey);
            Assert.IsNotNull(card.CardToken);
            Assert.IsNull(card.Email);
            Assert.IsNull(card.ExternalId);
        }
        // Initialize events
        private void initializeEvents()
        {
            #region กดปุ่มไปต่อ

            btn_Next.MouseLeftButtonDown += (s, e) => {
                var temp = Completed;
                if (temp != null) temp(null, null);
            };

            #endregion กดปุ่มไปต่อ

            #region ถึงเวลาในการทำเล่นคะแนนวิ่ง

            _displayScoreTimer.Tick += (s, e) => {

                if (_currentDisplayScoreRound >= MaximumDisplayScoreRound) {
                    _currentDisplayScoreRound = RestartScoreRound;
                    _displayScoreTimer.Stop();
                    _holdingTimer.Start();
                }
                else {
                    _miniRound++;
                    AllStateScoreTextBlock.Text = ((int)(_miniRound * _scorePerMiniRound)).ToString();
                    _currentDisplayScoreRound++;
                }
            };

            #endregion ถึงเวลาในการทำเล่นคะแนนวิ่ง

            #region ถึงเวลาที่ต้องเปลี่ยนการ์ดใหม่

            _displayCardTimer.Tick += (s, e) => {

                // ตรวจการเล่น effect ควันที่ภาพรองสุดท้าย
                if (_currentRound == DisplaySmokeEffectRound) ;

                // แสดงคะแนนที่ได้ออกมา
                if (_isFinished == false) _displayScoreTimer.Start();

                _currentRound++;

                // แสดงภาพการ์ดที่ได้
                var nextLevelScore = _scorePerRound * _currentRound;
                var nextCard = getCardInformationByScore(nextLevelScore);
                if (nextCard != null) {
                    if (nextCard != _currentCard) {

                        var oldCard = _currentCard;
                        FirstImage.Source = oldCard.ImageSource;

                        _currentCard = nextCard;
                        SecondImage.Source = _currentCard.ImageSource;
                        AppoSlideStoryboard.Begin();

                        displayCardRank(_currentCard);
                    }
                }

                // ตรวจสอบการแสดงจบ
                if (_currentRound >= MaximumDisplayScoreRound) {
                    AllStateScoreTextBlock.Text = _totalScore.ToString();
                    _isFinished = true;
                    Sb_Next.Begin();
                }

                _displayCardTimer.Stop();
            };

            #endregion ถึงเวลาที่ต้องเปลี่ยนการ์ดใหม่

            #region หมดเวลาในการแสดงการ์ด

            _holdingTimer.Tick += (s, e) => {
                _holdingTimer.Start();
                _displayCardTimer.Start();
            };

            #endregion หมดเวลาในการแสดงการ์ด

            #region การเลื่อนการ์ดเสร็จสิ้น

            AppoSlideStoryboard.Completed += (s, e) => {
                FirstImage.Source = _currentCard.ImageSource;
                AppoSlideStoryboard.Stop();
                CardNameTextBlock.Text = _currentCard.Name;
            };

            #endregion การเลื่อนการ์ดเสร็จสิ้น
        }
 /// <summary>
 /// Assigns the specified card information.
 /// </summary>
 /// <param name="cardInformation">The card information.</param>
 private void Assign(CardInformation cardInformation)
 {
     this.accessCardNumber = cardInformation.Id;
     this.personsParty.SelectedPerson.LinkId = Guid.NewGuid().ToString();
     this.personsParty.SelectedPerson.GangwayEventProcessType = GangwayEventProcessType.Barcode;
     var task = Task.Run(async () => { await PersonsService.AssignCard(this.personsParty.SelectedPerson.PersonId, this.accessCardNumber, this.personsParty.SelectedPerson); this.AccessCardNumber = cardInformation.Id; this.NotifyPropertyChange(AccessCardNumberPropertyName); });
     task.Wait();
 }
 /// <summary>
 /// Assigns the card.
 /// </summary>
 /// <param name="cardInformation">The card information.</param>
 private void AssignCard(CardInformation cardInformation)
 {
     if (cardInformation != null)
     {
         ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => Messenger.Instance.Notify(MessengerMessage.ShowSpinWheel, true)));
         ObservableManager.RunObservable(() => this.Assign(cardInformation), this.OnCardAssignment);
     }
 }
        // ได้รับข้อตารางลำดับคะแนนกลับไป
        private void getScoreTableCallback(ScoreTableResponse scoreTable)
        {
            if (scoreTable != null) {

                _table = scoreTable;
                _currentCard = _table.CardLevelList.FirstOrDefault();

                if (_currentCard != null)
                {
                    FirstImage.Source = _currentCard.ImageSource;
                    CardNameTextBlock.Text = _currentCard.Name;
                    displayCardRank(_currentCard);
                    _displayCardTimer.Start();
                }
            }
        }
예제 #38
0
        /// <summary>
        /// Function to search person for bar code scanning.
        /// </summary>
        /// <param name="cardDetail">Detail of card</param>
        private void SearchPersonForBarcodeScanning(CardInformation cardDetail)
        {
            var cardData = cardDetail.Id;
            if (cardDetail.PersonType.Equals(CardInformationExtension.Guest, StringComparison.OrdinalIgnoreCase) && cardDetail.CardType == CardType.Barcode)
            {
                cardData = cardDetail.CardData;
            }

            SearchType searchType = cardDetail.CardType == CardType.Barcode ? SearchType.BarcodeScanning : cardDetail.CardType == CardType.MagStripe ? SearchType.MagneticStripe : SearchType.RFID;
            var personType = CardInformationExtension.RetrieveCardPersonType(cardDetail);
            var task = Task.Run(() => DIContainer.Instance.Resolve<SearchManager>().RetrievePersonsBySearchText(this.workstation.Ship.ShipId, cardData, personType, searchType, VisitorSearchType.None, null, () => this.OnBarcodeSearchCompleted(cardDetail), false, this.PageIndex, folioNumber: cardDetail.FolioNumber));
            task.Wait();

            if (!task.IsCanceled && !task.IsFaulted)
            {
            }
        }
예제 #39
0
        /// <summary>
        /// Retrieves the guest for card.
        /// </summary>
        /// <param name="cardNumber">The card number.</param>
        /// <param name="cardDetail">The card detail.</param>
        /// <returns>
        /// Instance of PersonBase
        /// </returns>
        private PersonBase RetrieveGuestforCard(string cardNumber, CardInformation cardDetail)
        {
            if (this.CurrentParty.Guests.Count > 0 && (cardDetail.CardType == CardType.Barcode))
            {
                var guest = this.CurrentParty.Guests.FirstOrDefault(g => g.Folios.Any(f => !string.IsNullOrEmpty(f.AccessCardNumber) && f.AccessCardNumber.Equals(cardNumber, StringComparison.OrdinalIgnoreCase)));
                return guest != null ? guest.MapToPersonBase() : null;
            }
            else if (this.CurrentParty.Guests.Count > 0 && (cardDetail.CardType == CardType.MagStripe || cardDetail.CardType == CardType.Rfid))
            {
                var guest = this.CurrentParty.Guests.FirstOrDefault(g => g.PersonalDetail.SourceId.Equals(cardNumber, StringComparison.OrdinalIgnoreCase));
                return guest != null ? guest.MapToPersonBase() : null;
            }

            return null;
        }
예제 #40
0
 /// <summary>
 /// Function to handle when barcode search is completed.
 /// </summary>
 /// <param name="cardDetail">The card detail</param>
 private void OnBarcodeSearchCompleted(CardInformation cardDetail)
 {
     this.OnSearchCompleted();
     ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { this.OnRetrievalCardPerson(cardDetail); }));
 }
예제 #41
0
        /// <summary>
        /// Assigns the barcode detail.
        /// </summary>
        /// <param name="cardDetail">The card detail.</param>
        /// <returns>returns card data</returns>
        private static string AssignBarcodeDetail(CardInformation cardDetail)
        {
            var cardData = cardDetail.Id;
            if (cardDetail.PersonType.Equals(CardInformationExtension.Guest, StringComparison.OrdinalIgnoreCase) && cardDetail.CardType == CardType.Barcode)
            {
                cardData = cardDetail.CardData;
            }

            LogManager.Write("Card Data: " + cardData + ", PersonType: " + cardDetail.PersonType);
            return cardData;
        }
예제 #42
0
        /// <summary>
        /// Searches the by bar code scanning.
        /// </summary>
        /// <param name="cardDetail">Information related Card</param>
        private void ChangeBoardingStatusForSearchByBarcodeScanning(CardInformation cardDetail)
        {
            var cardData = cardDetail.Id;
            if (cardDetail.PersonType.Equals(CardInformationExtension.Guest, StringComparison.OrdinalIgnoreCase) && cardDetail.CardType == CardType.Barcode)
            {
                cardData = cardDetail.CardData;
            }

            var currentParty = this.personsPartyManager.CurrentParty;

            if (currentParty.IsPartyCreated)
            {
                PersonBase personBase;

                personBase = this.personsPartyManager.RetrieveExistingPersonForCardNumber(cardData, cardDetail.RetrieveCardPersonType().FirstOrDefault(), cardDetail);

                if (personBase != null && this.workstation.User.UserAllowedFeatures.Contains(FeatureCodeConstants.BoardingStatusChange)
                    && (personBase.BoardStatus == BoardStatus.None || (personBase.BoardStatus == BoardStatus.Ashore && this.workstation.CanOnboard) || (personBase.BoardStatus == BoardStatus.Onboard && this.workstation.CanAshore)))
                {
                    personBase.GangwayEventProcessType = GangwayEventProcessType.Barcode;
                    if ((this.Workstation.FlowDirection == Domain.FlowDirection.BothDirection) || (this.workstation.FlowDirection == Domain.FlowDirection.Embark && (!personBase.IsOnboard && this.Workstation.CanOnboard)) || (this.workstation.FlowDirection == Domain.FlowDirection.Debark && (personBase.IsOnboard && this.Workstation.CanAshore)))
                    {
                        Messenger.Instance.Notify(MessengerMessage.ChangePersonBoardingStatus, personBase);
                    }
                }

                if (this.Workstation.FlowDirection == Domain.FlowDirection.ClearAlert)
                {
                    if (personBase.Alerts.Count > 0)
                    {
                        Messenger.Instance.Notify(MessengerMessage.OpenPersonAlert, Tuple.Create<PersonBase, bool?, bool, bool>(personBase, null, personBase.Alerts.Any(s => s.IsSoundEnable), true));
                    }
                }

                PersonSelectionService.SelectPerson(personBase);
            }
            else
            {
                ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => this.PlaySound(AudibleAlert.PersonNotFound)));
            }

            HideSpinWheel();
            this.IsBusy = false;
        }
예제 #43
0
        /// <summary>
        /// Assigns the visitor access card.
        /// </summary>
        /// <param name="cardDetail">The card detail.</param>
        /// <param name="currentParty">The current party.</param>
        private void AssignVisitorAccessCard(CardInformation cardDetail, PersonsParty currentParty)
        {
            this.IsPopupOpen = false;

            if (!string.IsNullOrEmpty(currentParty.SelectedPerson.CardNumber) && currentParty.SelectedPerson.CardNumber.Equals(cardDetail.Id) && currentParty.SelectedPerson.IsAccessCardAssigned)
            {
                Messenger.Instance.Notify(MessengerMessage.ShowSelectedPartyDetailTab, SelectedIndex);
                currentParty.PartyDetailSelectedTab = Stateroom;
                this.ChangeBoardingStatusForSearchByBarcodeScanning(cardDetail);
            }
            else if (!string.IsNullOrEmpty(currentParty.SelectedPerson.CardNumber) && !currentParty.SelectedPerson.CardNumber.Equals(cardDetail.Id) && currentParty.SelectedPerson.IsAccessCardAssigned)
            {
                this.SearchErrorText = string.Empty;
                ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { this.PlaySound(AudibleAlert.PersonNotFound); this.IsPopupOpen = true; }));
                this.SearchErrorText = Properties.Resources.VisitorAlreadyCardAssignedMessage;
            }
            else
            {
                Messenger.Instance.Notify(MessengerMessage.ShowSelectedPartyDetailTab, SelectedIndex);
                ShowSpinWheel();
                currentParty.PartyDetailSelectedTab = Stateroom;
                Messenger.Instance.Notify(MessengerMessage.AssignCard, cardDetail);
                this.IsPopupOpen = false;
            }

            this.IsBusy = false;
        }
 public void AddNewNameToTheList(CardInformation c)
 {
     completeNameList.Add(c.name);
     completeCardList.Add(c);
 }
예제 #45
0
        /// <summary>
        /// Function to retrieve existing person from party for a card number.
        /// </summary>
        /// <param name="cardNumber">Number of card</param>l
        /// <param name="personType">Type of person</param>
        /// <param name="cardDetail">The card detail.</param>
        /// <returns>
        /// Instance of PersonBase
        /// </returns>
        public PersonBase RetrieveExistingPersonForCardNumber(string cardNumber, PersonType personType, CardInformation cardDetail)
        {
            if (this.CurrentParty != null && this.CurrentParty.IsPartyCreated)
            {
                if (personType == PersonType.Guest)
                {
                    return this.RetrieveGuestforCard(cardNumber, cardDetail);
                }

                if (personType == PersonType.Crewmember && this.CurrentParty.Crew.Count > 0)
                {
                    var crewMember = this.CurrentParty.Crew.FirstOrDefault(c => c.CrewmemberAccessCards.Any(f => !string.IsNullOrEmpty(f.AccessCardNumber) && f.AccessCardNumber.Equals(cardNumber, StringComparison.OrdinalIgnoreCase)));
                    return crewMember != null ? crewMember.MapToPersonBase() : null;
                }

                if (personType == PersonType.Visitor && this.CurrentParty.Visitors.Count > 0)
                {
                    var visitor = this.CurrentParty.Visitors.FirstOrDefault(c => !string.IsNullOrEmpty(c.CardNumber) && c.CardNumber.Equals(cardNumber, StringComparison.OrdinalIgnoreCase));
                    return visitor != null ? visitor.MapToPersonBase() : null;
                }
            }

            return null;
        }
예제 #46
0
        /// <summary>
        /// Retrieves the search using barcode.
        /// </summary>
        /// <param name="cardDetail">Information related Card</param>
        private void RetrieveSearchUsingBarcode(CardInformation cardDetail)
        {
            ScreenKeyboardNativeMethods.HideKeyboard();

            if (cardDetail == null || Application.Current.Windows.Count > 2 || (Application.Current.Windows.Count == 2 && !Application.Current.Windows.OfType<Window>().Any(w => w.Name.Equals("cameraWindow", StringComparison.OrdinalIgnoreCase))))
            {
                return;
            }

            cardDetail.PersonType = string.IsNullOrEmpty(cardDetail.PersonType) ? CardInformationExtension.Guest : cardDetail.PersonType;
            string cardData = AssignBarcodeDetail(cardDetail);

            if (!this.IsBusy)
            {
                this.IsBusy = true;
                var currentParty = this.personsPartyManager.CurrentParty;
                if (this.CurrentViewType == ViewType.PartyDetails && currentParty != null && !string.IsNullOrEmpty(currentParty.PartyDetailSelectedTab) && currentParty.PartyDetailSelectedTab.Equals(AssignCard) && cardDetail.RetrieveCardPersonType().FirstOrDefault() == PersonType.Visitor)
                {
                    this.AssignVisitorAccessCard(cardDetail, currentParty);
                }
                else
                {
                    if (!this.IsAlertPopupOpened && (this.CurrentViewType == ViewType.PartyDetails || this.CurrentViewType == ViewType.SearchGuest || this.CurrentViewType == ViewType.Home))
                    {
                        ShowSpinWheel();
                        var existingCardPerson = this.personsPartyManager.RetrieveExistingPersonForCardNumber(cardData, cardDetail.RetrieveCardPersonType().FirstOrDefault(), cardDetail);

                        if (existingCardPerson != null)
                        {
                            var guests = new GuestCollection();
                            this.personsPartyManager.CurrentParty.Guests.Iterate(g => guests.Add(g));
                            PersonsService.UpdateCardDisabled(guests, cardData, cardDetail.FolioNumber);
                            ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => this.ShowDisabledCardMessage(currentParty, true)));
                            this.OnRetrievalCardPerson(cardDetail);
                            Messenger.Instance.Notify(MessengerMessage.ShowSelectedPartyDetailTab, SelectedIndex);
                            currentParty.PartyDetailSelectedTab = Stateroom;
                            if (this.Workstation.FlowDirection == Domain.FlowDirection.AgeVerification)
                            {
                                ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => Messenger.Instance.Notify(MessengerMessage.ShowAgeVerificationPopup, null)));
                            }
                        }
                        else
                        {
                            this.SetErrorTextMessage(cardDetail, currentParty);

                            // ToDo: ship ID
                            ObservableManager.RunObservable(() => this.SearchPersonForBarcodeScanning(cardDetail), null, () => { this.IsBusy = false; });
                        }
                    }
                    else
                    {
                        ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => HideSpinWheel()));
                        this.IsBusy = false;
                    }
                }
            }
        }
예제 #47
0
 /// <summary>
 /// Function to process on retrieval of person having card.
 /// </summary>
 /// <param name="cardDetail">Information related Card</param>
 private void OnRetrievalCardPerson(CardInformation cardDetail)
 {
     if (this.personsPartyManager.CurrentParty != null && this.personsPartyManager.CurrentParty.IsPartyCreated && !this.personsPartyManager.CurrentParty.Guests.Any(g => g.IsDisabledCard))
     {
         this.ChangeBoardingStatusForSearchByBarcodeScanning(cardDetail);
     }
     else
     {
         ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => HideSpinWheel()));
         this.IsBusy = false;
     }
 }
예제 #48
0
 /// <summary>
 /// Sets the error text message.
 /// </summary>
 /// <param name="cardDetail">The card detail.</param>
 /// <param name="currentParty">The current party.</param>
 private void SetErrorTextMessage(CardInformation cardDetail, PersonsParty currentParty)
 {
     this.SearchErrorText = string.Empty;
     if (this.CurrentViewType == ViewType.PartyDetails && !string.IsNullOrEmpty(currentParty.PartyDetailSelectedTab) && currentParty.PartyDetailSelectedTab.Equals(AssignCard) && cardDetail.RetrieveCardPersonType().FirstOrDefault() != PersonType.Visitor)
     {
         this.SearchErrorText = Properties.Resources.VisitorCardErrorMessage;
     }
     else
     {
         this.SearchErrorText = Properties.Resources.NoResultForBarcode;
     }
 }