Add set_balance_as_sum and wait_with_text to BankAccountConnector

This commit is contained in:
Patrick Gansterer 2020-07-29 19:18:12 +02:00
parent 3f25138997
commit 75129b52c6
3 changed files with 15 additions and 6 deletions

View File

@ -526,11 +526,12 @@ de:
text_2: Die hier gezeigten Spalten sind Beispiele. Ist ein "x" in der ersten Spalte, wird der Artikel aussortiert und entfernt. Das erlaubt Dir die Tabelle zu ändern und schnell viele Artikel auf ein Mal zu entfernen, zum Beispiel wenn Artkiel des Lieferanten nicht mehr verfügbar sind. Die Kategorie wird der Foodsoft Kategorie zugeordnet (durch die Kategorienamen und die Importnamen).
title: Artikel des Lieferanten %{supplier} hochladen
bank_account_connector:
confirm_app: Bitte bestätige den Code %{code} in deiner App.
confirm: Bitte bestätige den Code %{code}.
fields:
email: E-Mail
pin: PIN
password: Passwort
tan: TAN
username: Benutzername
config:
hints:

View File

@ -544,11 +544,12 @@ en:
text_2: The rows shown here are examples. When there is an "x" in the first column, the article is outlisted and will be removed. This allows you to edit the spreadsheet and quickly remove many articles at once, for example when articles become unavailable with the supplier. The category will be matched to your Foodsoft category list (both by category name and import names).
title: Upload articles of %{supplier}
bank_account_connector:
confirm_app: Please confirm the code %{code} in your app.
confirm: Please confirum the code %{code}.
fields:
email: E-Mail
pin: PIN
password: Password
tan: TAN
username: Username
config:
hints:

View File

@ -96,14 +96,18 @@ class BankAccountConnector
@controls += [TextItem.new(data)]
end
def wait_with_text(auto_submit, data)
def confirm_text(code)
text t('.confirm', code: code)
end
def wait_with_text(auto_submit, code)
@auto_submit = auto_submit
@controls += [TextItem.new(data)]
confirm_text code
end
def wait_for_app(code)
hidden_field :twofactor, code
wait_with_text 3000, t('.confirm_app', code: code)
wait_with_text 3000, code
nil
end
@ -119,11 +123,14 @@ class BankAccountConnector
@controls += [PasswordField.new(name, value, t(name))]
end
def set_balance(amount)
@bank_account.balance = amount
end
def set_balance_as_sum
@bank_account.balance = @bank_account.bank_transactions.sum(:amount)
end
def continuation_point
@bank_account.import_continuation_point
end