# ✅ Account360Profile endpoints and queries with PP authorization

# ows services

## ows-abacus-account ✅

[ows-abacus-account](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-abacus-account%2019897177520f8089b9e4fc235ae26cfc.csv)

## ows-abacus-contract  ✅

[ows-abacus-contract ](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-abacus-contract%201b597177520f80eb95ddeef123e76bc5.csv)

## ows-store ✅

[ows-store](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-store%2019997177520f801da536d24f036f5339.csv)

## ows-royalties ✅

[ows-royalties](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-royalties%2019997177520f809d9d99cc417704c1f9.csv)

## ows-abacus-state ✅

`ows-abacus-state` looks very simple in that it has very few endpoints, and seemingly only reads/writes to one table `abacus_state`. It is actually more complicated because it represents the [State / State Transitions](https://www.notion.so/ABACUS-State-Transitions-c2065ae09d4d4e7e87f4aed7634fa22c?pvs=21) of basically EVERY entity with state in Abacus. An entity can have multiple state machines.

Thus this microservice’s lookup endpoints can return data about any individual entity’s state machine. The table below summarizes the various resource type sand states supported.

All view operations will be checked using `view_{parent_table_name}_abacus_state` action.

- QUESTION: Why not re-use `view` action?
    - For example `statement_period` resource type has the “view” action. This can be used to allow Customer Accounting (client/external) users to view/list statement periods. However, it is excessive to allow Customer Accounting users to view the various action_names/statuses for a given statement period. We would not want to expose `apply_pending_adjustments`, `mark_adjustments_applied`, etc. statuses to the Customer Accounting user, just to Abacus/A360 (employees/internal) users.
- QUESTION: Why not use `view_abacus_account_info` action?
    - `account_payee` is a parent_table_name. Currently, we use the `account` resource type for these concepts in conjunction with the `view_abacus_account_info` action.
        - We can’t re-use `view_abacus_account_info` because account_payee state is exposed to TAP (Documents) (client/external) users, AND Abacus/A360 (employees/internal) users. We don’t want to show too authorize other abacus account info bits just to show account payee.
- QUESTION: Why can’t we use a generic `view_abacus_state` action?
    - `account_payee` is a parent_table_name. `contract` is a parent_table_name. Currently, we use the `account` resource type for these concepts in conjunction with the `view_abacus_account_info` action. If we use the same action to check authorization, `contract` state is also exposed to folks who should get to view account_payee’s state.
- QUESTION: Why can’t we use a different resource type for `account_payee` and `contract` .. Couldn’t we use `view_abacus_state` action then?
    - Yes. We totally could. But then I’d have to go back and update all the ows-abacus-account and ows-abacus-contract endpoints to be standardized for the account_payee and contract resource types instead of using `account` resource type with the `view_abacus_account_info` action.

[abacus-state](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/abacus-state%201fa97177520f8105b03dea326529d7e9.csv)

[ows-abacus-state](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-abacus-state%2019897177520f806aa0f2c1f5a52fda5d.csv)

Ok the dataloader endpoint is wild…

```jsx
curl --location 'http://localhost:5000/abacus-state/dataloader' \
--header 'Content-Type: application/json' \
--data '[1, 35, 195, 424, 210915]'
```

yields:

```
{
    "items": [
        {
            "data": null
        },
        {
            "data": {
                "abacus_state_id": 35,
                "parent_table_id": 5,
                "parent_table_name": "account_payee",
                "action_name": "tax_eligibility",
                "action_status": "complete",
                "message": "Details:\ncountryOfTaxResidence: OK - Collected.\nvat: OK - Collected.\nwForm: OK - Not required.",
                "created_by": "d5ca8ac3-7e51-4793-8775-50d11282504c",
                "created_at": "2022-03-15T15:52:34.000000",
                "last_modified_by": "68e1ee6b-b0e8-4e3d-95eb-1bec63a7d3d4",
                "last_modified": "2025-05-16T09:27:25.000000"
            }
        },
        {
            "data": {
                "abacus_state_id": 195,
                "parent_table_id": 500051,
                "parent_table_name": "contract",
                "action_name": "legacy_sync",
                "action_status": "complete",
                "message": null,
                "created_by": "d5ca8ac3-7e51-4793-8775-50d11282504c",
                "created_at": "2022-08-02T13:42:08.000000",
                "last_modified_by": "default_user_id",
                "last_modified": "2022-08-02T13:42:22.000000"
            }
        },
        {
            "data": {
                "abacus_state_id": 424,
                "parent_table_id": 283,
                "parent_table_name": "statement_period",
                "action_name": "statement_period_close",
                "action_status": "complete",
                "message": "autoclose",
                "created_by": "default_user_id",
                "created_at": "2022-08-10T21:32:48.000000",
                "last_modified_by": "f0730ba4-e995-451f-8fba-a883d53660a2",
                "last_modified": "2022-09-21T14:27:18.000000"
            }
        },
        {
            "data": {
                "abacus_state_id": 210915,
                "parent_table_id": 2,
                "parent_table_name": "accounting_period",
                "action_name": "take_reserves",
                "action_status": "complete",
                "message": null,
                "created_by": "ee916c6a-270b-4f38-b2a5-1e4c19856389",
                "created_at": "2022-10-24T19:45:45.000000",
                "last_modified_by": "ee916c6a-270b-4f38-b2a5-1e4c19856389",
                "last_modified": "2022-10-24T19:45:45.000000"
            }
        }
    ]
}
```

This means that we actually need to check multiple resource types/actions at once… see elaboration here: https://github.com/theorchard/ows-abacus-state/pull/164/files#r2110317507

## ows-ledger ✅

[ows-ledger](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-ledger%2019997177520f8006968ee91334366de9.csv)

## ows-payment ✅

[ows-payment](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-payment%2019997177520f801794e8f4234ab32f8b.csv)

## ows-abacus-schedule ✅

[ows-abacus-schedule](%E2%9C%85%20Account360Profile%20endpoints%20and%20queries%20with%20PP%20%2019897177520f80e8b27dd9191d1ed54c/ows-abacus-schedule%201f997177520f80ecb338f92f31fe5f7f.csv)

# graphql queries

## graphql-abacus

- [abacusContract](https://github.com/theorchard/frontend-royalties/blob/9f8f1d9eef01ac7e8ce51f4cb12ba10497d060c6/src/apollo/queries/contract/get-contract.gql#L2)
- [abacusContracts](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/contract/get-contracts-list.gql#L9)
- [abacusContractParties](https://github.com/theorchard/frontend-royalties/blob/9f8f1d9eef01ac7e8ce51f4cb12ba10497d060c6/src/apollo/queries/contract-party/get-contract-party-list.gql#L8)
- [abacusContractAdvancesPending](https://github.com/theorchard/frontend-royalties/blob/9f8f1d9eef01ac7e8ce51f4cb12ba10497d060c6/src/apollo/queries/contract-advance/get-contract-advances-pending-list.gql#L2)
- [abacusContract.contractAdvances](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/contract-advance/get-contract-advances-by-status.gql#L9)
- [abacusContractAdvancesPaid](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/contract-advance/get-contract-advances-paid-list.gql#L2)
- [abacusAccount](https://github.com/theorchard/frontend-royalties/blob/9f8f1d9eef01ac7e8ce51f4cb12ba10497d060c6/src/apollo/queries/account/get-account-full-detail.gql#L2)
- [abacusLedgerAccountContractList](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/ledger/get-ledger-account-contract-list.gql#L7)
- [abacusAccountLedgerList](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/account/account-ledger-list.gql#L2)

## graphql-distriubtion

- [deliveryStoresV2](https://github.com/theorchard/frontend-royalties/blob/master/src/apollo/queries/stores.gql)