/// <summary> /// Looks up a subscription invoice. /// </summary> /// <param name="subscriptionId">The unique identifier for the subscription.</param> /// <param name="invoiceNumber">The nyumber of the invoice for this subscription.</param> /// <param name="expand">Expands the specified resource. Possible values: "subscription"</param> /// <returns>A "LookupSubscriptionInvoiceResponse" object, containing the response from the NETELLER REST API.</returns> public static LookupSubscriptionInvoiceResponse LookupSubscriptionInvoice(string subscriptionId, string invoiceNumber, string expand = "") { NetellerApi api = new NetellerApi(); Token token = api.getToken_clientCredentials(); Dictionary<string, string> headers = new Dictionary<string, string> { {"Authorization", "Bearer " + token.accessToken} }; string path = "v1/subscriptions/" + subscriptionId + "/invoices/" + invoiceNumber; string response; if (!String.IsNullOrEmpty(expand)) { Dictionary<string, string> queryParams = new Dictionary<string, string> { {"expand", expand} }; response = api.Get(path, queryParams, headers); } else { response = api.Get(path, null, headers); } DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof (LookupSubscriptionInvoiceResponse)); MemoryStream responseMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response)); LookupSubscriptionInvoiceResponse responseObject = (LookupSubscriptionInvoiceResponse) responseSerializer.ReadObject(responseMemoryStream); return responseObject; }
/// <summary> /// Returns details about a previously created subscription plan. /// </summary> /// <param name="planId">The unique identifier for the subscription plan.</param> /// <returns>A "LookupPlanResponse" object, containing the response from the NETELLER REST API.</returns> public static LookupPlanResponse LookupPlan(string planId) { NetellerApi api = new NetellerApi(); Token token = api.getToken_clientCredentials(); Dictionary<string, string> headers = new Dictionary<string, string> { {"Authorization", "Bearer " + token.accessToken} }; string path = "v1/plans/" + planId; string response = api.Get(path, null, headers); DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof (LookupPlanResponse)); MemoryStream responseMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response)); LookupPlanResponse responseObject = (LookupPlanResponse) responseSerializer.ReadObject(responseMemoryStream); return responseObject; }
/// <summary> /// Lookup details for a specific customer. /// </summary> /// <param name="customerId">The unique identifier for the customer.</param> /// <param name="email">The customer's NETELLER registered Email</param> /// <param name="accountId">The customer's NETELLER Account ID.</param> /// <returns>A "LookupCustomerResponse" object, containing the response from the NETELLER REST API.</returns> public static LookupCustomerResponse LookupCustomer(string customerId = "", string email = "", string accountId = "") { NetellerApi api = new NetellerApi(); Token token = api.getToken_clientCredentials(); Dictionary<string, string> headers = new Dictionary<string, string> { {"Authorization", "Bearer " + token.accessToken} }; string response = ""; if (!String.IsNullOrEmpty(customerId)) { string path = "v1/customers/" + customerId; response = api.Get(path, null, headers); } else if (!String.IsNullOrEmpty(email)) { const string path = "v1/customers"; Dictionary<string, string> queryParams = new Dictionary<string, string> { {"email", email} }; response = api.Get(path, queryParams, headers); } else if (!String.IsNullOrEmpty(accountId)) { const string path = "v1/customers"; Dictionary<string, string> queryParams = new Dictionary<string, string> { {"accountId", accountId} }; response = api.Get(path, queryParams, headers); } DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof (LookupCustomerResponse)); MemoryStream responseMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response)); LookupCustomerResponse responseObject = (LookupCustomerResponse) responseSerializer.ReadObject(responseMemoryStream); return responseObject; }
/// <summary> /// Looks up a payment by provided merchantRefId or transactionId. /// </summary> /// <param name="merchantRefId">Your unique identifier for this transaction that was supplied on your original request.</param> /// <param name="transactionId">The unique identifier for the transaction.</param> /// <param name="expand">Expands the specified resource. Possible values: "customer"</param> /// <returns>A "LookupPaymentResponse" object, containing the response from the NETELLER REST API.</returns> public static LookupPaymentResponse LookupPayment(string merchantRefId = "", string transactionId = "", string expand = "") { NetellerApi api = new NetellerApi(); Token token = api.getToken_clientCredentials(); Dictionary<string, string> headers = new Dictionary<string, string> { {"Authorization", "Bearer " + token.accessToken} }; string response = ""; if (!String.IsNullOrEmpty(merchantRefId)) { string path = "v1/payments/" + merchantRefId; Dictionary<string, string> queryParams = new Dictionary<string, string> { {"refType", "merchantRefId"} }; if (!String.IsNullOrEmpty(expand)) { queryParams.Add("expand", expand); } response = api.Get(path, queryParams, headers); } else if (!String.IsNullOrEmpty(transactionId)) { string path = "v1/payments/" + transactionId; Dictionary<string, string> queryParams = new Dictionary<string, string>(); if (!String.IsNullOrEmpty(expand)) { queryParams.Add("expand", expand); } response = api.Get(path, queryParams, headers); } DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof (LookupPaymentResponse)); MemoryStream responseMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response)); LookupPaymentResponse responseObject = (LookupPaymentResponse) responseSerializer.ReadObject(responseMemoryStream); return responseObject; }
/// <summary> /// Lists all previously created subscriptions. /// </summary> /// <param name="limit">Sets the number of records to be returned.</param> /// <param name="offset">Sets the results offset.</param> /// <returns>A "ListSubscriptionsResponse" object, containing the response from the NETELLER REST API.</returns> public static ListSubscriptionsResponse ListSubscriptions(string limit = "", string offset = "") { NetellerApi api = new NetellerApi(); Token token = api.getToken_clientCredentials(); Dictionary<string, string> headers = new Dictionary<string, string> { {"Authorization", "Bearer " + token.accessToken} }; const string path = "v1/subscriptions"; Dictionary<string, string> queryParams = new Dictionary<string, string>(); if (!String.IsNullOrEmpty(limit)) { queryParams.Add("limit", limit); } if (!String.IsNullOrEmpty(offset)) { queryParams.Add("offset", offset); } string response = api.Get(path, queryParams, headers); DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof (ListSubscriptionsResponse)); MemoryStream responseMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response)); ListSubscriptionsResponse responseObject = (ListSubscriptionsResponse) responseSerializer.ReadObject(responseMemoryStream); return responseObject; }