// GET: Admin public ActionResult GetDonations() { Instamojo objClass = InstamojoImplementation.getApi(PaymentGatewaySecrets.CLIENT_ID, PaymentGatewaySecrets.CLIENT_SECRET, PaymentGatewaySecrets.API_ENDPOINT, PaymentGatewaySecrets.AUTH_ENDPOINT); PaymentOrderListRequest objPaymentOrderListRequest = new PaymentOrderListRequest(); PaymentOrderListResponse objPaymentRequestStatusResponse = objClass.getPaymentOrderList(objPaymentOrderListRequest); List <OrderViewModel> viewModel = new List <OrderViewModel>(); foreach (var order in objPaymentRequestStatusResponse.orders) { viewModel.Add(new OrderViewModel { Amount = order.amount, CreatedAt = order.created_at, Currency = order.currency, Description = order.description, Email = order.email, Id = order.id, Name = order.name, Phone = order.phone, RedirectUrl = order.redirect_url, ResourceUri = order.resource_uri, Status = order.status, TransactionId = order.transaction_id, WebhookUrl = order.webhook_url }); } return(View(viewModel)); }
static void GetAllPaymentOrdersList(Instamojo objClass) { try { PaymentOrderListRequest objPaymentOrderListRequest = new PaymentOrderListRequest(); //Optional Parameters objPaymentOrderListRequest.limit = 21; objPaymentOrderListRequest.page = 3; PaymentOrderListResponse objPaymentRequestStatusResponse = objClass.getPaymentOrderList(objPaymentOrderListRequest); foreach (var item in objPaymentRequestStatusResponse.orders) { Console.WriteLine(item.email + item.description + item.amount); } MessageBox.Show("Order List = " + objPaymentRequestStatusResponse.orders.Count()); } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message); } catch (WebException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } }