"""
Predefined SelectionSets for Billing entities (Account, PaymentRequest).
Based on the Billing GraphQL schema output types:
AccountDetail, AccountParamsDetail, AccountEntityDetail,
PaymentRequestDetail, PaymentRequestEntityDetail,
PaymentRequestEntityCharge, PaymentRequestEventDetail
"""
from ace.core.graphql import SelectionSet
[docs]
class AccountParamsSelections:
"""Reusable selection sets for AccountParamsDetail fields."""
STANDARD = SelectionSet(
"gatewayAccountParamsId",
"accountParamName",
"accountParamValue",
)
[docs]
class AccountEntitySelections:
"""Reusable selection sets for AccountEntityDetail fields."""
STANDARD = SelectionSet(
"entityId",
"entityTypeId",
"defaultDescription",
)
[docs]
class BillingAccountSelections:
"""Reusable selection sets for Billing Account fields."""
MINIMAL = SelectionSet(
"id",
)
STANDARD = SelectionSet(
"id",
"paymentGatewayId",
"defaultCurrencyId",
"statusId",
nested={
"payableEntities": AccountEntitySelections.STANDARD,
"gatewayAccountParams": AccountParamsSelections.STANDARD,
}
)
FULL = SelectionSet(
"id",
"paymentGatewayId",
"defaultCurrencyId",
"partyId",
"statusId",
"creationDateTimeUTC",
"creationUserId",
"lastUpdateDateTimeUTC",
"lastUpdateUserId",
"deletionDateTimeUTC",
"deletionUserId",
nested={
"payableEntities": AccountEntitySelections.STANDARD,
"gatewayAccountParams": AccountParamsSelections.STANDARD,
}
)
[docs]
class PaymentRequestEntitySelections:
"""Reusable selection sets for PaymentRequestEntityDetail fields."""
STANDARD = SelectionSet(
"entityId",
"entityType",
"totalAmount",
"description",
)
WITH_CHARGES = SelectionSet(
"entityId",
"entityType",
"totalAmount",
"description",
nested={
"charges": SelectionSet(
"entityId",
"entityType",
"amount",
"amountTypeGuid",
"amountTypeId",
"description",
),
}
)
[docs]
class PaymentRequestSelections:
"""Reusable selection sets for Payment Request fields."""
STANDARD = SelectionSet(
"id",
"accountId",
"currencyId",
"requestId",
"statusId",
"totalAmount",
"description",
nested={
"entities": PaymentRequestEntitySelections.STANDARD,
}
)
FULL = SelectionSet(
"id",
"accountId",
"currencyId",
"requestId",
"statusId",
"totalAmount",
"description",
"gatewayPaymentRequestId",
"paymentRequestDateTimeUTC",
"creationDateTimeUTC",
"creationUserId",
"changeStatusDateTimeUTC",
nested={
"entities": PaymentRequestEntitySelections.WITH_CHARGES,
}
)