/obj/item/device/eftpos name = "\improper 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/datum/money_account/linked_account /obj/item/device/eftpos/New() ..() machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]" access_code = rand(1111,111111) spawn(0) print_reference() //create a short manual as well var/obj/item/weapon/paper/R = new(src.loc) R.name = "Steps to success: Correct EFTPOS Usage" /* R.info += "When first setting up your EFTPOS device:" R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
" R.info += "2. Confirm that your EFTPOS device is connected to your local accounts database. For additional assistance with this step, contact NanoTrasen IT Support
" R.info += "3. Confirm that your EFTPOS device has been linked to the account that you wish to recieve funds for all transactions processed on this device.
" R.info += "When starting a new transaction with your EFTPOS device:" R.info += "1. Ensure the device is UNLOCKED so that new data may be entered.
" R.info += "2. Enter a sum of money and reference message for the new transaction.
" R.info += "3. Lock the transaction, it is now ready for your customer.
" R.info += "4. If at this stage you wish to modify or cancel your transaction, you may simply reset (unlock) your EFTPOS device.
" R.info += "5. Give your EFTPOS device to the customer, they must authenticate the transaction by swiping their ID card and entering their PIN number.
" R.info += "6. If done correctly, the transaction will be logged to both accounts with the reference you have entered, the terminal ID of your EFTPOS device and the money transferred across accounts.
" */ //Temptative new manual: R.info += "First EFTPOS setup:
" R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
" R.info += "2. Connect the EFTPOS to the account in which you want to receive the funds.

" R.info += "When starting a new transaction:
" R.info += "1. Enter the amount of money you want to charge and a purpose message for the new transaction.
" R.info += "2. Lock the new transaction. If you want to modify or cancel the transaction, you simply have to reset your EFTPOS device.
" R.info += "3. Give the EFTPOS device to your customer, he/she must finish the transaction by swiping their ID card or a charge card with enough funds.
" R.info += "4. If everything is done correctly, the money will be transferred. To unlock the device you will have to reset the EFTPOS device.
" //stamp the paper var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') stampoverlay.icon_state = "paper_stamp-cent" if(!R.stamped) R.stamped = new R.offset_x += 0 R.offset_y += 0 R.ico += "paper_stamp-cent" R.stamped += /obj/item/weapon/stamp R.overlays += stampoverlay R.stamps += "
This paper has been stamped by the EFTPOS device." //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() var/obj/item/weapon/paper/R = new(src.loc) R.name = "Reference: [eftpos_name]" R.info = "[eftpos_name] reference

" R.info += "Access code: [access_code]

" R.info += "Do not lose or misplace this code.
" //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/attack_self(mob/user as mob) if(get_dist(src,user) <= 1) var/dat = "[eftpos_name]
" dat += "This terminal is [machine_id]. Report this code when contacting IT Support
" if(transaction_locked) dat += "Back[transaction_paid ? "" : " (authentication required)"]

" dat += "Transaction purpose: [transaction_purpose]
" dat += "Value: $[transaction_amount]
" dat += "Linked account: [linked_account ? linked_account.owner_name : "None"]
" if(transaction_paid) dat += "This transaction has been processed successfully.
" else dat += "Swipe your card below the line to finish this transaction.
" dat += "\[------\]" else dat += "Lock in new transaction

" dat += "Transaction purpose: [transaction_purpose]
" dat += "Value: $[transaction_amount]
" dat += "Linked account: [linked_account ? linked_account.owner_name : "None"]
" dat += "Change access code
" dat += "Change EFTPOS ID
" dat += "Scan card to reset access code \[------\]" user << browse(dat,"window=eftpos") else user << browse(null,"window=eftpos") /obj/item/device/eftpos/attackby(obj/item/O as obj, user as mob) var/obj/item/weapon/card/id/I = O.GetID() if(I) if(linked_account) scan_card(I, O) else usr << "\icon[src]Unable to connect to linked account." else if (istype(O, /obj/item/weapon/spacecash/ewallet)) var/obj/item/weapon/spacecash/ewallet/E = O if (linked_account) if(!linked_account.suspended) if(transaction_locked && !transaction_paid) if(transaction_amount <= E.worth) playsound(src, 'sound/machines/chime.ogg', 50, 1) src.visible_message("\icon[src] \The [src] chimes.") transaction_paid = 1 //transfer the money E.worth -= transaction_amount linked_account.money += transaction_amount //create entry in the EFTPOS linked account transaction log var/datum/transaction/T = new() T.target_name = E.owner_name //D.owner_name T.purpose = (transaction_purpose ? transaction_purpose : "None supplied.") T.amount = transaction_amount T.source_terminal = machine_id T.date = current_date_string T.time = worldtime2text() linked_account.transaction_log.Add(T) else usr << "\icon[src]\The [O] doesn't have that much money!" else usr << "\icon[src]Connected account has been suspended." else usr << "\icon[src]EFTPOS is not connected to an account." 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 usr << "\icon[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) eftpos_name = sanitize(input("Enter a new terminal ID for this device", "Enter new EFTPOS ID"), MAX_NAME_LEN) + " EFTPOS scanner" print_reference() else usr << "\icon[src]Incorrect code entered." if("link_account") 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) if(linked_account) if(linked_account.suspended) linked_account = null usr << "\icon[src]Account has been suspended." else usr << "\icon[src]Account not found." if("trans_purpose") var/choice = sanitize(input("Enter reason for EFTPOS transaction", "Transaction purpose")) if(choice) transaction_purpose = choice 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) if (transaction_paid) transaction_locked = 0 transaction_paid = 0 else 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 usr << "\icon[src]No account connected to send transactions to." if("scan_card") if(linked_account) var/obj/item/I = usr.get_active_hand() if (istype(I, /obj/item/weapon/card)) scan_card(I) else usr << "\icon[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_captain in C.access || access_hop in C.access || access_captain in C.access) access_code = 0 usr << "\icon[src]Access code reset to 0." else if (istype(I, /obj/item/weapon/card/emag)) access_code = 0 usr << "\icon[src]Access code reset to 0." src.attack_self(usr) /obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I, var/obj/item/ID_container) if (istype(I, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/C = I if(I==ID_container || ID_container == null) usr.visible_message("\The [usr] swipes a card through \the [src].") else usr.visible_message("\The [usr] swipes \the [ID_container] through \the [src].") if(transaction_locked && !transaction_paid) if(linked_account) if(!linked_account.suspended) var/attempt_pin = "" var/datum/money_account/D = get_account(C.associated_account_number) if(D.security_level) attempt_pin = input("Enter pin code", "EFTPOS transaction") as num D = null D = attempt_account_access(C.associated_account_number, attempt_pin, 2) if(D) if(!D.suspended) if(transaction_amount <= D.money) playsound(src, 'sound/machines/chime.ogg', 50, 1) src.visible_message("\icon[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 usr << "\icon[src]You don't have that much money!" else usr << "\icon[src]Your account has been suspended." else usr << "\icon[src]Unable to access account. Check security settings and try again." else usr << "\icon[src]Connected account has been suspended." else usr << "\icon[src]EFTPOS is not connected to an account." else if (istype(I, /obj/item/weapon/card/emag)) if(transaction_locked) if(transaction_paid) usr << "\icon[src]You stealthily swipe \the [I] through \the [src]." transaction_locked = 0 transaction_paid = 0 else usr.visible_message("\The [usr] swipes a card through \the [src].") playsound(src, 'sound/machines/chime.ogg', 50, 1) src.visible_message("\icon[src] \The [src] chimes.") transaction_paid = 1 else ..() //emag?