@frontend_royalties
@ows_royalties
Feature: Abacus Earnings Transfer 1

  @id_05454e137317a56cedecb8253346ce1a58cf8362691b853a52e6887a6bf517d9
  Scenario Outline: Add contract earnings transfer
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    Given I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-UK                 |
      | agreementType    | AWAL Core               |
      | currency         | GBP                     |
      | owner            | awal                    |
      | paymentMinimum   | 100                     |
      | paymentSchedule  | 45 days after month end |
    And I create 2 new active accounts via API
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for AWAL Recordings Licensing Ltd
    And I prepare an abacus earnings transfer data:
      | Key                           | Value                           |
      | transferType                  | <transferType>                  |
      | rateType                      | <rateType>                      |
      | amount                        | <amount>                        |
      | transferSource                | <transferSource>                |
      | processNegativeClosingBalance | <processNegativeClosingBalance> |
      | transferStatus                | <transferStatus>                |
    Then I should be able to define earnings transfer for a contract

    Examples:
      | transferType       | rateType     | amount | transferSource  | processNegativeClosingBalance | transferStatus |
      | Override           | Percent      | 10     | Gross Revenue   | Yes                           | Not Active     |
      # Balance Transfer: rateType, amount, and transferSource are predefined by the UI (Percent, 100, Closing Balance) and cannot be changed
      | Balance Transfer   | Percent      | 100    | Closing Balance | Yes                           | Not Active     |
      | Transfer of Income | Fixed Amount | 15     | Closing Balance | No                            | Active         |

  @id_35a1a29cbc183d925b2c3bfc17e0cccd1dc0573bda6314f9dcc7a28ee517fc01
  Scenario: Edit contract earnings transfer
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    Given I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-UK                 |
      | agreementType    | AWAL Core               |
      | currency         | GBP                     |
      | owner            | awal                    |
      | paymentMinimum   | 100                     |
      | paymentSchedule  | 45 days after month end |
    And I create 2 new active accounts via API
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for AWAL Recordings Licensing Ltd
    And I prepare an abacus earnings transfer data:
      | Key                           | Value         |
      | transferType                  | Override      |
      | rateType                      | Percent       |
      | amount                        | 10            |
      | transferSource                | Gross Revenue |
      | processNegativeClosingBalance | Yes           |
      | transferStatus                | Not Active    |
    Then I should be able to define earnings transfer for a contract
    And I should be able to edit earnings transfer for a contract
