forked from itsmaarouf/bls-appointment-scripts-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaymentReceiptCatcher.js
46 lines (39 loc) · 1.46 KB
/
PaymentReceiptCatcher.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// ==UserScript==
// @name Payment Method
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Itsmaarouf
// @match https://payment.cmi.co.ma/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
/*
- This "if statement" checks if there is a PDF that needs to be printed.
- Because the payment receipt page is available only 3 seconds.
- whitout this function you will not get your payment receipt
*/
if($('#print').length == 1){
window.print();
}
//Search for token on the payment page.
let token = document.querySelectorAll('input[name=paymentLinkToken]')[0].value;
//Prepare a URL to add a token to it.
let MyUrl = "https://payment.cmi.co.ma/fim/paymentLinkService?token=";
//Add token to URL
let result = MyUrl.concat(token);
//Print it out in the console
console.log(result)
/*
- why i need to this URL?
- Because I want to send the link to the person I specified on the appointment at the Consulate.
*/
//This function helps me to copy full url without opening console
navigator.clipboard.writeText(result).then(function () {
console.log('Async: Copying to clipboard was successful!');
}, function (err) {
console.error('Async: Could not copy text: ', err);
});
})();