cloud-code

Using setTimeout() to Schedule pushes

拜拜、爱过 提交于 2020-07-09 14:47:06
问题 Since Scheduled push is not available on Parse , I'm using setTimeout() to schedule pushes. I'm using back4app. // I call this cloud code Parse.Cloud.define("pushMultiple",async (request) => { //Using set timeout to send out a push 1 hour later setTimeout(pushout,100000); }); //The function to send Notificaiton const pushout = () => { Parse.Push.send({ channels: [ "t1g.com"], data: {alert: "The Giants won against the Mets 2-3."} },{ useMasterKey: true }); } My code works fine. So my question

Using setTimeout() to Schedule pushes

ε祈祈猫儿з 提交于 2020-07-09 14:45:11
问题 Since Scheduled push is not available on Parse , I'm using setTimeout() to schedule pushes. I'm using back4app. // I call this cloud code Parse.Cloud.define("pushMultiple",async (request) => { //Using set timeout to send out a push 1 hour later setTimeout(pushout,100000); }); //The function to send Notificaiton const pushout = () => { Parse.Push.send({ channels: [ "t1g.com"], data: {alert: "The Giants won against the Mets 2-3."} },{ useMasterKey: true }); } My code works fine. So my question

Schedule Push notification on Parse

≡放荡痞女 提交于 2020-06-17 02:11:13
问题 I was wondering if Schedule Push is available on Parse Server? (I'm using Back4App) Here is my cloud code: Parse.Cloud.define("pushMultiple",async (request) => { //Getting Current Date instance var d = new Date(); //Where I live Current Hour is 14, so setting it to 15 d.setHours(15); //Sending push to a specific device return Parse.Push.send({ push_time: d, channels: [ "t1g.com"], data: {alert: "The Giants won against the Mets 2-3."} },{ useMasterKey: true }); }); But the code does not seem

Store credit card using Stripe + Parse with cloud code

余生颓废 提交于 2020-02-21 06:53:23
问题 I am attempting to store a users credit card into stripe. Once the token is made, I attempt to save the token with the user to Stripe as a customer. But I didnt find any answer to my problem, I just need to store a card to a user that already exist. I tried to use the method Stripe.Customers.update but it store the new card removing the "default" card if the user had one. And using the method Stripe.Customers.create it create a new customer with the new card, but I need to store in specific

Parse Server Cloud Code Setting ACL

独自空忆成欢 提交于 2020-01-23 03:43:05
问题 I try to set the ACLs with the code below, but in my mongolab database I do not see the ACL settings. Am I doing something wrong in the code? I could not find any good tutorial for the cloud code examples. Parse.Cloud.afterSave('_User', function(req) { var user = req.user; var acl = new Parse.ACL(); acl.setReadAccess(req.user, true); acl.setWriteAccess(req.user, true); user.setACL(acl); user.save(); }); Parse.Cloud.afterSave('userSetting', function(req) { var userSet = req.object; var acl =

Parse.com create stripe card token in cloud code (main.js)

回眸只為那壹抹淺笑 提交于 2020-01-22 02:41:05
问题 I am looking to create stripe token in parse cloud code.. I dont want to create token in client side HTML page. My complete web application is in HTML + Javascript so dont want to expose my Stripe.setPublishableKey('pk_test_xxxxxxx'); Because of this reason interest to define function in cloud code. Parse.Cloud.define("addCreditCard", function(request, response) { var token; var group; var Stripe = require('https://js.stripe.com/v2/'); Stripe.setPublishableKey('pk_test_xxxxxxxxx'); Stripe

How do I save Apple Pay transaction on a customer?

折月煮酒 提交于 2020-01-17 13:48:12
问题 I implemented Apple Pay into my app and it works fine, but currently when I use apple pay the transaction isn't linked to a user, when I add a customer/user parameter on my cloud code I get this error. error: type: "invalid_request_error" message: "Customer cus_xxx does not have a linked card with ID tok_xxxx." param: "card" code: "missing" Parse.Cloud.define("chargeApplePay", function(request, response){ Stripe.Charges.create({ amount: 100 * 100, currency: "usd", customer: request.params

How do I save Apple Pay transaction on a customer?

两盒软妹~` 提交于 2020-01-17 13:47:06
问题 I implemented Apple Pay into my app and it works fine, but currently when I use apple pay the transaction isn't linked to a user, when I add a customer/user parameter on my cloud code I get this error. error: type: "invalid_request_error" message: "Customer cus_xxx does not have a linked card with ID tok_xxxx." param: "card" code: "missing" Parse.Cloud.define("chargeApplePay", function(request, response){ Stripe.Charges.create({ amount: 100 * 100, currency: "usd", customer: request.params

Requesting Function Response in another function

我的梦境 提交于 2020-01-17 06:32:08
问题 I have those two functions where i call "http" from "Count" the "http" return promise. I want to use the return value of "http" in "Count". What I receive now is Undefined !!! What I'm missing ? Count Function : Parse.Cloud.define('count', function(request, response) { var query = new Parse.Query('MyS'); query.equalTo("Notify", true); query.notEqualTo ("MainEventCode", '5'); query.find({ success: function(results) { Parse.Cloud.run('http', {params : results}).then( function(httpResponse) {

SOAP request in parse cloud code

戏子无情 提交于 2020-01-06 19:52:26
问题 I need to make a SOAP request in parse cloud code. Then I save returned data to a parse class. I am new at javascript. I tried to do it with Parse.Cloud.httpRequest but it did not work. Here is the SOAP request : var elPlanliTable = $('#planliTable'); var filterPlanliKesintiler = true; function getAllPlanliKesintiler(){ var listName = "PlanliKesintiler"; var where = (filterPlanliKesintiler) ? "<And><Geq><FieldRef Name='Tarih' /><Value Type='DateTime'><Today OffsetDays='-30' /></Value></Geq>