Skip to content

Instantly share code, notes, and snippets.

@kangguru
Last active November 9, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kangguru/8ab7d23e3f80012d8d1c to your computer and use it in GitHub Desktop.
Save kangguru/8ab7d23e3f80012d8d1c to your computer and use it in GitHub Desktop.
Mangopay Notifications
// ==UserScript==
// @name Mangopay Notifications
// @namespace http://tampermonkey.net/
// @version 0.1
// @description simulate mangopay notifications direct from the dashboard
// @author Lars Brillert
// @include /https://dashboard.sandbox.mangopay.com/Users/\d+/WalletTransactions/\d+/
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
$("table > tbody > tr").each(function() {
var id = $(this).children("td:first").text().trim()
var type = $(this).children("td:nth-child(8)").text().trim()
var status = $(this).children("td:nth-child(9)").text().trim()
var link = $(this).children("td:nth-child(11)")
var event = type.toUpperCase() + "_NORMAL_" + status.toUpperCase()
if (event == 'REFUNDED PAYIN_NORMAL_SUCCEEDED') {
event = 'PAYIN_REFUND_SUCCEEDED';
}
link.append(
"<a href='http://localhost:7003/webhooks/mangopay?RessourceId="+id+"&EventType="+event+"&Date=1436252110' class='btn btn-xs'><i class='fa fa-bell green'></i></a>"
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment