/// <summary> /// Demonstration of using SimpeliClient. Execution of all available methods. /// </summary> /// <param name="args"></param> static void Main(string[] args) { // Initialize SimpeliClient instance SimpeliClient client = new SimpeliClient(API_KEY, API_URL); // // Send data for PDF generation // Console.WriteLine("Sending data for template: Receipt..."); SendReceipt(client); Console.WriteLine(Environment.NewLine + "Sending data for template: Invoice (1)..."); SendInvoiceA(client); Console.WriteLine(Environment.NewLine + "Sending data for template: Invoice (2)..."); SendInvoiceB(client); Console.WriteLine(Environment.NewLine + "Sending data for template: Invoice (3)..."); SendInvoiceC(client); Console.WriteLine(Environment.NewLine + "Sending data for template: Invoice (4)..."); SendInvoiceD(client); Console.WriteLine(Environment.NewLine + "Sending data for template: Cards..."); SendCards(client); // // Other methods // Console.WriteLine(Environment.NewLine + "Retrieving current credit balance..."); GetCredits(client); Console.WriteLine(Environment.NewLine + "Initializing new payment session, retrieving PaymentId..."); NewPaymentIdResponse response = GetNewPayment(client); if (response != null) { Console.WriteLine(Environment.NewLine + "Confirming new payment..."); AddPayment(client, response.paymentId); } Console.WriteLine(Environment.NewLine + "Retrieving current credit balance..."); GetCredits(client); // Wait.. Console.ReadLine(); }
/// <summary> /// Will initialize new payment. /// </summary> /// <param name="client">SimpeliClient instance.</param> private static NewPaymentIdResponse GetNewPayment(SimpeliClient client) { NewPaymentIdResponse response = null; try { response = client.GetNewPaymentId(150); Console.WriteLine("Response (New Payment): " + Environment.NewLine + "paymentId = " + response.paymentId + Environment.NewLine + "price = " + response.price + Environment.NewLine + "message = " + response.message); } catch (SimpeliException ex) { HandleSimpeliException(ex); } catch (Exception ex) { HandleException(ex); } return(response); }