diff --git a/code/WorkInProgress/computer3/lapvend.dm b/code/WorkInProgress/computer3/lapvend.dm
index 747078edcd..36ca07118d 100644
--- a/code/WorkInProgress/computer3/lapvend.dm
+++ b/code/WorkInProgress/computer3/lapvend.dm
@@ -213,58 +213,66 @@
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(vendor_account)
- var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
- var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
- if(D)
- var/transaction_amount = total()
- if(transaction_amount <= D.money)
-
- //transfer the money
- D.money -= transaction_amount
- vendor_account.money += transaction_amount
-
- //Transaction logs
- var/datum/transaction/T = new()
- T.target_name = "[vendor_account.owner_name] (via [src.name])"
- T.purpose = "Purchase of Laptop"
- if(transaction_amount > 0)
- T.amount = "([transaction_amount])"
- else
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- D.transaction_log.Add(T)
- //
- T = new()
- T.target_name = D.owner_name
- T.purpose = "Purchase of Laptop"
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- vendor_account.transaction_log.Add(T)
-
- newlap = new /obj/machinery/computer3/laptop/vended(src.loc)
-
- choose_progs(C)
- vend()
- popup.close()
- newlap.close_computer()
- newlap = null
- cardreader = 0
- floppy = 0
- radionet = 0
- camera = 0
- network = 0
- power = 0
+ var/datum/money_account/CH = get_account(C.associated_account_number)
+ if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
+ if(vendor_account)
+ var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
+ var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
+ if(D)
+ transfer_and_vend(D, C)
else
- usr << "\icon[src]You don't have that much money!"
+ usr << "\icon[src]Unable to access account. Check security settings and try again."
else
- usr << "\icon[src]Unable to access account. Check security settings and try again."
+ usr << "\icon[src]Unable to access vendor account. Please record the machine ID and call CentComm Support."
else
- usr << "\icon[src]Unable to access vendor account. Please record the machine ID and call CentComm Support."
+ transfer_and_vend(CH, C)
+
+
+// Transfers money and vends the laptop.
+/obj/machinery/lapvend/proc/transfer_and_vend(var/datum/money_account/D, var/obj/item/weapon/card/C)
+ var/transaction_amount = total()
+ if(transaction_amount <= D.money)
+
+ //transfer the money
+ D.money -= transaction_amount
+ vendor_account.money += transaction_amount
+ //Transaction logs
+ var/datum/transaction/T = new()
+ T.target_name = "[vendor_account.owner_name] (via [src.name])"
+ T.purpose = "Purchase of Laptop"
+ if(transaction_amount > 0)
+ T.amount = "([transaction_amount])"
+ else
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ D.transaction_log.Add(T)
+ //
+ T = new()
+ T.target_name = D.owner_name
+ T.purpose = "Purchase of Laptop"
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ vendor_account.transaction_log.Add(T)
+
+ newlap = new /obj/machinery/computer3/laptop/vended(src.loc)
+
+ choose_progs(C)
+ vend()
+ popup.close()
+ newlap.close_computer()
+ newlap = null
+ cardreader = 0
+ floppy = 0
+ radionet = 0
+ camera = 0
+ network = 0
+ power = 0
+ else
+ usr << "\icon[src]You don't have that much money!"
/obj/machinery/lapvend/proc/total()
var/total = 0
@@ -352,49 +360,53 @@
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(vendor_account)
- var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
- var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
- if(D)
- var/transaction_amount = total()
-
- //transfer the money
- D.money += transaction_amount
- vendor_account.money -= transaction_amount
-
- //Transaction logs
- var/datum/transaction/T = new()
- T.target_name = "[vendor_account.owner_name] (via [src.name])"
- T.purpose = "Return purchase of Laptop"
- if(transaction_amount > 0)
- T.amount = "([transaction_amount])"
+ var/datum/money_account/CH = get_account(C.associated_account_number)
+ if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
+ if(vendor_account)
+ var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
+ var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
+ if(D)
+ transfer_and_reimburse(D)
else
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- D.transaction_log.Add(T)
- //
- T = new()
- T.target_name = D.owner_name
- T.purpose = "Return purchase of Laptop"
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- vendor_account.transaction_log.Add(T)
-
- del(relap)
-
- vendmode = 0
- cardreader = 0
- floppy = 0
- radionet = 0
- camera = 0
- network = 0
- power = 0
-
+ usr << "\icon[src]Unable to access account. Check security settings and try again."
else
- usr << "\icon[src]Unable to access account. Check security settings and try again."
+ usr << "\icon[src]Unable to access vendor account. Please record the machine ID and call CentComm Support."
else
- usr << "\icon[src]Unable to access vendor account. Please record the machine ID and call CentComm Support."
\ No newline at end of file
+ transfer_and_reimburse(CH)
+
+/obj/machinery/lapvend/proc/transfer_and_reimburse(var/datum/money_account/D)
+ var/transaction_amount = total()
+ //transfer the money
+ D.money += transaction_amount
+ vendor_account.money -= transaction_amount
+
+ //Transaction logs
+ var/datum/transaction/T = new()
+ T.target_name = "[vendor_account.owner_name] (via [src.name])"
+ T.purpose = "Return purchase of Laptop"
+ if(transaction_amount > 0)
+ T.amount = "([transaction_amount])"
+ else
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ D.transaction_log.Add(T)
+ //
+ T = new()
+ T.target_name = D.owner_name
+ T.purpose = "Return purchase of Laptop"
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ vendor_account.transaction_log.Add(T)
+
+ del(relap)
+ vendmode = 0
+ cardreader = 0
+ floppy = 0
+ radionet = 0
+ camera = 0
+ network = 0
+ power = 0
\ No newline at end of file
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 5dd31a036e..009ab4c809 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -187,53 +187,60 @@
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(check_accounts)
- if(vendor_account)
- var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
- var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
- if(D)
- var/transaction_amount = currently_vending.price
- if(transaction_amount <= D.money)
-
- //transfer the money
- D.money -= transaction_amount
- vendor_account.money += transaction_amount
-
- //create entries in the two account transaction logs
- var/datum/transaction/T = new()
- T.target_name = "[vendor_account.owner_name] (via [src.name])"
- T.purpose = "Purchase of [currently_vending.product_name]"
- if(transaction_amount > 0)
- T.amount = "([transaction_amount])"
- else
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- D.transaction_log.Add(T)
- //
- T = new()
- T.target_name = D.owner_name
- T.purpose = "Purchase of [currently_vending.product_name]"
- T.amount = "[transaction_amount]"
- T.source_terminal = src.name
- T.date = current_date_string
- T.time = worldtime2text()
- vendor_account.transaction_log.Add(T)
-
- // Vend the item
- src.vend(src.currently_vending, usr)
- currently_vending = null
+ var/datum/money_account/CH = get_account(C.associated_account_number)
+ if (CH) // Only proceed if card contains proper account number.
+ if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
+ if(vendor_account)
+ var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
+ var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
+ transfer_and_vend(D)
else
- usr << "\icon[src]You don't have that much money!"
+ usr << "\icon[src]Unable to access account. Check security settings and try again."
else
- usr << "\icon[src]Unable to access account. Check security settings and try again."
+ //Just Vend it.
+ transfer_and_vend(CH)
else
- //Just Vend it.
+ usr << "\icon[src]Error: Unable to access your account. Please contact technical support if problem persists."
+
+/obj/machinery/vending/proc/transfer_and_vend(var/datum/money_account/acc)
+ if(acc)
+ var/transaction_amount = currently_vending.price
+ if(transaction_amount <= acc.money)
+
+ //transfer the money
+ acc.money -= transaction_amount
+ vendor_account.money += transaction_amount
+
+ //create entries in the two account transaction logs
+ var/datum/transaction/T = new()
+ T.target_name = "[vendor_account.owner_name] (via [src.name])"
+ T.purpose = "Purchase of [currently_vending.product_name]"
+ if(transaction_amount > 0)
+ T.amount = "([transaction_amount])"
+ else
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ acc.transaction_log.Add(T)
+ //
+ T = new()
+ T.target_name = acc.owner_name
+ T.purpose = "Purchase of [currently_vending.product_name]"
+ T.amount = "[transaction_amount]"
+ T.source_terminal = src.name
+ T.date = current_date_string
+ T.time = worldtime2text()
+ vendor_account.transaction_log.Add(T)
+
+ // Vend the item
src.vend(src.currently_vending, usr)
currently_vending = null
+ else
+ usr << "\icon[src]You don't have that much money!"
else
- usr << "\icon[src]Unable to access vendor account. Please record the machine ID and call CentComm Support."
+ usr << "\icon[src]Error: Unable to access your account. Please contact technical support if problem persists."
+
/obj/machinery/vending/attack_paw(mob/user as mob)
return attack_hand(user)