Guest User

Untitled

a guest
Jan 15th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. DateTime startDate = new DateTime(2018, 1, 1);
  2. DateTime endDate = new DateTime(2019, 12, 31);
  3.  
  4.  
  5. TransactionSearchReq req = new TransactionSearchReq();
  6. req.TransactionSearchRequest = new TransactionSearchRequestType();
  7. req.TransactionSearchRequest.StartDate = startDate;
  8. req.TransactionSearchRequest.EndDate = endDate;
  9. req.TransactionSearchRequest.Version = "74.0";
  10. PayPalAPIInterfaceClient client = new PayPalAPIInterfaceClient();
  11.  
  12. string username = "";
  13. string password = "";
  14. string signature = "";
  15.  
  16. UserIdPasswordType userIdPasswordType = new UserIdPasswordType()
  17. {
  18. Username = username,
  19. Password = password,
  20. Signature = signature
  21. };
  22.  
  23. CustomSecurityHeaderType header = new CustomSecurityHeaderType();
  24. header.Credentials = userIdPasswordType;
  25.  
  26. var result = await client.TransactionSearchAsync(header, req);
  27.  
  28. return Ok(result.TransactionSearchResponse1.PaymentTransactions.Where(i => double.Parse(i.GrossAmount.Value) > 0 && i.Type == "Payment" || i.Type == "Donation").Select(i => new {
  29. GrossAmount = i.GrossAmount.Value,
  30. NetAmount = i.NetAmount.Value,
  31. FeeAmount = i.FeeAmount.Value,
  32. Date = i.Timestamp
  33. }));
Add Comment
Please, Sign In to add comment