Last active
November 15, 2017 15:25
-
-
Save pingec/f54b57cfde4c6a456bbf697f5f725d9c to your computer and use it in GitHub Desktop.
Automatic payment execution on delavska hranilnica online banking platform
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
windowTrackingInit = (window) => { | |
window.openedWindows = []; | |
window._open = window.open; | |
window.open = function(url,name,params){ | |
var newWindow = window._open(url,name,params); | |
window.openedWindows.push(newWindow); | |
windowTrackingInit(newWindow); | |
} | |
} | |
windowTrackingInit(window); | |
let wait = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
doWork = async () => { | |
// Open upn window | |
Adm('tb.upn_akc?p_vr_nal_upn=upn'); | |
var upnWindow = window.openedWindows[window.openedWindows.length -1]; | |
await wait(3000); | |
// Fill upn window | |
$('#type_znesek2', upnWindow.document)[0].value = '123,45' | |
$('#type_znesek2', upnWindow.document).attr('value', '123,45') | |
$('#type_iban2', upnWindow.document)[0].value = 'SI56xxxxxxxxxxxxxxx' | |
$('#type_iban2', upnWindow.document).attr('value', 'SI56xxxxxxxxxxxxxxx') | |
$('#type_referenca', upnWindow.document)[0].value = '99' | |
$('#type_referenca', upnWindow.document).attr('value', '99') | |
$('#type_referenca2', upnWindow.document)[0].value = 'yyyyyyyyyyy' | |
$('#type_referenca2', upnWindow.document).attr('value', 'yyyyyyyyyyy') | |
$('#type_namen_rok_placila2', upnWindow.document)[0].value = 'Transaction comment here' | |
$('#type_namen_rok_placila2', upnWindow.document).attr('value', 'Transaction comment here') | |
// Open iban window | |
$('#btn_preveri_iban', upnWindow.document).click(); | |
let ibanWindow = upnWindow.openedWindows[upnWindow.openedWindows.length -1]; | |
await wait(3000); | |
// Close iban window | |
$('input[type=button]', ibanWindow.document).eq(1).click(); | |
await wait(1000); | |
// Close upn window | |
$('#btn_potrditev_vnosa', upnWindow.document).click(); | |
await wait(3000); | |
// Authorise payment | |
//$('button:contains(Avtoriziraj)', upnWindow.document).click(); | |
$('button:contains(Razveljavi)', upnWindow.document).click(); | |
} | |
doWork(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment