HashtagSell / posting-api

API for storage and retrieval of posting details for Hashtagsell
0 stars 0 forks source link

Email notifications & Closing Transactions [Big one!] #41

Closed that1guy closed 9 years ago

that1guy commented 9 years ago

The following should trigger an email notification sent via Amazon SES using service account notifications@hashtagsell.com.

Requests below ARE necessary for beta launch.

Action: When seller receives a question on their item for sale. Result: Seller receives email linking to http://www.hashtagsell.com/myposts/questions/{postingId}

Action: When seller answers a question on their item for sale. Result: The user who asked the questions receives email linking to http://www.hashtagsell.com/watchlist/questions/{postingId}

Action: When seller receives an offer on their item for sale. Result: Seller receives email linking to http://www.hashtagsell.com/myposts/offers/{postingId}

Action: When seller accepts an offer on their item for sale. Result: User who sent the offer receives email linking to http://www.hashtagsell.com/watchlist/offers/{postingId}

Action: When an item for sale has an accepted offer between a buyer and seller setup a CRON. Result: Send 24 hour notice to seller and potential buyer before the meet. This email should contain details about the item for sale, meeting location, and a link to a form that captures peer review. http://www.hashtagsell.com/feedback/{username}/{postingId}

This email sent to the potential buyer should also contain a big link saying "PAY ONLINE". http://www.hashtagsell.com/payment/{postingId} ^ Here we will present the mobile-ready page the allows the buyer to send funds to seller.

Requests below not necessary for beta launch.

Action: When user A sends a private message to user B Result: user B receives an email with the message inside that links to

that1guy commented 9 years ago

@brozeph I am exposing routes in htsApp that the realtime-svc API will be able to POST to. Those routes will expect a parameter to be passed that looks exactly like the object you're already emitting via Socket.io.

routes.js in htsApp
    // =====================================
    // EMAIL OFFER NOTIFICATIONS ===========
    // =====================================
    var transaction_notifications_api = require('./api/transaction_notification_api.js');

    app.post("/email/meeting-request/instant-reminder", function(req, res) {
        transaction_notifications_api.meetingRequest.instantReminder(req, res);
    });
New transaction_notification_api handles emailing users when offers are sent OR accepted, AND when questions are asked OR answered. These emails will link to online payment URL and peer review forms.
transaction_notification_api.js in htsApp
exports.meetingRequest = {

    //Send an email to the potential buyer with meeting location and big button linking to online payment.
    //Send an email to the seller with information about the buyer and a big button linking to online review.
    instantReminder: function (req, res) {

        //This is the object that realtime-svc emitted to client.
        var offerObj = req.body.acceptedOffer;

        async.waterfall([
            .
            //Do stuff
            .
        ], function(err) {
            if (err) {
                res.json({error: err});
            } else {
                res.json({success: true});
            }
        });
    }
};

More to come discuss Monday or write me this weekend.

that1guy commented 9 years ago

see #50 for more info.. it might make more sense to trigger emails from state changes on transaction IDs proposed in this request.

that1guy commented 9 years ago

Implemented for entire 360. All bugs opened in separate tickets. Closing this ticket to keep things clean. Thanks Josh!