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

  @id_b51300392e6cefef854535f0b91ea88350c36504a29b3a7af8e255b0be39ef4d
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (AWAL-US to ORCHARD-US)
    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           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | GBP                     |
      | owner            | awal                    |
      | 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
    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_8e7b92f156d4c7e8c5700710a344ce6a1b89faf0a5e59855983f1a1c51c81b7b
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (AWAL-US to ORCHARD-ES)
    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           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | 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
    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

  @id_43463c4454376e81b013c3007387fca184206cfd790c5be1e0b04a14e29982d0
  Scenario: Re-evaluate tax/payment eligibility when Paid By changes (AWAL-US to AWAL-UK)
    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           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | 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
    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 Licensing Ltd
    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 PAYONEER_WHITELABEL
