@frontend_royalties
@ows_royalties
Feature: Tax Eligibility Re-evaluation on Paid By Change

  Background:
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    And I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | ORCHARD-UK              |
      | agreementType    | Orchard                 |
      | currency         | USD                     |
      | owner            | awal                    |
      | paymentMethod    | payoneer_whitelabel     |
      | paymentMinimum   | 123                     |
      | paymentSchedule  | 45 days after month end |
    When I send request to create 1 account via API
    And I fill general details and update accounts to active

  @id_d21afe6e8fa7636652853bfd56ecd61029325fb77d5dfa6d69711a0bdecbad1c
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (ORCHARD-UK to AWAL-US)
    Then tax_eligibility is set to "complete"
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for AWAL Recordings America, Inc.
    Then I should be able to verify account generals details is changed and contain payoneer_whitelabel
    Then tax_eligibility is set to "init"
    Then payment_eligibility is set to "approved"
    Then I should be able to verify account generals details is changed and contain AWAL-US

  @id_1e0ebbc0979adc7b621276ccad3504961f20627872e92445b02ad08706485e9b
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (ORCHARD-UK to ORCHARD-US)
    Then tax_eligibility is set to "complete"
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for Foundation Media LLC
    Then I change account payment method to "payoneer_wire" for "Orchard" agreement
    Then I should be able to verify account generals details is changed and contain payoneer_wire
    Then tax_eligibility is set to "init"
    Then payment_eligibility is set to "approved"
    Then I should be able to verify account generals details is changed and contain ORCHARD-US

  @id_f6daac16c84c373b1d27edba3f74d51a39145b67c3d6a4f2bb200ec71da2e19e
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (ORCHARD-UK to ORCHARD-ES)
    Then tax_eligibility is set to "complete"
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for Altafonte Network, S.L.U
    Then I change account payment method to "preexisting_payoneer_account" for "Orchard" agreement with message:
      """
      Changes May Trigger Program UpdateUpdating these fields may move the client to a new Payoneer program. Banking must be set up again before payments can be processed
      """
    Then I should be able to verify account generals details is changed and contain preexisting_payoneer_account
    Then tax_eligibility is set to "init"
    Then payment_eligibility is set to "init"
    Then I should be able to verify account generals details is changed and contain ORCHARD-ES
