Пример #1
0
        public static void Main(string[] args)
        {
            _client = new OrangeLeapClient();
            EstablishConnection();

            var donor    = new Pocos.Donor();
            var donation = new Pocos.Donation();

            InitObjects(ref donation, ref donor);

            //var constt = CreateConstituentWithAllProperties(donor);
            //Console.WriteLine("created const! id: " + constt.id.ToString());
            //Console.ReadLine();

            var constt = Find(4618);

            AddGiftToConstituent(donation, ref constt);

            //UpdateConstituent(donor, ref constt, "Just adding a test note, b/c i'm testing!");

            //var donors = Find(donor, true, true, false, false, false);
            //constituent constt;

            //if (donors.Any())
            //{
            //    if (donors.Count == 1)
            //    {
            //        constt = donors.First();
            //        UpdateConstituent(donor, ref constt);
            //    }
            //    else
            //    {
            //        switch (_howToHandleOverMatch)
            //        {
            //            case Enum_HowToHandleOverMatch.Use_Oldest_Record:
            //                constt = donors.OrderBy(x => x.updateDate).First();
            //                UpdateConstituent(donor, ref constt);
            //                break;
            //            case Enum_HowToHandleOverMatch.Use_Newest_Record:
            //                constt = donors.OrderByDescending(x => x.updateDate).First();
            //                UpdateConstituent(donor, ref constt);
            //                break;
            //            case Enum_HowToHandleOverMatch.Create_New_Record:
            //                constt = CreateConstituentWithAllProperties(donor);
            //                break;
            //            case Enum_HowToHandleOverMatch.Create_New_Record_And_Be_Notified:
            //                constt = CreateConstituentWithAllProperties(donor);
            //                break;
            //            default:
            //                throw new ArgumentOutOfRangeException();
            //        }
            //    }
            //}
            //else
            //{
            //    //create new donor
            //    constt = CreateConstituentWithAllProperties(donor);
            //}
        }
Пример #2
0
        public static void CreateDonation(ref Donation donation, ref Donor donor)
        {
            donation = new Pocos.Donation
            {
                AuthorizationNumber = "ABC123_Auth#",
                CardBrand           = Enum_CardBrand.MasterCard,
                Comment             = "Test Comment",
            };
            donation.DonationAddresses.Add(CreateAddress(Enum_AddressType.Billing, donor));
            donation.DonationAddresses.Add(CreateAddress(Enum_AddressType.Shipping, donor));
            donation.Donor               = donor;
            donation.Email               = donor.Email;
            donation.GatewayName         = "PTC";
            donation.GatewayTransDetails = "GatewayTransDetails_here";
            donation.Last4ofCC           = "1234";
            donation.MotivationCode      = "custom-motivation-code";
            donation.Name          = donor.FullName;
            donation.Notes         = "Test from RaiseDonors";
            donation.PaymentMethod = Enum_PaymentMethod.CC;
            donation.Phone         = donor.Phone;
            donation.SourceCode    = "Online";
            donation.Status        = Enum_ChargeStatus.Approved;
            donation.TestMode      = false;
            donation.TransactionId = "123-xyz-456-abc";

            for (int i = 0; i < 5; i++)
            {
                var amt   = (decimal)NewRandom(2);
                var alloc = new DonationFundAllocation()
                {
                    Amount     = amt,
                    Donation   = donation,
                    DonationId = donation.Id,
                    Fund       = new Fund()
                    {
                        Active      = true,
                        Code        = "",
                        Description = "",
                        Id          = i,
                        IsDeleted   = false,
                        Name        = FundNamePickList()[i].itemName,
                    },
                    FundId = i,
                };
                donation.DonationFundAllocations.Add(alloc);
            }

            donation.Amount = donation.DonationFundAllocations.Sum(x => x.Amount);
        }