These are chat archives for reactioncommerce/reaction

16th
Dec 2016
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:16 UTC
@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 UTC
is that file being imported somewhere?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:19 UTC
Do I need to import it?
Brent Hoover
@zenweasel
Dec 16 2016 00:19 UTC
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 UTC
yea I imported into index.js
I still have the error.
Brent Hoover
@zenweasel
Dec 16 2016 00:21 UTC
is your code somewhere I can look at it?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:23 UTC
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 UTC
I need to see the whole context
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:24 UTC
The entire server directory
Brent Hoover
@zenweasel
Dec 16 2016 00:24 UTC
preferably the entire plugin directory
@zenweasel
Have you checked?
Brent Hoover
@zenweasel
Dec 16 2016 00:37 UTC
Hold on, give me a minute
Brent Hoover
@zenweasel
Dec 16 2016 00:45 UTC
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 UTC
Let me try again.
Brent Hoover
@zenweasel
Dec 16 2016 00:49 UTC

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 UTC
Where are you calling the method?
Brent Hoover
@zenweasel
Dec 16 2016 00:51 UTC
from the Meteor shell
Kolawole Michael Alade
@michael-alade
Dec 16 2016 00:51 UTC
Steps please
Brent Hoover
@zenweasel
Dec 16 2016 00:52 UTC
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 UTC
Thanks @zenweasel
Brent Hoover
@zenweasel
Dec 16 2016 00:56 UTC
:+1:
Michael Duane Mooring
@mikeumus
Dec 16 2016 03:02 UTC
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 UTC
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 UTC
remove Checkout Workflow payment to complete order ?
Kolawole Michael Alade
@michael-alade
Dec 16 2016 17:48 UTC
@zenweasel What value does the priority property give in the register.js?
Spencer Norman
@spencern
Dec 16 2016 19:09 UTC
Glad this typo reaction ruin doesn’t destroy anything
hrath2015
@hrath2015
Dec 16 2016 19:18 UTC
:smile:
Citrudev
@enonchong
Dec 16 2016 19:55 UTC
how do i get started with reaction
Jeremy Shimko
@jshimko
Dec 16 2016 20:43 UTC
Is that a feature request @spencern?
reaction ruin

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