These are chat archives for reactioncommerce/reaction

16th
Dec 2016
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:16
@zenweasel I created a server directory for my plugin imports/plugins/custom/myplugin/server/ and I created a meteor method. But I get an error when calling the method, it's saying my method was not found 404. What should I do?
Brent Hoover
@zenweasel
Dec 16 2016 00:18
is that file being imported somewhere?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:19
Do I need to import it?
Brent Hoover
@zenweasel
Dec 16 2016 00:19
e.g in an index.js in the root of the server folder?
Yes, because it’s in the imports folder, no code is automatically evaluated
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:19
yea I imported into index.js
I still have the error.
Brent Hoover
@zenweasel
Dec 16 2016 00:21
is your code somewhere I can look at it?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:23
import { Meteor } from "meteor/meteor";
import { check } from "meteor/check";
import { Notifications } from "/lib/collections";
import { Logger } from "/server/api";

/**
 * Reaction Notification methods
 */
Meteor.methods({
  /**
  * notification/send
  * @summary This send a notification to a user
  * @param {String} userId - The user
  * @param {String} type - The type of Notification
  * @param {String} details - The complete details of the Notification
  * @param {String} url - The link
  * @param {Boolean} sms - To allow sms notification.
  * @return {Object} returns result
  */
  "notification/send": function (userId, type, url, sms, details) {
    check(userId, String);
    check(type, String);
    check(sms, Boolean);
    check(details, String);
    check(url, String);

    const values = {};
    const types = {
      orderCancelled: "Your order was cancelled.",
      newOrder: "Your order is being processed.",
      topWallet: "Your wallet has been credited.",
      orderDelivered: "Your order has been delivered.",
      orderAccepted: "Your order has been accepted.",
      orderShipped: "Your order has been shipped."
    };

    if (userId && type && url) {
      values.type = type;
      values.to = userId;
      values.message = types[type];

      if (details) {
        values.hasDetails = true;
        values.details = details;
      }
    }

    Logger.info(`Sending notification to ${userId}`);
    Notifications.insert(values);
  }
});
Brent Hoover
@zenweasel
Dec 16 2016 00:23
I need to see the whole context
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:24
The entire server directory
Brent Hoover
@zenweasel
Dec 16 2016 00:24
preferably the entire plugin directory
@zenweasel
Have you checked?
Brent Hoover
@zenweasel
Dec 16 2016 00:37
Hold on, give me a minute
Brent Hoover
@zenweasel
Dec 16 2016 00:45
if I call it from the command line, I get a check error, not a 404
Meteor.call("notification/send", "this", "that", true, "another", "thelast");
so it seems to be finding it
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:46
Let me try again.
Brent Hoover
@zenweasel
Dec 16 2016 00:49

this works (wrong order of arguments)

Meteor.call("notification/send", "this", "that", "thing", true, "thing");

Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:51
Where are you calling the method?
Brent Hoover
@zenweasel
Dec 16 2016 00:51
from the Meteor shell
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:51
Steps please
Brent Hoover
@zenweasel
Dec 16 2016 00:52
meteor shell in another terminal window in the same directory
while the app is running
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:54
Thanks @zenweasel
Brent Hoover
@zenweasel
Dec 16 2016 00:56
:+1:
Michael Duane Mooring
@mikeumus
Dec 16 2016 03:02
RC Team, you guys should us jsDocs or something like that to turn your nice source comments into docs, they're great comments you have in there! :+1:
Brent Hoover
@zenweasel
Dec 16 2016 03:47
Yeah, we’ve talk about that a few times. We would probably want to go back and make them more consistent
thai luu
@xuanthai_84_twitter
Dec 16 2016 17:04
remove Checkout Workflow payment to complete order ?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 17:48
@zenweasel What value does the priority property give in the register.js?
Spencer Norman
@spencern
Dec 16 2016 19:09
Glad this typo reaction ruin doesn’t destroy anything
hrath2015
@hrath2015
Dec 16 2016 19:18
:smile:
Citrudev
@enonchong
Dec 16 2016 19:55
how do i get started with reaction
Jeremy Shimko
@jshimko
Dec 16 2016 20:43
Is that a feature request @spencern?
reaction ruin

# rm -rf ./*
Spencer Norman
@spencern
Dec 16 2016 21:16
hahaha
reaction ruin
sudo rm -rf /.*
Jeremy Shimko
@jshimko
Dec 16 2016 21:16
Yeah, just to be really sure it gets the job done
Spencer Norman
@spencern
Dec 16 2016 21:16
i’ll write up some docs
Kolawole Michael Alade
@michael-alade
Dec 16 2016 21:44
@zenweasel What is the essence of priority in the register.js file