コード例 #1
0
ファイル: Program.cs プロジェクト: paychoice/paychoice-dotnet
 /// <summary>
 /// Lists the last ten charges.
 /// </summary>
 /// <param name="service">The Paychoice service.</param>
 private static void ListLastTenCharges(IPaychoiceService service)
 {
     Console.WriteLine("Getting last 10 charges");
     var charges = service.GetCharges(0, 10);
     foreach (var charge in charges)
     {
         Console.WriteLine("{0} {1} {2} {3}", charge.Id, charge.Status, charge.Reference, charge.Amount);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: paychoice/paychoice-dotnet
        /// <summary>
        /// Stores the credit card.
        /// </summary>
        /// <param name="service">The Paychoice service.</param>
        private static void StoreCreditCard(IPaychoiceService service)
        {
            CreditCard card = new CreditCard()
            {
                CardName = "John Smith",
                Number = "4111-1111-1111-1111",
                ExpiryMonth = 12,
                ExpiryYear = 16,
                CVV = "123"
            };

            Console.WriteLine("Storing credit card");
            var storedCard = service.Store(card);
            Console.WriteLine("Token: {0}", storedCard.token);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: paychoice/paychoice-dotnet
        /// <summary>
        /// Charges the credit card.
        /// </summary>
        /// <param name="service">The Paychoice service.</param>
        private static void ChargeCreditCard(IPaychoiceService service)
        {
            CreditCard card = new CreditCard()
            {
                CardName = "John Smith",
                Number = "4111-1111-1111-1111",
                ExpiryMonth = 12,
                ExpiryYear = 16,
                CVV = "123"
            };

            string currency = "AUD";
            decimal amount = 5.00m;
            string reference = "Inv #" + Guid.NewGuid().ToString();

            Console.WriteLine("Charging credit card");
            var charge = service.Charge(card, reference, currency, amount);
            Console.WriteLine("Charge id: {0} {1}", charge.Id, charge.Status);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: paychoice/paychoice-dotnet
 /// <summary>
 /// Gets the users public API key.
 /// </summary>
 /// <param name="service">The Paychoice service.</param>
 private static void GetPublicAPIKey(IPaychoiceService service)
 {
     Console.WriteLine("Getting Public API key");
     Console.WriteLine("Public key: {0}", service.GetPublicAPIKey());
 }