/obj/item/device/eftpos name = "EFTPOS scanner" desc = "Swipe your ID card to make purchases electronically." icon = 'icons/obj/device.dmi' icon_state = "eftpos" var/machine_id = "" var/eftpos_name = "Default EFTPOS scanner" var/transaction_locked = 0 var/transaction_paid = 0 var/transaction_amount = 0 var/transaction_purpose = "Default charge" var/access_code = 0 var/obj/machinery/computer/account_database/linked_db var/datum/money_account/linked_account /obj/item/device/eftpos/New() ..() machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]" access_code = rand(1111,111111) reconnect_database() spawn(0) print_reference() //by default, connect to the station account //the user of the EFTPOS device can change the target account though, and no-one will be the wiser (except whoever's being charged) linked_account = station_account /obj/item/device/eftpos/proc/print_reference() playsound(loc, "sound/goonstation/machines/printer_thermal.ogg", 50, 1) var/obj/item/weapon/paper/R = new(src.loc) R.name = "Reference: [eftpos_name]" // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:31: R.info = "[eftpos_name] reference

" R.info = {"[eftpos_name] reference

Access code: [access_code]

Do not lose or misplace this code.
"} // END AUTOFIX //stamp the paper var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') stampoverlay.icon_state = "paper_stamp-cent" if(!R.stamped) R.stamped = new R.stamped += /obj/item/weapon/stamp R.overlays += stampoverlay R.stamps += "
This paper has been stamped by the EFTPOS device." var/obj/item/smallDelivery/D = new(R.loc) R.loc = D D.wrapped = R D.name = "small parcel - 'EFTPOS access code'" /obj/item/device/eftpos/proc/reconnect_database() var/turf/location = get_turf(src) if(!location) return for(var/obj/machinery/computer/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines' if(DB.z == location.z) linked_db = DB break /obj/item/device/eftpos/attack_self(mob/user as mob) if(get_dist(src,user) <= 1) // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:59: var/dat = "[eftpos_name]
" var/dat = {"[eftpos_name]
This terminal is [machine_id]. Report this code when contacting Nanotrasen IT Support
"} // END AUTOFIX if(transaction_locked) // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:59: dat += "Reset[transaction_paid ? "" : " (authentication required)"]

" dat += {"Reset[transaction_paid ? "" : " (authentication required)"]

Transaction purpose: [transaction_purpose]
Value: $[transaction_amount]
Linked account: [linked_account ? linked_account.owner_name : "None"]
"} // END AUTOFIX if(transaction_paid) dat += "This transaction has been processed successfully.
" else // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:67: dat += "Swipe your card below the line to finish this transaction.
" dat += {"Swipe your card below the line to finish this transaction.
\[------\]"} // END AUTOFIX else // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:70: dat += "Lock in new transaction

" dat += {"Lock in new transaction

Transaction purpose: [transaction_purpose]
Value: $[transaction_amount]
Linked account: [linked_account ? linked_account.owner_name : "None"]
Change access code
Change EFTPOS ID
Scan card to reset access code \[------\]"} // END AUTOFIX user << browse(dat,"window=eftpos") else user << browse(null,"window=eftpos") /obj/item/device/eftpos/attackby(O as obj, user as mob, params) if(istype(O, /obj/item/weapon/card)) //attempt to connect to a new db, and if that doesn't work then fail if(!linked_db) reconnect_database() if(linked_db) if(linked_account) var/obj/item/weapon/card/I = O scan_card(I) else to_chat(usr, "[bicon(src)]Unable to connect to linked account.") else to_chat(usr, "[bicon(src)]Unable to connect to accounts database.") else ..() /obj/item/device/eftpos/Topic(var/href, var/href_list) if(href_list["choice"]) switch(href_list["choice"]) if("change_code") var/attempt_code = input("Re-enter the current EFTPOS access code", "Confirm old EFTPOS code") as num if(attempt_code == access_code) var/trycode = input("Enter a new access code for this device (4-6 digits, numbers only)", "Enter new EFTPOS code") as num if(trycode >= 1000 && trycode <= 999999) access_code = trycode else alert("That is not a valid code!") print_reference() else to_chat(usr, "[bicon(src)]Incorrect code entered.") if("change_id") var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code")) if(attempt_code == access_code) var name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") as text|null if(name) eftpos_name = name + " EFTPOS scanner" print_reference() else to_chat(usr, "[bicon(src)]Incorrect code entered.") if("link_account") if(!linked_db) reconnect_database() if(linked_db) var/attempt_account_num = input("Enter account number to pay EFTPOS charges into", "New account number") as num var/attempt_pin = input("Enter pin code", "Account pin") as num linked_account = attempt_account_access(attempt_account_num, attempt_pin, 1) else to_chat(usr, "[bicon(src)]Unable to connect to accounts database.") if("trans_purpose") var/purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose") as text|null if(purpose) transaction_purpose = purpose if("trans_value") var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num if(try_num < 0) alert("That is not a valid amount!") else transaction_amount = try_num if("toggle_lock") if(transaction_locked) var/attempt_code = input("Enter EFTPOS access code", "Reset Transaction") as num if(attempt_code == access_code) transaction_locked = 0 transaction_paid = 0 else if(linked_account) transaction_locked = 1 else to_chat(usr, "[bicon(src)] No account connected to send transactions to.") if("scan_card") //attempt to connect to a new db, and if that doesn't work then fail if(!linked_db) reconnect_database() if(linked_db && linked_account) var/obj/item/I = usr.get_active_hand() if(istype(I, /obj/item/weapon/card)) scan_card(I) else to_chat(usr, "[bicon(src)]Unable to link accounts.") if("reset") //reset the access code - requires HoP/captain access var/obj/item/I = usr.get_active_hand() if(istype(I, /obj/item/weapon/card)) var/obj/item/weapon/card/id/C = I if(access_cent_commander in C.access || access_hop in C.access || access_captain in C.access) access_code = 0 to_chat(usr, "[bicon(src)]Access code reset to 0.") else if(istype(I, /obj/item/weapon/card/emag)) access_code = 0 to_chat(usr, "[bicon(src)]Access code reset to 0.") src.attack_self(usr) /obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I) if(istype(I, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/C = I visible_message("[usr] swipes a card through [src].") if(transaction_locked && !transaction_paid) if(linked_account) var/attempt_pin = input("Enter pin code", "EFTPOS transaction") as num var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2) if(D) if(transaction_amount <= D.money) playsound(src, 'sound/machines/chime.ogg', 50, 1) src.visible_message("[bicon(src)] The [src] chimes.") transaction_paid = 1 //transfer the money D.money -= transaction_amount linked_account.money += transaction_amount //create entries in the two account transaction logs var/datum/transaction/T = new() T.target_name = "[linked_account.owner_name] (via [eftpos_name])" T.purpose = transaction_purpose if(transaction_amount > 0) T.amount = "([transaction_amount])" else T.amount = "[transaction_amount]" T.source_terminal = machine_id T.date = current_date_string T.time = worldtime2text() D.transaction_log.Add(T) // T = new() T.target_name = D.owner_name T.purpose = transaction_purpose T.amount = "[transaction_amount]" T.source_terminal = machine_id T.date = current_date_string T.time = worldtime2text() linked_account.transaction_log.Add(T) else to_chat(usr, "[bicon(src)]You don't have that much money!") else to_chat(usr, "[bicon(src)]Unable to access account. Check security settings and try again.") else to_chat(usr, "[bicon(src)]EFTPOS is not connected to an account.") else ..() //emag?