mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
NT Pay app. Money send on distance, transaction log! (#70108)
* base * reasons * GetToken proc, with a many remarks * Add a way to change reason in transfer_money proc. Add a reasons. * Reason to use the app. Commission. Standard application. * Apply suggestions from code review - Tralezab Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com> * Tralezab & jlsnow301 advices. New format(everywhere) * Nanotrasen * Refactor TGUI(not me:( ). Fix useless capitalize * Update code/modules/economy/account.dm * Trans transforms in transaction * coMmission. little autodoc mistalke. Translation != Transaction * oops * Merge Conflict * ... * back feats * mistakes bye! * ну да Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
This commit is contained in:
co-authored by
tralezab
parent
92bdb50232
commit
04ca99d7e9
@@ -102,6 +102,12 @@
|
||||
/// Boolean value. If TRUE, the [Intern] tag gets prepended to this ID card when the label is updated.
|
||||
var/is_intern = FALSE
|
||||
|
||||
///Way to use NT pay. Or how to save money. 1 - 100%, 0.05 - 5%
|
||||
var/commission = 0.05
|
||||
|
||||
///Payment under >99 credits withdraw. (this + 1 = min value to withdraw)
|
||||
var/commission_minimal = 5
|
||||
|
||||
/obj/item/card/id/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
@@ -580,7 +586,7 @@
|
||||
if(!cash_money)
|
||||
to_chat(user, span_warning("[money] doesn't seem to be worth anything!"))
|
||||
return
|
||||
registered_account.adjust_money(cash_money)
|
||||
registered_account.adjust_money(cash_money, "System: Deposit")
|
||||
SSblackbox.record_feedback("amount", "credits_inserted", cash_money)
|
||||
log_econ("[cash_money] credits were inserted into [src] owned by [src.registered_name]")
|
||||
if(physical_currency)
|
||||
@@ -612,7 +618,7 @@
|
||||
total += physical_money.get_item_credit_value()
|
||||
CHECK_TICK
|
||||
|
||||
registered_account.adjust_money(total)
|
||||
registered_account.adjust_money(total, "System: Deposit")
|
||||
SSblackbox.record_feedback("amount", "credits_inserted", total)
|
||||
log_econ("[total] credits were inserted into [src] owned by [src.registered_name]")
|
||||
QDEL_LIST(money)
|
||||
@@ -665,15 +671,19 @@
|
||||
if(loc != user)
|
||||
to_chat(user, span_warning("You must be holding the ID to continue!"))
|
||||
return
|
||||
var/amount_to_remove = tgui_input_number(user, "How much do you want to withdraw? (Max: [registered_account.account_balance] cr)", "Withdraw Funds", max_value = registered_account.account_balance)
|
||||
if(registered_account.account_balance < (commission_minimal + 1) )
|
||||
to_chat(user, span_warning("You must be holding the ID to continue!"))
|
||||
return
|
||||
var/amount_to_remove = tgui_input_number(user, "How much do you want to withdraw? (Max: [registered_account.account_balance] cr)(Commission is [commission_minimal] credits. From 100 credits is [commission * 100]% with rounding.)", "Withdraw Funds", max_value = registered_account.account_balance, min_value = 6)
|
||||
if(!amount_to_remove || QDELETED(user) || QDELETED(src) || issilicon(user) || loc != user)
|
||||
return
|
||||
if(!alt_click_can_use_id(user))
|
||||
return
|
||||
if(registered_account.adjust_money(-amount_to_remove))
|
||||
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)
|
||||
if(registered_account.adjust_money(-amount_to_remove, "System: Withdrawal"))
|
||||
var/commission_amount = amount_to_remove < 100 ? commission_minimal : round(amount_to_remove * commission)
|
||||
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove - commission_amount)
|
||||
user.put_in_hands(holochip)
|
||||
to_chat(user, span_notice("You withdraw [amount_to_remove] credits into a holochip."))
|
||||
to_chat(user, span_notice("You withdraw [amount_to_remove - commission_amount] credits into a holochip. Commission was [commission_amount] credits"))
|
||||
SSblackbox.record_feedback("amount", "credits_removed", amount_to_remove)
|
||||
log_econ("[amount_to_remove] credits were removed from [src] owned by [src.registered_name]")
|
||||
return
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
var/amount = B.account_balance * percentage_lost
|
||||
var/datum/bank_account/account = bogdanoff?.get_bank_account()
|
||||
if (account) // get_bank_account() may return FALSE
|
||||
account.transfer_money(B, amount)
|
||||
account.transfer_money(B, amount, "?VIVA¿: !LA CRABBE¡")
|
||||
B.bank_card_talk("You have lost [percentage_lost * 100]% of your funds! A spacecoin credit deposit machine is located at: [get_area(src)].")
|
||||
addtimer(CALLBACK(src, .proc/dump), 150) //Drain every 15 seconds
|
||||
|
||||
|
||||
@@ -471,9 +471,9 @@
|
||||
to_chat(usr, span_notice("You do not possess the funds to purchase this."))
|
||||
return TRUE
|
||||
else
|
||||
account.adjust_money(-sale_price)
|
||||
account.adjust_money(-sale_price, "Display Case: [capitalize(showpiece)]")
|
||||
if(payments_acc)
|
||||
payments_acc.adjust_money(sale_price)
|
||||
payments_acc.adjust_money(sale_price, "Display Case: [capitalize(showpiece)]")
|
||||
usr.put_in_hands(showpiece)
|
||||
to_chat(usr, span_notice("You purchase [showpiece] for [sale_price] credits."))
|
||||
playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
|
||||
|
||||
Reference in New Issue
Block a user