Beispiel #1
0
function confirm(request, reply) {
    wallet.checkout.get(request.query.checkoutid, function(error, checkout) {
        if(error) {
            console.log(error);
        }
        product_table.findOne({_id:ObjectId(checkout.payment.items[0].ref)}, function(err, item) {
            var name = checkout.payment.client.name.split(" ");
            var first = name[0];
            var last = name[name.length-1];
            var twitter = item.twitter;
            if (twitter[0] == '@') {
              twitter = twitter.substr(1);
            }
            T.post('statuses/update', { status: '.' + twitter + ', you just sold "' + item.title + '" to ' + first + ' ' + last + ' in http://bananamarket.eu at #codebits!' }, function(err, reply) {
                if (err) console.log(err);
            });
            reply.view('confirm.html', {
                id: item._id,
                title: item.title,
                description: item.description,
                after_description: item.after_description,
                price: item.price,
            });
        });
    });
};
Beispiel #2
0
 product_table.findOne({_id:ObjectId(request.params.id)}, function(err, item) {
     if (err) {
         console.log("ERR: " + err);
     }
     wallet.checkout.create({
       "amount":item.price,
       "currency": "EUR",
       "items":[{
         "ref":request.params.id,
         "name":item.title,
         "descr":item.title + " - " + item.description,
       "qt":1
       }]
     }, function(error, checkout) {
       if(error) {
         console.log(error);
       }
       console.log(checkout);
       reply().redirect(checkout.url_redirect);
     });
 });