Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def emails =[]
- def amounts = []
- emails[0]=params.cuenta;
- amounts[0]=params.cantidad;
- //masspay.massPayCode("Dinero recibido de TikCode.com", "info@tikcode.com", emails, amount, "EUR");
- String emailSub = "Dinero recibido de TikCode.com";
- String emailAddress = "info@tikcode.com";
- String [] receiverEmailItems = emails;
- String [] amountItems = amounts;
- String currencyCode = "EUR";
- CallerServices caller = new CallerServices();
- String responseValue = null;
- APIProfile profile = ProfileFactory.createSignatureAPIProfile();
- /*
- WARNING: Do not embed plaintext credentials in your application code.
- Doing so is insecure and against best practices.
- Your API credentials must be handled securely. Please consider
- encrypting them for use in any production environment, and ensure
- that only authorized individuals may view or modify them.
- */
- // Set up your API credentials, PayPal end point, and API version.
- profile.setAPIUsername("myusername");
- profile.setAPIPassword("mypasswordapi");
- //profile.setSignature("AFcWxV21C7fd0v3bYYYRCpSSRl31ARykt6evANuQsOANN9TjehZjqIl3");
- profile.setSignature("mysignature");
- profile.setEnvironment("sandbox");
- caller.setAPIProfile(profile);
- MassPayRequestType pprequest = new MassPayRequestType();
- pprequest.setVersion("90.0");
- println("llegas aqui?")
- // Add request-specific fields to the request.
- MassPayRequestItemType[] massPayItem = new MassPayRequestItemType[receiverEmailItems.length];
- int j = 0
- for(int i=0;i<receiverEmailItems.length; i++)
- {
- String recreceiverEmail=receiverEmailItems[i];
- if(recreceiverEmail != null && recreceiverEmail.length()!= 0)
- {
- MassPayRequestItemType massItemReq = new MassPayRequestItemType();
- massItemReq.setReceiverEmail(receiverEmailItems[i]);
- BasicAmountType amount = new BasicAmountType();
- amount.set_value(amountItems[i]);
- amount.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
- //massItemReq.setUniqueId(uniqueIdItems[i]);
- //massItemReq.setNote(noteItems[i]);
- massItemReq.setAmount(amount);
- massPayItem[j]=massItemReq;
- j++;
- }
- }
- pprequest.setEmailSubject(emailSub);
- // pprequest.setReceiverType(ReceiverInfoCodeType.fromString("abdel@publidirecta.com"));
- pprequest.setMassPayItem(massPayItem);
- // Execute the API operation and obtain the response.
- MassPayResponseType ppresponse = (MassPayResponseType) caller.call("MassPay", pprequest);
- responseValue = ppresponse.getAck().toString();
- return responseValue;
Add Comment
Please, Sign In to add comment