mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-21 22:29:38 +02:00
Added Decimal Support in min transaction (#1681)
* Added Decimal Support in min transaction * fix: Using inbuilt money field * Updated Test
This commit is contained in:
parent
2a1b5fab1a
commit
eabfb7aae1
3 changed files with 6 additions and 5 deletions
|
@ -13,10 +13,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<%= credit_card_form.number_field :minimum_payment,
|
<%= credit_card_form.money_field :minimum_payment,
|
||||||
label: t("credit_cards.form.minimum_payment"),
|
label: t("credit_cards.form.minimum_payment"),
|
||||||
placeholder: t("credit_cards.form.minimum_payment_placeholder"),
|
placeholder: t("credit_cards.form.minimum_payment_placeholder"),
|
||||||
min: 0 %>
|
default_currency: Current.family.currency %>
|
||||||
|
|
||||||
<%= credit_card_form.number_field :apr,
|
<%= credit_card_form.number_field :apr,
|
||||||
label: t("credit_cards.form.apr"),
|
label: t("credit_cards.form.apr"),
|
||||||
placeholder: t("credit_cards.form.apr_placeholder"),
|
placeholder: t("credit_cards.form.apr_placeholder"),
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
||||||
accountable_type: "CreditCard",
|
accountable_type: "CreditCard",
|
||||||
accountable_attributes: {
|
accountable_attributes: {
|
||||||
available_credit: 5000,
|
available_credit: 5000,
|
||||||
minimum_payment: 25,
|
minimum_payment: 25.51,
|
||||||
apr: 15.99,
|
apr: 15.99,
|
||||||
expiration_date: 2.years.from_now.to_date,
|
expiration_date: 2.years.from_now.to_date,
|
||||||
annual_fee: 99
|
annual_fee: 99
|
||||||
|
@ -36,7 +36,7 @@ class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_equal 1000, created_account.balance
|
assert_equal 1000, created_account.balance
|
||||||
assert_equal "USD", created_account.currency
|
assert_equal "USD", created_account.currency
|
||||||
assert_equal 5000, created_account.accountable.available_credit
|
assert_equal 5000, created_account.accountable.available_credit
|
||||||
assert_equal 25, created_account.accountable.minimum_payment
|
assert_equal 25.51, created_account.accountable.minimum_payment
|
||||||
assert_equal 15.99, created_account.accountable.apr
|
assert_equal 15.99, created_account.accountable.apr
|
||||||
assert_equal 2.years.from_now.to_date, created_account.accountable.expiration_date
|
assert_equal 2.years.from_now.to_date, created_account.accountable.expiration_date
|
||||||
assert_equal 99, created_account.accountable.annual_fee
|
assert_equal 99, created_account.accountable.annual_fee
|
||||||
|
|
|
@ -50,7 +50,7 @@ class AccountsTest < ApplicationSystemTestCase
|
||||||
test "can create credit card account" do
|
test "can create credit card account" do
|
||||||
assert_account_created "CreditCard" do
|
assert_account_created "CreditCard" do
|
||||||
fill_in "Available credit", with: 1000
|
fill_in "Available credit", with: 1000
|
||||||
fill_in "Minimum payment", with: 25
|
fill_in "account[accountable_attributes][minimum_payment]", with: 25.51
|
||||||
fill_in "APR", with: 15.25
|
fill_in "APR", with: 15.25
|
||||||
fill_in "Expiration date", with: 1.year.from_now.to_date
|
fill_in "Expiration date", with: 1.year.from_now.to_date
|
||||||
fill_in "Annual fee", with: 100
|
fill_in "Annual fee", with: 100
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue