Api reference
components.shop.public.commands ¶
backfill_shop_visits ¶
backfill_shop_visits ¶
Backfill shop visits from Segment.
Source code in components/shop/public/commands/backfill_shop_visits.py
global_invoicing ¶
process_contact_lens_invoicing ¶
Process the contact lens invoicing for a given period.
Source code in components/shop/public/commands/global_invoicing.py
supplier_action ¶
daily_routine ¶
Source code in components/shop/public/commands/supplier_action.py
fulfill_orders ¶
Source code in components/shop/public/commands/supplier_action.py
run_supplier_action ¶
Source code in components/shop/public/commands/supplier_action.py
sync_delivery_status ¶
Source code in components/shop/public/commands/supplier_action.py
synchronize_catalog ¶
Source code in components/shop/public/commands/supplier_action.py
synchronize_stocks ¶
Source code in components/shop/public/commands/supplier_action.py
update_draft_orders ¶
Source code in components/shop/public/commands/supplier_action.py
update_orders_by_numbers ¶
Source code in components/shop/public/commands/supplier_action.py
update_recent_orders ¶
Source code in components/shop/public/commands/supplier_action.py
update_trackings ¶
Source code in components/shop/public/commands/supplier_action.py
sync_product_recommendations ¶
sync_product_recommendations ¶
Synchronize product recommendations on Saleor.
Source code in components/shop/public/commands/sync_product_recommendations.py
sync_saleor_channels ¶
sync_saleor_channels ¶
Synchronize two Saleor channels
Source code in components/shop/public/commands/sync_saleor_channels.py
components.shop.public.controllers ¶
admin_cancellation_mail ¶
admin_order ¶
admin_testimonial ¶
eligibility ¶
intercom ¶
CreateConversationForFulfillmentPostJsonSchema ¶
Bases: Schema
Schema for POST /create_conversation_for_fulfillment.
fulfillment_id
class-attribute
instance-attribute
¶
fulfillment_id = Str(
required=True,
validate=OwnerController(NoOwner),
metadata={"description": "The ID of the fulfillment"},
)
intercom_space
class-attribute
instance-attribute
¶
intercom_space = Enum(
IntercomSpace,
by_value=True,
required=True,
validate=OwnerController(NoOwner),
metadata={
"description": "The Intercom space to use (shop or care)"
},
)
operator_full_name
class-attribute
instance-attribute
¶
operator_full_name = Str(
required=True,
validate=OwnerController(NoOwner),
metadata={
"description": "The full name of Saleor connected user"
},
)
order_id
class-attribute
instance-attribute
¶
order_id = Str(
required=True,
validate=OwnerController(NoOwner),
metadata={"description": "The ID of the order"},
)
template_id
class-attribute
instance-attribute
¶
template_id = Str(
required=True,
validate=OwnerController(NoOwner),
metadata={"description": "The ID of the template"},
)
IntercomController ¶
Bases: BaseController
invoicing ¶
saleor_admin_token ¶
saleor_checkout ¶
saleor_manifest ¶
FULFILLMENT_EVENTS_SUBSCRIPTION_QUERY
module-attribute
¶
FULFILLMENT_EVENTS_SUBSCRIPTION_QUERY = "subscription {\n event {\n ... on FulfillmentApproved {\n __typename\n order {\n id\n }\n fulfillment {\n id\n }\n }\n ... on FulfillmentCanceled {\n __typename\n order {\n id\n }\n fulfillment {\n id\n }\n }\n }\n}\n"
ORDER_EVENTS_SUBSCRIPTION_QUERY
module-attribute
¶
ORDER_EVENTS_SUBSCRIPTION_QUERY = "subscription {\n event {\n ... on OrderCancelled {\n __typename\n order {\n id\n }\n }\n ... on OrderConfirmed {\n __typename\n order {\n id\n }\n }\n ... on OrderCreated {\n __typename\n order {\n id\n }\n }\n ... on OrderFulfilled {\n __typename\n order {\n id\n }\n }\n ... on OrderUpdated {\n __typename\n order {\n id\n }\n }\n ... on OrderRefunded {\n __typename\n order {\n id\n }\n }\n ... on OrderPaid {\n __typename\n order {\n id\n }\n }\n ... on OrderMetadataUpdated {\n __typename\n order {\n id\n }\n }\n ... on OrderFullyRefunded {\n __typename\n order {\n id\n }\n }\n ... on OrderFullyPaid {\n __typename\n order {\n id\n }\n }\n ... on OrderExpired {\n __typename\n order {\n id\n }\n }\n }\n}\n"
PAYMENT_EVENTS_SUBSCRIPTION_QUERY
module-attribute
¶
PAYMENT_EVENTS_SUBSCRIPTION_QUERY = "subscription {\n event {\n ... on TransactionInitializeSession {\n __typename\n transaction {\n ...SaleorTransactionItem\n }\n action {\n ...SaleorTransactionProcessAction\n }\n sourceObject {\n __typename\n ...SaleorOrder\n ...SaleorCheckout\n }\n }\n ... on TransactionProcessSession {\n __typename\n transaction {\n ...SaleorTransactionItem\n }\n action {\n ...SaleorTransactionProcessAction\n }\n }\n }\n}\n\nfragment SaleorTransactionItem on TransactionItem {\n id\n pspReference\n}\n\nfragment SaleorTransactionProcessAction on TransactionProcessAction {\n actionType\n amount\n currency\n}\n\nfragment SaleorOrder on Order {\n id\n}\n\nfragment SaleorCheckout on Checkout {\n id\n}\n"
PERMISSIONS
module-attribute
¶
PERMISSIONS = [
"HANDLE_CHECKOUTS",
"HANDLE_PAYMENTS",
"HANDLE_TAXES",
"IMPERSONATE_USER",
"MANAGE_APPS",
"MANAGE_CHANNELS",
"MANAGE_CHECKOUTS",
"MANAGE_DISCOUNTS",
"MANAGE_GIFT_CARD",
"MANAGE_MENUS",
"MANAGE_OBSERVABILITY",
"MANAGE_ORDERS",
"MANAGE_ORDERS_IMPORT",
"MANAGE_PAGES",
"MANAGE_PAGE_TYPES_AND_ATTRIBUTES",
"MANAGE_PLUGINS",
"MANAGE_PRODUCTS",
"MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES",
"MANAGE_SETTINGS",
"MANAGE_SHIPPING",
"MANAGE_STAFF",
"MANAGE_TAXES",
"MANAGE_TRANSLATIONS",
"MANAGE_USERS",
]
SaleorManifestController ¶
Bases: BaseController
TRANSACTION_EVENTS_SUBSCRIPTION_QUERY
module-attribute
¶
TRANSACTION_EVENTS_SUBSCRIPTION_QUERY = "subscription {\n event {\n ... on TransactionCancelationRequested {\n __typename\n transaction {\n ...SaleorTransactionItem\n }\n action {\n ...SaleorTransactionAction\n }\n }\n ... on TransactionChargeRequested {\n __typename\n transaction {\n ...SaleorTransactionItem\n }\n action {\n ...SaleorTransactionAction\n }\n }\n ... on TransactionRefundRequested {\n __typename\n transaction {\n ...SaleorTransactionItem\n }\n action {\n ...SaleorTransactionAction\n }\n }\n }\n}\n\nfragment SaleorTransactionItem on TransactionItem {\n id\n pspReference\n}\n\nfragment SaleorTransactionAction on TransactionAction {\n actionType\n amount\n currency\n}\n"
saleor_register ¶
saleor_webhook ¶
SaleorFulfillmentEventsPostJsonSchema ¶
SaleorOrderEventsPostJsonSchema ¶
Bases: _SaleorWebhookBaseSchema
order
class-attribute
instance-attribute
¶
SaleorPaymentEventsPostJsonSchema ¶
Bases: _SaleorWebhookBaseSchema
SaleorTransactionEventsPostJsonSchema ¶
SaleorWebhookController ¶
Bases: BaseController
saleor_webhooks_config ¶
shop_user ¶
shopify_order ¶
stripe_webhook ¶
components.shop.public.enums ¶
ContactLensAddition ¶
ContactLensItemType ¶
ContactLensND ¶
ContactLensProductType ¶
Bases: AlanBaseEnum
This enum is used to store the product type of a contact lens.
contact_lens_bi_monthly
class-attribute
instance-attribute
¶
contact_lens_bifocal
class-attribute
instance-attribute
¶
contact_lens_colored
class-attribute
instance-attribute
¶
contact_lens_extended_wear
class-attribute
instance-attribute
¶
contact_lens_for_sport
class-attribute
instance-attribute
¶
contact_lens_monthly
class-attribute
instance-attribute
¶
contact_lens_multifocal
class-attribute
instance-attribute
¶
contact_lens_progressive
class-attribute
instance-attribute
¶
contact_lens_spherical
class-attribute
instance-attribute
¶
ContactLensSolutionType ¶
Bases: AlanBaseEnum
This enum is used to store the solution type of a contact lens.
solution_travel_kit
class-attribute
instance-attribute
¶
ContactLensStatus ¶
Bases: AlanBaseEnum
This enum is used to store the status of a contact lens.
InvoicingDocumentType ¶
Bases: AlanBaseEnum
This enum is used to store the type of invoice generation.
PrescriptionCheckProblemSeverity ¶
PrescriptionCheckProblemType ¶
Bases: AlanBaseEnum
This enum is used to store the type of a prescription check problem.
TransactionType ¶
UsageSource ¶
UsageStatus ¶
UsageType ¶
components.shop.public.events ¶
ShopTestimonialPublished
dataclass
¶
ShopTestimonialPublished(
testimonial,
rating,
product_id,
user_name,
app_user_id,
app_id,
external_order_id,
)
Bases: WebhookMessage
Event triggered when a ShopTestimonial has been published.
components.shop.public.flask_admin_configuration ¶
components.shop.public.globalization ¶
base_prescription_checker ¶
BasePrescriptionChecker ¶
Bases: ABC
Base class for prescription checkers, providing methods to implement the prescription checking logic.
Source code in components/shop/public/globalization/base_prescription_checker.py
check_contact_lens_prescription_content
abstractmethod
¶
check_contact_lens_prescription_content(
beneficiary_user_id,
content,
contact_lens_items,
order_date=None,
)
Check the contact lenses prescription content.
Source code in components/shop/public/globalization/base_prescription_checker.py
check_glasses_prescription_content
abstractmethod
¶
Check the glasses prescription content.
Source code in components/shop/public/globalization/base_prescription_checker.py
check_saleor_contact_lens_checkout_prescription_content
abstractmethod
¶
Check the SaleorCheckout contact lens prescription.
Source code in components/shop/public/globalization/base_prescription_checker.py
check_saleor_contact_lens_fulfillment_prescription
abstractmethod
¶
Check the SaleorOrder prescription.
Source code in components/shop/public/globalization/base_prescription_checker.py
check_saleor_glasses_checkout_prescription_content
abstractmethod
¶
Check the SaleorCheckout glasses prescription.
Source code in components/shop/public/globalization/base_prescription_checker.py
document_content_is_of_type
abstractmethod
¶
Abstract method to check if the document content is of the given type.
extract_prescription_duration_in_years
abstractmethod
¶
Extract prescription duration in years from transcription.
Source code in components/shop/public/globalization/base_prescription_checker.py
retrieve_prescription_content
abstractmethod
¶
retrieve_prescription_content(
prescription_id,
compute_if_not_parsed_yet=False,
use_transcription=False,
automated_parsing_only=False,
)
Abstract method to retrieve the prescription content.
Source code in components/shop/public/globalization/base_prescription_checker.py
retrieve_prescription_transcription
abstractmethod
¶
Abstract method to retrieve the prescription transcription.
base_shop_adapter ¶
BaseShopAdapter ¶
Bases: ABC
Base class for shop adapters, providing methods to implement the Shop.
generate_contact_lens_global_invoice
abstractmethod
¶
Generate the invoice from Alan Tech to Alan Insurance for the contact lens claim transactions of a given period.
Source code in components/shop/public/globalization/base_shop_adapter.py
generate_credit_note
abstractmethod
¶
generate_order_invoice
abstractmethod
¶
generate_order_invoice(
order,
is_preview=False,
invoice_type=InvoicingDocumentType.regular_invoice,
)
Generate an invoice for an order.
Source code in components/shop/public/globalization/base_shop_adapter.py
get_contact_lens_global_invoice_url
abstractmethod
¶
get_coverage_usage_for_user
abstractmethod
¶
Return the remaining usage for a user.
get_glasses_coverage_definition
abstractmethod
¶
Return glasses coverage definition, abstracted from country-specific guarantee codes.
get_marmot_profile_url
abstractmethod
¶
get_order_invoice_url
abstractmethod
¶
Get the URL of the order invoice.
get_pending_claim_usages_for_user
abstractmethod
¶
Return the uninvoiced orders for a user.
return SaleorHelper().get_pending_claim_usages_for_user( app_id=AppName.ALAN_FR, user_id=user_id, usage_type=usage_type, )
Source code in components/shop/public/globalization/base_shop_adapter.py
get_prescription_checker
abstractmethod
¶
is_prescription_locked_for_invoicing
abstractmethod
¶
Return True if the prescription is linked to a pending order not yet invoiced.
return SaleorHelper().is_prescription_locked_for_invoicing( app_id=AppName.ALAN_FR, prescription_id=prescription_id, )
Source code in components/shop/public/globalization/base_shop_adapter.py
resolve_user_name_from_insurance_profile_id
abstractmethod
¶
Resolve a user's full name from their insurance profile ID.
tombstone_insurance_document
abstractmethod
¶
Tombstone (soft delete) an insurance document.
upload_invoicing_document
abstractmethod
¶
Upload invoicing document.
upload_order_invoice
abstractmethod
¶
Upload order invoice and create the corresponding care acts.
shop_adapter ¶
get_app_specific_shop_adapter ¶
Return an app-specific shop adapter based on the app ID or raise an error if not found.
Source code in components/shop/public/globalization/shop_adapter.py
get_app_specific_shop_adapter_or_none ¶
Return an app-specific shop adapter based on the app ID.
Source code in components/shop/public/globalization/shop_adapter.py
components.shop.public.services ¶
discounts ¶
create_shop_discount ¶
Create a discount to be used in the shop During the transition period, we create both a shopify discount code and a saleor voucher So the member will be able to find the discount in both places
Source code in components/shop/public/services/discounts.py
get_processed_orders_with_discounts ¶
Get orders with discounts processed after date from shopify