Last active
November 9, 2017 09:20
-
-
Save kangguru/8ab7d23e3f80012d8d1c to your computer and use it in GitHub Desktop.
Mangopay Notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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