public static Button CreatePaymentButton( string name, Amount cost, string description, APIKey apiKey ) { Button button = new Button() { Name = name, Cost = cost.AmountValue, PriceCurrencyISO = cost.Currency, Description = description }; return CreatePaymentButton(button, apiKey); }
public static void TestCreateButton() { Console.Write("Testing CreatePaymentButton w/out Button w/ Valid Key: "); Button button = API.CreatePaymentButton( "Test1", new Amount() { AmountValue = 1m, Currency = "USD" }, "This is Test1", GOOD_KEY ); ASSERT(button.IsValid, button); Console.Write("Testing CreatePaymentButton w/out Button w/ Invalid Key: "); button = API.CreatePaymentButton( "Test2", new Amount() { AmountValue = 1m, Currency = "USD" }, "This is Test2", BAD_KEY ); ASSERT(!button.IsValid, button); Console.Write("Testing CreatePaymentButton w/ Button + Valid Key: "); button = new Button() { Name = "Test3", Cost = 1.23m, PriceCurrencyISO = "BTC", Description = "This is Test3", Type = ButtonType.Subscription, Style = ButtonStyle.None }; button = API.CreatePaymentButton(button, GOOD_KEY); ASSERT(button.IsValid, button); Console.Write("Testing CreatePaymentButton w/ Button + Invalid Key: "); button = new Button() { Name = "Test4", Cost = 1.23m, PriceCurrencyISO = "BTC", Description = "This is Test4", Type = ButtonType.Subscription, Style = ButtonStyle.None }; button = API.CreatePaymentButton(button, BAD_KEY); ASSERT(!button.IsValid, button); }
public static Button CreatePaymentButton( Button button, APIKey apiKey ) { ButtonResponse buttonResponse = (ButtonResponse) PostResource( "buttons", button, typeof(Button), typeof(ButtonResponse), apiKey ); return buttonResponse.Button; }