@documents
@lambda_documents_payee
Feature: EUR Bank Details - Payoneer and Abacus Edit
  For edit flow we are using payee_id 1000001 and attached to account_id = 39
  https://github.com/theorchard/python-rds-utils/pull/346 for Payoneer, this payee_id already passed KYC

  @id_2e1a3148bf037faa99962ad2b74f25b87ccf1734e910cadbc475b25e8fb76f2f
  Scenario: Eur Bank Details for Personal Bank Account type edit flow ES
    Given an orchard employee label_6971 for documents
    When I log in
    Then I can see that documents Banking & Tax Settings page works with whitelabel account name orchard_es_test
    Then I update abacus_state table, action name banking_details_review to approved
    Then I update abacus_state table, action name payment_eligibility to approved
    Then I can see approved Bank Details
    Then I click to edit bank details
    And I edit bank account and Company details for Spain
    Then I click save
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    Then I can find account by account name and go to info tab orchard_es_test
    Then I set bank details status as payoneer with webhook to approved
    And I can see that Payment details status is Received on
    And I can see that Payment details status is Bank details have passed KYC checks
    And I can see that Payment details status is Review Bank Details
    Then I approve Banking Details
    Given an orchard employee label_6971 for documents
    When I log in
    Then I can see that documents Banking & Tax Settings page works with whitelabel account name orchard_es_test
    And I can see that status is changed to Bank details were successfully approved. You can now dismiss this message
    And I can see that Bank Details were updated with edit form for country

  @id_5ee3aec3bae9dfbc9dc1aa6b1e09cc5c9e7aa9582b6a949fe257febf76998a47
  Scenario: Eur Bank Details for Business Account type edit flow US
    Given an orchard employee label_6971 for documents
    When I log in
    When I can see that documents Banking & Tax Settings page works with whitelabel account name orchard_us_test
    Then I update abacus_state table, action name banking_details_review to approved
    Then I update abacus_state table, action name payment_eligibility to approved
    Then I can see approved Bank Details
    Then I click to edit bank details
    And I edit bank account and Personal details for US
    Then I click save
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    Then I can find account by account name and go to info tab orchard_us_test
    Then I set bank details status as payoneer with webhook to approved
    Then I update abacus_state table, action name tax_eligibility to init
    And I can see that Payment details status is Received on
    And I can see that Payment details status is Bank details have passed KYC checks
    And I can see that Payment details status is Review Bank Details
    Then I approve Banking Details
    # Add and Edit W-8BEN Tax Form with Tax Rate
    # This test reuses a single seeded account across scenarios, so the account must be reset to a clean state
    And Prepare the test account tax form state for testing
    And The account eligibility status is Ineligible
    # Also verifies TreatyRateToggle and TaxFormExpirationDate
    And I can add a W-8BEN tax form with signed date 2023-01-05
    # Verify the account becomes active after tax form is added
    Then The account eligibility status is Active
    Then I can update the country of residence on a W-8BEN form
    Given an orchard employee label_6971 for documents
    When I log in
    Then I can see that documents Banking & Tax Settings page works with whitelabel account name orchard_us_test
    And I can see that status is changed to Bank details were successfully approved. You can now dismiss this message
    Then I can see that Bank Details were updated with edit form for country

  @id_998cb5d12479ab5bc3e81bc3ec3e8c0a175b0de65a3deba5a3413fe152b26ded
  Scenario: Email and phone validation for edit flow
    Given an orchard employee label_6971 for documents
    When I log in
    When I can see that documents Banking & Tax Settings page works with whitelabel account name orchard_es_test
    Then I update abacus_state table, action name banking_details_review to approved
    Then I update abacus_state table, action name payment_eligibility to approved
    Then I can see approved Bank Details
    Then I click to edit bank details
    And I check validation and update the phone field
    And I check validation and update the email field
    Then I click save
    Then I can see that Bank Details were updated with edit form for country
