Guest User

Untitled

a guest
Jan 19th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. def emails =[]
  2. def amounts = []
  3.  
  4. emails[0]=params.cuenta;
  5. amounts[0]=params.cantidad;
  6.  
  7.  
  8.  
  9. //masspay.massPayCode("Dinero recibido de TikCode.com", "info@tikcode.com", emails, amount, "EUR");
  10.  
  11. String emailSub = "Dinero recibido de TikCode.com";
  12. String emailAddress = "info@tikcode.com";
  13. String [] receiverEmailItems = emails;
  14. String [] amountItems = amounts;
  15. String currencyCode = "EUR";
  16. CallerServices caller = new CallerServices();
  17.  
  18. String responseValue = null;
  19.  
  20.  
  21. APIProfile profile = ProfileFactory.createSignatureAPIProfile();
  22. /*
  23. WARNING: Do not embed plaintext credentials in your application code.
  24. Doing so is insecure and against best practices.
  25. Your API credentials must be handled securely. Please consider
  26. encrypting them for use in any production environment, and ensure
  27. that only authorized individuals may view or modify them.
  28. */
  29.  
  30. // Set up your API credentials, PayPal end point, and API version.
  31. profile.setAPIUsername("myusername");
  32. profile.setAPIPassword("mypasswordapi");
  33. //profile.setSignature("AFcWxV21C7fd0v3bYYYRCpSSRl31ARykt6evANuQsOANN9TjehZjqIl3");
  34. profile.setSignature("mysignature");
  35. profile.setEnvironment("sandbox");
  36. caller.setAPIProfile(profile);
  37. MassPayRequestType pprequest = new MassPayRequestType();
  38. pprequest.setVersion("90.0");
  39. println("llegas aqui?")
  40. // Add request-specific fields to the request.
  41. MassPayRequestItemType[] massPayItem = new MassPayRequestItemType[receiverEmailItems.length];
  42. int j = 0
  43. for(int i=0;i<receiverEmailItems.length; i++)
  44. {
  45. String recreceiverEmail=receiverEmailItems[i];
  46. if(recreceiverEmail != null && recreceiverEmail.length()!= 0)
  47. {
  48. MassPayRequestItemType massItemReq = new MassPayRequestItemType();
  49. massItemReq.setReceiverEmail(receiverEmailItems[i]);
  50. BasicAmountType amount = new BasicAmountType();
  51. amount.set_value(amountItems[i]);
  52. amount.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
  53. //massItemReq.setUniqueId(uniqueIdItems[i]);
  54. //massItemReq.setNote(noteItems[i]);
  55. massItemReq.setAmount(amount);
  56. massPayItem[j]=massItemReq;
  57. j++;
  58. }
  59. }
  60. pprequest.setEmailSubject(emailSub);
  61. // pprequest.setReceiverType(ReceiverInfoCodeType.fromString("abdel@publidirecta.com"));
  62. pprequest.setMassPayItem(massPayItem);
  63.  
  64. // Execute the API operation and obtain the response.
  65. MassPayResponseType ppresponse = (MassPayResponseType) caller.call("MassPay", pprequest);
  66. responseValue = ppresponse.getAck().toString();
  67.  
  68. return responseValue;
Add Comment
Please, Sign In to add comment