Example #1
0
 public CardResponse updatecard(CardDetails card)
 {
     try
     {
         TB_ECOMM_CARD_DETAILS CD = entity.TB_ECOMM_CARD_DETAILS.Find(card.CARD_ID);
         CD.CARD_CVV         = card.CARD_CVV;
         CD.CARD_EXP_DATE    = card.CARD_EXP_DATE;
         CD.CARD_HOLDER_NAME = card.CARD_HOLDER_NAME;
         CD.CARD_NUMBER      = card.CARD_NUMBER;
         CD.CARD_TYPE        = card.CARD_TYPE;
         CD.CARD_DEFAULT     = card.CARD_DEFAULT;
         CD.MODIFIED_DATE    = DateTime.Now;
         this.entity.SaveChanges();
         entity.SaveChanges();
         return(new CardResponse
         {
             Status = "Success", Message = "Card Updated."
         });
     }
     catch (DbEntityValidationException ex)
     {
         foreach (var entityValidationErrors in ex.EntityValidationErrors)
         {
             foreach (var validationError in entityValidationErrors.ValidationErrors)
             {
                 throw new Exception("Error" + validationError.ErrorMessage);
                 //return new ApiResponse { Status = "Error", Message = validationError.ErrorMessage };
             }
             throw new Exception("Error" + entityValidationErrors.ValidationErrors);
         }
         throw new Exception("Error" + ex.Message);
     }
 }
Example #2
0
	public void initiatetextures() {
		//create xml object
		XmlReader reader = XmlReader.Create (new StringReader((Resources.Load("carddetails") as TextAsset).text));

		//parse xml
		while (reader.Read ()) {
			if (reader.NodeType == XmlNodeType.Element) {
				string path = reader.GetAttribute("texture"); //get texture path from tag data
				//continue to the next line if the tag encountered doesn't have a texture
				if (path == null) { continue; }

				//creates the carddetails object to store card details from the xml file
				CardDetails details = new CardDetails();
				details.texture = Resources.Load(path) as Texture;

                details.health = int.Parse(reader.GetAttribute("health"));
                details.manacost = int.Parse(reader.GetAttribute("mana"));
                details.damage = int.Parse(reader.GetAttribute("damage"));
				carddetails.Add(details);
			}
		}
		reader.Close ();

		//other cards
		backcard = Resources.Load ("backcard") as Texture;
	}
Example #3
0
    public void loadCardDetails(GameObject cardDetails)
    {
        GameObject go = Instantiate(cardDetails, transform.transform);

        details           = go.GetComponent <CardDetails>();
        details.character = character;
        details.cardBase  = this;
        details.prefabRef = cardDetails;
        name = details.cardName;
        string subtypesKey = "";

        magicParticles.gameObject.SetActive(false);
        foreach (CardSubType type in details.subTypes)
        {
            string subType = type.ToString().ToLower();
            if (subType.Equals("magic"))
            {
                magicParticles.gameObject.SetActive(true);
            }
            else
            {
                subtypesKey += subType;
            }
        }
        cardMeshRenderer.material = MaterialDictionary.Instance().materialDictionary[subtypesKey];
        cardNameMesh.text         = details.cardName;
        energyPlayCostMesh.text   = details.getEnergyPlayCost().ToString();
        focusPlayCostMesh.text    = (details.getFocusPlayCost() > 0 ? details.getFocusPlayCost().ToString() : "");
        artSprite.sprite          = details.art;
        typelineMesh.text         = details.getTypeLine();
        focusLearnCostMesh.text   = details.getFocusLearnCost().ToString();
        resetCardInfo();
    }
        private CardDetails GetCardDetails(CardType card)
        {
            var cardDetails = new CardDetails {
                Card = card.ToString()
            };

            switch (card)
            {
            case CardType.None:
                cardDetails.CardDisplay = "no credit cards are available";
                break;

            case CardType.Vanquis:
                cardDetails.CardDisplay = "Vanquis";
                cardDetails.CardPromo   = "easy to get accepted and a reasonable APR";
                cardDetails.CardAPR     = "17.9% APR";
                break;

            case CardType.Barclaycard:
                cardDetails.CardDisplay = "Barclaycard";
                cardDetails.CardPromo   = "a card for the more distinguished applicant offering industry leading rates";
                cardDetails.CardAPR     = "12.9% APR";
                break;
            }

            return(cardDetails);
        }
Example #5
0
        protected virtual XElement Cv2AvsElement(CardDetails card, BillingAddress billingAddress, Cv2AvsPolicy policy)
        {
            var cv2AvsElements = new List <XElement>();

            if (billingAddress != null)
            {
                var numericAddress = numericPartsOfAddress(billingAddress);
                if (!string.IsNullOrWhiteSpace(numericAddress))
                {
                    cv2AvsElements.Add(new XElement("street_address1", numericAddress));
                }

                var formattedPostcode = formatPostcode(billingAddress.Postcode);
                if (!string.IsNullOrWhiteSpace(formattedPostcode))
                {
                    cv2AvsElements.Add(new XElement("postcode", formattedPostcode));
                }
            }

            // 0 is not a valid per-transaction policy code.
            var cvPolicy = (int)policy;

            if (cvPolicy > 0)
            {
                cv2AvsElements.Add(new XElement("policy", cvPolicy));
            }

            cv2AvsElements.Add(new XElement("cv2", card.Cv2));
            return(new XElement("Cv2Avs", cv2AvsElements.ToArray()));
        }
Example #6
0
        public ActionResult AddCard(CardDetails l)
        {
            DataContext context = HttpContext.RequestServices.GetService(typeof(HearthPub.Models.DataContext)) as DataContext;

            context.Add(l);
            return(RedirectToAction("Index", "Card"));
        }
Example #7
0
        public void UpdataBalance(string cardNumber, double newLimit)
        {
            CardDetails card  = cardDetails.SingleOrDefault(c => c.CreditCardNumber == cardNumber);
            int         index = cardDetails.IndexOf(card);

            cardDetails[index].Limit = newLimit;
        }
Example #8
0
    public override void activateAbility(CardDetails details)
    {
        GameObject buffGO = Instantiate(abilityPrefab, details.character.transform);
        BaseBuff   buff   = buffGO.GetComponent <BaseBuff>();

        buff.createBuff(details.character, details.character);
    }
        public CardDetails GetCardSerialNumber(string loggedInUsername)
        {
            var pd = new CardDetails();

            try
            {
                if (!string.IsNullOrEmpty(loggedInUsername))
                {
                    var details = CardPL.GetCardSerialNumber(loggedInUsername);

                    if (details == null)
                    {
                        pd.response = String.Format("{0}|{1}", "Failed", "No available card serial number.");
                    }
                    else
                    {
                        pd          = details;
                        pd.response = String.Format("{0}|{1}", "Success", "Card serial number exists.");
                    }
                }
                else
                {
                    pd.response = String.Format("{0}|{1}", "Failed", "Username of the logged in user is required.");
                }
            }
            catch (Exception ex)
            {
                pd.response = String.Format("{0}|{1}", "Failed", ex.Message);
                ErrorHandler.WriteError(ex);
            }

            return(pd);
        }
Example #10
0
        public async Task Handle_CallsBankApiAndReturnsIdAndStatus()
        {
            var paymentId = Guid.NewGuid();

            var cardDetails = new CardDetails()
            {
                Cvv    = "123",
                Expiry = "08/09",
                Number = "1234567890"
            };
            var amount   = 10m;
            var currency = "GBP";

            var paymentCache = new Mock <IPaymentCache>();
            var bank         = new Mock <IBank>();

            bank.Setup(x => x.MakePayment(It.Is <CardDetails>(x => x == cardDetails), It.Is <decimal>(x => x == amount), It.Is <string>(x => x == currency)))
            .ReturnsAsync(new BankResponse()
            {
                Id = paymentId, Status = PaymentStatus.Successful
            });
            var commandHandler = new MakePaymentCommandHandler(bank.Object, paymentCache.Object);

            var result = await commandHandler.Handle(new MakePaymentCommand()
            {
                CardDetails = cardDetails, Amount = amount, Currency = currency
            }, new System.Threading.CancellationToken());

            paymentCache.Verify(x => x.AddDetails(It.Is <PaymentDetails>(y => y.CardDetails == cardDetails && y.Amount == amount && y.Currency == currency && y.PaymentId == paymentId && y.Status == PaymentStatus.Successful)));
            result.PaymentId.Should().Be(paymentId);
            result.Successful.Should().Be(true);
        }
Example #11
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Tender other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((TransactionId == null && other.TransactionId == null) || (TransactionId?.Equals(other.TransactionId) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((ProcessingFeeMoney == null && other.ProcessingFeeMoney == null) || (ProcessingFeeMoney?.Equals(other.ProcessingFeeMoney) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((CardDetails == null && other.CardDetails == null) || (CardDetails?.Equals(other.CardDetails) == true)) &&
                   ((CashDetails == null && other.CashDetails == null) || (CashDetails?.Equals(other.CashDetails) == true)) &&
                   ((AdditionalRecipients == null && other.AdditionalRecipients == null) || (AdditionalRecipients?.Equals(other.AdditionalRecipients) == true)) &&
                   ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)));
        }
        public CardDetails RetrieveCardDetails(string cardNumber)
        {
            var pd = new CardDetails();

            try
            {
                if (string.IsNullOrEmpty(cardNumber))
                {
                    pd.response = String.Format("{0}|{1}", "Failed", "Pan has no value.");
                }
                else
                {
                    string hashed_pan = PasswordHash.MD5Hash(cardNumber);

                    var details = CardPL.RetrievePregeneratedCard(hashed_pan);

                    if (details == null)
                    {
                        pd.response = String.Format("{0}|{1}", "Failed", "Pan does not exist.");
                    }
                    else
                    {
                        pd          = details;
                        pd.response = String.Format("{0}|{1}", "Success", "Pan exists.");
                    }
                }
            }
            catch (Exception ex)
            {
                pd.response = String.Format("{0}|{1}", "Failed", ex.Message);
                ErrorHandler.WriteError(ex);
            }

            return(pd);
        }
Example #13
0
        public string CardDetails(CardDetails details)
        {
            PaymentDetails Response;
            var            data  = JsonConvert.SerializeObject(details);
            var            value = new StringContent(data, Encoding.UTF8, "application/json");

            using (var client = new HttpClient())
            {
                var response = client.PostAsync(_config["Links:PaymentMicroService"] + "/ProcessPayment", value).Result;

                if (response.IsSuccessStatusCode)
                {
                    var result = response.Content.ReadAsStringAsync().Result;
                    Response = JsonConvert.DeserializeObject <PaymentDetails>(result);
                    if (Response.Message == "Successful")
                    {
                        return("Successful");
                    }
                    else
                    {
                        return("Failed");
                    }
                }
                else
                {
                    return("Failed");
                }
            }
        }
Example #14
0
 public string GetUserMessage(Submission message)
 {
     _log4net.Info("GetUserMessage() called with user message as input");
     if (message.Result == "True")
     {
         CardDetails detail = new CardDetails()
         {
             CreditCardNumber = RequestObject.CreditCardNumber,
             CreditLimit      = Limit,
             ProcessingCharge = ResponseObject.ProcessingCharge + ResponseObject.PackagingAndDeliveryCharge
         };
         var result = CardDetails(detail);
         if (result == "Successful")
         {
             return("Success");
         }
         else
         {
             return("Failed");
         }
     }
     else
     {
         return("Payment not initiated");
     }
 }
Example #15
0
        private async Task <bool> ProcessPremiumPayment(CardDetails cardDetails)
        {
            bool flagloop         = false;
            var  transctionResult = await AddPaymentTransaction(cardDetails, "Premium");

            var service = _serviceResolver(ServiceEnum.Premium);
            var result  = await service.ProcessPayment(cardDetails);

            if (!result.IsProcessed)
            {
                for (int count = 0; count <= 2; count++)
                {
                    var loopResult = await service.ProcessPayment(cardDetails);

                    if (loopResult.IsProcessed)
                    {
                        flagloop = true;
                        await UpdatePaymentTransaction(transctionResult, "Premium", loopResult.Status);

                        break;
                    }
                }
            }

            if (!flagloop)
            {
                await UpdatePaymentTransaction(transctionResult, "Premium", result.Status);
            }

            return(true);
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,CardNum,ExpDate,CvsNum")] CardDetails cardDetails)
        {
            if (id != cardDetails.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cardDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CardDetailsExists(cardDetails.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cardDetails));
        }
Example #17
0
        public async Task ShouldFindAndReturnData()
        {
            var cardDetails = new CardDetails(
                "Jim",
                "Jimson",
                "1234-5678-8765-4321",
                10,
                20,
                321);
            var payment = new Payment(Guid.NewGuid(), cardDetails, Currency.GBP, 123M);

            var paymentResult = Result.Ok(payment);

            _mockPaymentHistoryRepository.Setup(p => p.GetPaymentById(It.IsAny <Guid>())).ReturnsAsync(paymentResult);

            var sut = new GetPaymentByIdQueryHandler(_mockPaymentHistoryRepository.Object, _mockMetrics.Object);

            var query = new GetPaymentByIdQuery(Guid.NewGuid());

            var result = await sut.Handle(query, default);

            _mockPaymentHistoryRepository.Verify(p => p.GetPaymentById(It.IsAny <Guid>()), Times.Once());
            Assert.True(result.IsSuccess);
            Assert.True(result.Value.Amount == 123M);
        }
Example #18
0
 public TransactionAuthRequest(
     CardDetails cardDetails,
     decimal amount)
 {
     CardDetails = cardDetails;
     Amount      = amount;
 }
Example #19
0
        public ActionResult CardDetails(CardDetails objPlan)
        {
            //var Cardnum = Helpers.MyExtensions.Decrypt(objUser.CardNumber, objUser.SaltKey); To Decrypt the Card
            var objUserCards = this._cardDetails.FindAll()
                               .Where(x => x.UserId == UserId)
                               .Select(x =>
            {
                var data = new CardDetails
                {
                    CardId          = x.Id,
                    CardNumber      = "XXXX-XXXX-XXXX-" + x.LastFourDigits,
                    NameOnCard      = x.NameOnCard,
                    CardType        = x.CardType,
                    ExpirationMonth = Convert.ToInt32(x.ExpiryMonth),
                    ExpirationYear  = Convert.ToInt32(x.ExpiryYear),
                    CVV             = "XX" + x.CVV1.Substring(x.CVV1.Length - 1, 1),
                    IsDefault       = x.IsDefaultCard.Value,
                    IsAutoRenewable = x.IsAutoRenewable.Value
                };
                return(data);
            }).ToList();

            TempData["PlanName"] = objPlan.PlanName;
            TempData["Amount"]   = objPlan.Amount;
            TempData["Validity"] = objPlan.ValidTill;
            TempData["IsSucess"] = TempData["IsSucess"] != null ? TempData["IsSucess"] : null;
            return(View("_CardDetails", objUserCards));
        }
Example #20
0
        public CardDetails GetUserDefaultCard(long userProfileId)
        {
            CardDetails defaultCard = null;
            UserProfile user        = null;

            try
            {
                user = UserProfileDao.Find(userProfileId);
            } catch (InstanceNotFoundException e)
            {
                throw new InstanceNotFoundException(userProfileId, "Usuario no encontrado");
            }
            List <Card> userCards = user.Cards.ToList();

            if (userCards != null)
            {
                for (int i = 0; i < userCards.Count; i++)
                {
                    if (userCards.ElementAt(i).defaultCard)
                    {
                        string   cardNumber = userCards.ElementAt(i).cardNumber;
                        string   cardType   = userCards.ElementAt(i).cardType;
                        int      cv         = userCards.ElementAt(i).verificationCode;
                        bool     defaultC   = userCards.ElementAt(i).defaultCard;
                        long     cardId     = userCards.ElementAt(i).idCard;
                        DateTime date       = userCards.ElementAt(i).expirationDate;
                        defaultCard = new CardDetails(cardNumber, cv, date, cardType, cardId, defaultC);
                    }
                }
            }
            return(defaultCard);
        }
 public override List <ICardDetails> Select()
 {
     Source = "sp_FetchCardDetails ";
     try
     {
         Object[] param =
         {
             new MySqlParameter("@paramToken", UserProfileObj.GetToken())
         };
         DataSet             Output     = Commands.ExecuteQuery(Source, CommandType.StoredProcedure, param);
         List <ICardDetails> CardDetail = new List <ICardDetails>();
         foreach (DataRow dr in Output.Tables[0].Rows)
         {
             ICardDetails CardObj = new CardDetails();
             CardObj.SetCardID(Int32.Parse(dr["caID"].ToString()));
             CardObj.SetName(dr["CardNameEncrypt"].ToString());
             CardObj.SetCardNumber(dr["CardNumberEncrypt"].ToString());
             CardObj.SetExpiryMonth(dr["ExpiryMonthEncrypt"].ToString());
             CardObj.SetExpiryYear((dr["ExpiryYearEncrypt"].ToString()));
             CardObj.SetCvv((dr["CvvEncrypt"].ToString()));
             CardObj.SetIV(dr["Salt"].ToString());
             CardObj.SetDecryptionKey(dr["DecryptionKey"].ToString());
             CardDetail.Add(CardObj);
         }
         return(CardDetail);
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }
Example #22
0
 public static PaymentConfirmation ChargeCreditCard(CardDetails details, double amount)
 {
     return(new PaymentConfirmation
     {
         Status = PaymentStatus.Accepted
     });
 }
Example #23
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}");
     toStringOutput.Add($"CreatedAt = {(CreatedAt == null ? "null" : CreatedAt == string.Empty ? "" : CreatedAt)}");
     toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}");
     toStringOutput.Add($"AmountMoney = {(AmountMoney == null ? "null" : AmountMoney.ToString())}");
     toStringOutput.Add($"TipMoney = {(TipMoney == null ? "null" : TipMoney.ToString())}");
     toStringOutput.Add($"TotalMoney = {(TotalMoney == null ? "null" : TotalMoney.ToString())}");
     toStringOutput.Add($"AppFeeMoney = {(AppFeeMoney == null ? "null" : AppFeeMoney.ToString())}");
     toStringOutput.Add($"ProcessingFee = {(ProcessingFee == null ? "null" : $"[{ string.Join(", ", ProcessingFee)} ]")}");
     toStringOutput.Add($"RefundedMoney = {(RefundedMoney == null ? "null" : RefundedMoney.ToString())}");
     toStringOutput.Add($"Status = {(Status == null ? "null" : Status == string.Empty ? "" : Status)}");
     toStringOutput.Add($"DelayDuration = {(DelayDuration == null ? "null" : DelayDuration == string.Empty ? "" : DelayDuration)}");
     toStringOutput.Add($"DelayAction = {(DelayAction == null ? "null" : DelayAction == string.Empty ? "" : DelayAction)}");
     toStringOutput.Add($"DelayedUntil = {(DelayedUntil == null ? "null" : DelayedUntil == string.Empty ? "" : DelayedUntil)}");
     toStringOutput.Add($"SourceType = {(SourceType == null ? "null" : SourceType == string.Empty ? "" : SourceType)}");
     toStringOutput.Add($"CardDetails = {(CardDetails == null ? "null" : CardDetails.ToString())}");
     toStringOutput.Add($"LocationId = {(LocationId == null ? "null" : LocationId == string.Empty ? "" : LocationId)}");
     toStringOutput.Add($"OrderId = {(OrderId == null ? "null" : OrderId == string.Empty ? "" : OrderId)}");
     toStringOutput.Add($"ReferenceId = {(ReferenceId == null ? "null" : ReferenceId == string.Empty ? "" : ReferenceId)}");
     toStringOutput.Add($"CustomerId = {(CustomerId == null ? "null" : CustomerId == string.Empty ? "" : CustomerId)}");
     toStringOutput.Add($"EmployeeId = {(EmployeeId == null ? "null" : EmployeeId == string.Empty ? "" : EmployeeId)}");
     toStringOutput.Add($"RefundIds = {(RefundIds == null ? "null" : $"[{ string.Join(", ", RefundIds)} ]")}");
     toStringOutput.Add($"RiskEvaluation = {(RiskEvaluation == null ? "null" : RiskEvaluation.ToString())}");
     toStringOutput.Add($"BuyerEmailAddress = {(BuyerEmailAddress == null ? "null" : BuyerEmailAddress == string.Empty ? "" : BuyerEmailAddress)}");
     toStringOutput.Add($"BillingAddress = {(BillingAddress == null ? "null" : BillingAddress.ToString())}");
     toStringOutput.Add($"ShippingAddress = {(ShippingAddress == null ? "null" : ShippingAddress.ToString())}");
     toStringOutput.Add($"Note = {(Note == null ? "null" : Note == string.Empty ? "" : Note)}");
     toStringOutput.Add($"StatementDescriptionIdentifier = {(StatementDescriptionIdentifier == null ? "null" : StatementDescriptionIdentifier == string.Empty ? "" : StatementDescriptionIdentifier)}");
     toStringOutput.Add($"ReceiptNumber = {(ReceiptNumber == null ? "null" : ReceiptNumber == string.Empty ? "" : ReceiptNumber)}");
     toStringOutput.Add($"ReceiptUrl = {(ReceiptUrl == null ? "null" : ReceiptUrl == string.Empty ? "" : ReceiptUrl)}");
 }
Example #24
0
        public void CustomerCreationTest()
        {
            CardDetails details  = new CardDetails("01912664311", "10/11", "10/13");
            Customer    customer = new Customer("Customer", "*****@*****.**", details);

            Assert.AreEqual("Customer ([email protected])", customer.ToString());
        }
Example #25
0
 public CardResponse addpaymentdetail(CardDetails address)
 {
     try
     {
         TB_ECOMM_CARD_DETAILS AD = new TB_ECOMM_CARD_DETAILS();
         AD.USER_ID          = address.USER_ID;
         AD.CARD_CVV         = address.CARD_CVV;
         AD.CARD_EXP_DATE    = address.CARD_EXP_DATE;
         AD.CARD_HOLDER_NAME = address.CARD_HOLDER_NAME;
         AD.CARD_NUMBER      = address.CARD_NUMBER;
         AD.CARD_TYPE        = address.CARD_TYPE;
         AD.CARD_DEFAULT     = address.CARD_DEFAULT;
         AD.CREATED_DATE     = DateTime.Now;
         AD.MODIFIED_DATE    = DateTime.Now;
         entity.TB_ECOMM_CARD_DETAILS.Add(AD);
         entity.SaveChanges();
         return(new CardResponse
         {
             Status = "Success", Message = "Card Saved."
         });
     }
     catch (DbEntityValidationException ex)
     {
         foreach (var entityValidationErrors in ex.EntityValidationErrors)
         {
             foreach (var validationError in entityValidationErrors.ValidationErrors)
             {
                 throw new Exception("Error" + validationError.ErrorMessage);
                 //return new ApiResponse { Status = "Error", Message = validationError.ErrorMessage };
             }
             throw new Exception("Error" + entityValidationErrors.ValidationErrors);
         }
         throw new Exception("Error" + ex.Message);
     }
 }
Example #26
0
        public async Task DrawMaskAsync()
        {
            using (var g = new GraphicsService())
            {
                var d = new CardDetails(Context.Account, Context.User);

                using (Bitmap card = g.DrawCard(d, PaletteType.GammaGreen))
                {
                    using (var factory = new TextFactory())
                    {
                        Grid <float> mask = ImageHelper.GetOpacityMask(card);

                        var pixels = new Grid <Color>(card.Size, new ImmutableColor(0, 0, 0, 255));

                        // TODO: Make ImmutableColor.Empty values
                        pixels.SetEachValue((x, y) =>
                                            ImmutableColor.Blend(new ImmutableColor(0, 0, 0, 255), new ImmutableColor(255, 255, 255, 255),
                                                                 mask.GetValue(x, y)));

                        using (Bitmap masked = ImageHelper.CreateRgbBitmap(pixels.Values))
                            await Context.Channel.SendImageAsync(masked, $"../tmp/{Context.User.Id}_card_mask.png");
                    }
                }
            }
        }
Example #27
0
        public async Task GetCardAsync(SocketUser user = null)
        {
            user ??= Context.User;
            if (!Context.Container.TryGetUser(user.Id, out User account))
            {
                await Context.Channel.ThrowAsync("The specified user does not have an existing account.");

                return;
            }

            try
            {
                using var graphics = new GraphicsService();
                var d = new CardDetails(account, user);
                var p = CardProperties.Default;

                p.Palette = PaletteType.Glass;
                p.Trim    = false;
                p.Casing  = Casing.Upper;

                Bitmap card = graphics.DrawCard(d, p);

                await Context.Channel.SendImageAsync(card, $"../tmp/{Context.User.Id}_card.png");
            }
            catch (Exception ex)
            {
                await Context.Channel.CatchAsync(ex);
            }
        }
Example #28
0
        public async Task <CardDetails> CreateCardDetailsAsync(TransactionRepresenter transactionRepresenter)
        {
            if (transactionRepresenter == null || transactionRepresenter.Card == null)
            {
                return(null);
            }

            var cardEntity = await this.GetCardDetailsByNumberAsync(transactionRepresenter.Card.CardNumber).ConfigureAwait(false);

            if (cardEntity == null)
            {
                cardEntity = new CardDetails()
                {
                    CardNumber  = transactionRepresenter.Card.CardNumber,
                    Cvv         = transactionRepresenter.Card.Cvv,
                    ExpiryMonth = transactionRepresenter.Card.ExpiryMonth,
                    ExpiryYear  = transactionRepresenter.Card.ExpiryYear,
                    HolderName  = transactionRepresenter.Card.HolderName,
                };

                await this.AddCardAsync(cardEntity).ConfigureAwait(false);
            }
            ;
            return(cardEntity);
        }
Example #29
0
        public void GetUserDefaultCardTest()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                // Register user and find profile
                long userId =
                    userService.RegisterUser(loginName, clearPassword,
                                             new UserProfileDetails(firstName, lastName, email, language, country, address));

                UserProfile userProfile = userProfileDao.Find(userId);

                // Add a cards
                string      cardNumber      = "11111";
                int         verficationCode = 222;
                DateTime    expirationDate  = DateTime.Now;
                string      type            = "Credit";
                CardDetails cardDetails     = new CardDetails(cardNumber, verficationCode, expirationDate, type);
                cardService.AddCard(userId, cardDetails);

                string      cardNumber1      = "22222";
                int         verficationCode1 = 333;
                DateTime    expirationDate1  = DateTime.Now;
                string      type1            = "Debit";
                CardDetails cardDetails2     = new CardDetails(cardNumber1, verficationCode1, expirationDate1, type1);
                cardService.AddCard(userId, cardDetails2);

                CardDetails userDefaultCard = cardService.GetUserDefaultCard(userId);

                // Check the data
                Assert.AreEqual(userDefaultCard.CardNumber, cardNumber);
                Assert.AreEqual(userDefaultCard.ExpirateTime, expirationDate);
                Assert.AreEqual(userDefaultCard.VerificationCode, verficationCode);
                Assert.AreEqual(userDefaultCard.CardType, type);
            }
        }
Example #30
0
        public async Task GetCardAsync(SocketUser user = null)
        {
            user ??= Context.User;
            Context.TryGetUser(user.Id, out ArcadeUser account);

            if (await CatchEmptyAccountAsync(account))
            {
                return;
            }

            try
            {
                using var graphics = new GraphicsService();
                var d = new CardDetails(account, user);
                var p = CardProperties.Default;
                p.Font            = account.Card.Font;
                p.Palette         = account.Card.Palette.Primary;
                p.PaletteOverride = account.Card.Palette.Build();
                p.Trim            = false;
                p.Casing          = Casing.Upper;

                System.Drawing.Bitmap card = graphics.DrawCard(d, p);

                await Context.Channel.SendImageAsync(card, $"../tmp/{Context.User.Id}_card.png");
            }
            catch (Exception ex)
            {
                await Context.Channel.CatchAsync(ex);
            }
        }
Example #31
0
    }    //מעביר תשלום

    public bool CheckCard(CardDetails card)

    {
        //long total = long.Parse(card.CardID);
        //int sum = Check_id(ref total);
        //if (sum % 10 != 0)
        //return false;
        try
        {
            objConn.Open();
            objCmd             = new OleDbCommand("IdCheak", objConn);
            objCmd.CommandType = CommandType.StoredProcedure;
            OleDbParameter Param = new OleDbParameter();
            Param       = objCmd.Parameters.Add("@CardID", OleDbType.BSTR);
            Param.Value = card.CardID;
            Param       = objCmd.Parameters.Add("@ExpirationDate", OleDbType.BSTR);
            Param.Value = card.ExpirationDate;
            Param       = objCmd.Parameters.Add("@SecurityNumber", OleDbType.BSTR);
            Param.Value = card.SecurityNumber;
            object UserID = objCmd.ExecuteScalar();
            if (UserID != null)
            {
                return(true);
            }
            return(false);
        }
        catch (Exception Err)
        {
            throw Err;
        }
        finally { objConn.Close(); }
    }     //מקבלת פרטי כרטיס אשראי ומחזירה אמת אם פרטי הכרטיס תקינים והכרטיס שייך למשתמש
 protected virtual XElement CardElement(CardDetails card, BillingAddress billingAddress)
 {
     return new XElement("Card",
                         new XElement("pan", card.Number),
                         new XElement("expirydate", card.ExpiryDate),
                         new XElement("startdate", card.StartDate),
                         new XElement("issuenumber", card.IssueNumber),
                         Cv2AvsElement(card, billingAddress));
 }
Example #33
0
        private CardDetails createcard(int type) {
            //creates a new card based on the provided type
            CardDetails newcard = new CardDetails();
            newcard.type = type;
            newcard.damage = gamecode.carddetails[type].damage;
            newcard.health = gamecode.carddetails[type].health;
            newcard.manacost = gamecode.carddetails[type].manacost;

            return newcard;
        }
Example #34
0
        public I3DSecureResponse Payment(string merchantReference, decimal amount, CardDetails card)
        {
            if (string.IsNullOrWhiteSpace(merchantReference)) throw new ArgumentNullException("merchantReference");

            var requestDocument = _paymentPaymentRequestBuilder.Build(merchantReference, amount, card);
            var httpResponse = _httpClient.Post(_configuration.Host, requestDocument.ToString(SaveOptions.DisableFormatting));
            var response = _responseParser.Parse(httpResponse);
            if (response.CanAuthorize())
                response = Authorise(response.TransactionReference, null);
            return response;
        }
        protected virtual XElement Cv2AvsElement(CardDetails card, BillingAddress billingAddress)
        {
            var cv2AvsElements = new List<XElement>();
            if (billingAddress != null)
            {
                var numericAddress = numericPartsOfAddress(billingAddress);
                if (!string.IsNullOrWhiteSpace(numericAddress))
                    cv2AvsElements.Add(new XElement("street_address1", numericAddress));

                var formattedPostcode = formatPostcode(billingAddress.Postcode);
                if (!string.IsNullOrWhiteSpace(formattedPostcode))
                    cv2AvsElements.Add(new XElement("postcode", formattedPostcode));
            }
            cv2AvsElements.Add(new XElement("cv2", card.Cv2));
            return new XElement("Cv2Avs", cv2AvsElements.ToArray());
        }
 public XDocument Build(string merchantReference, decimal amount, CardDetails card)
 {
     return GetDocument(
         TxnDetailsElement(merchantReference, amount),
         CardTxnElement(card));
 }
 protected virtual XElement CardTxnElement(CardDetails card)
 {
     return new XElement("CardTxn",
                         new XElement("method", "auth"),
                         CardElement(card));
 }
 protected virtual XElement Cv2AvsElement(CardDetails card)
 {
     return new XElement("Cv2Avs",
                         new XElement("cv2", card.Cv2));
 }
Example #39
0
    private Card createcard(int type) {
        //creates a new card based on the provided type
		Card newcard = new Card (opponent);
		newcard.core = (GameObject)Object.Instantiate (card.core);
		newcard.core.renderer.material.SetTexture (0, Main.textures.backcard);
		newcard.core.renderer.enabled = true;
		newcard.returningcard = true;
		newcard.manager = this;
        newcard.type = type;
        //noob clone cuz i cbf properly cloning
        CardDetails details = new CardDetails();
        details.damage = Main.textures.carddetails[type].damage;
        details.health = Main.textures.carddetails[type].health;
        details.manacost = Main.textures.carddetails[type].manacost;
        details.texture = Main.textures.carddetails[type].texture;
        newcard.details = details;

        return newcard;
	}
 protected virtual XElement CardTxnElement(CardDetails card, BillingAddress billingAddress)
 {
     return new XElement("CardTxn",
                         new XElement("method", "auth"),
                         CardElement(card, billingAddress));
 }
Example #41
0
 public ICardPaymentResponse Payment(string merchantReference, decimal amount, CardDetails card, BillingAddress billingAddress = null)
 {
     var requestDocument = _paymentRequestBuilder.Build(merchantReference, amount, card, billingAddress);
     var response = _httpClient.Post(_configuration.Host, requestDocument.ToString(SaveOptions.DisableFormatting));
     return _responseParser.Parse(response);
 }
 public XDocument Build(string merchantReference, decimal amount, string currencyCode, CardDetails card, BillingAddress billingAddress)
 {
     return GetDocument(
         TxnDetailsElement(merchantReference, amount, currencyCode),
         CardTxnElement(card, billingAddress));
 }