Пример #1
0
class RegistrationReceived(Event):
    identifier = "registration_received"
    name = _("Registration Received")
    customer = Variable(_("Customer"), type=Model("shuup.Contact"))
    customer_email = Variable(_("Customer Email"), type=Email)
    activation_url = Variable(_("Activation URL"), type=URL, required=False)
    user_is_active = Variable(_("Is User Active"), type=Boolean)
class ATestEvent(Event):
    identifier = "test_event"
    log_target_variable = "order"

    order_language = Variable(name="Order Language", type=Language)
    just_some_text = Variable(name="Just Some Text", type=Text)
    order = Variable(name="Order", type=Model("shuup.Order"))
Пример #3
0
class AlertLimitReached(Event):
    cache_key_fmt = "stock_alert_%s_%s"

    identifier = "alert_limit_reached"
    name = _("Alert Limit Reached")

    supplier = Variable(_("Supplier"), type=Model("shuup.Supplier"))
    product = Variable(_("Product"), type=Model("shuup.Product"))
    dispatched_last_24hs = Variable(
        _("Fired in the last 24 hours?"),
        type=Boolean,
        help_text=_(
            "This will be True if this event was already dispatched "
            "in the last 24 hours for the same product and supplier. "
            "This is useful to prevent sending identical notifications in a short "
            "period of time."))

    def __init__(self, **variable_values):
        cache_key = self.cache_key_fmt % (variable_values["supplier"].pk,
                                          variable_values["product"].pk)
        last_dispatch_time = cache.get(cache_key)

        if last_dispatch_time:
            last_dispatch = int((time() - last_dispatch_time) / 60 / 60)
            variable_values["dispatched_last_24hs"] = (last_dispatch < 24)
        else:
            variable_values["dispatched_last_24hs"] = False

        super(AlertLimitReached, self).__init__(**variable_values)

    def run(self, shop):
        cache_key = self.cache_key_fmt % (self.variable_values["supplier"].pk,
                                          self.variable_values["product"].pk)
        cache.set(cache_key, time(), timeout=(60 * 60 * 24))
        super(AlertLimitReached, self).run(shop=shop)
Пример #4
0
class OrderReceived(Event):
    identifier = "order_received"
    name = _("Order Received")

    order = Variable(_("Order"), type=Model("shuup.Order"))
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)
Пример #5
0
class TaskCreated(Event):
    identifier = "task_created"
    name = _("Task Created")

    task = Variable(_("Task"), type=Text)
    type = Variable(_("Type"), type=Model("shuup_tasks.TaskType"))
    status = Variable(_("Status"), type=Enum(TaskStatus))
    priority = Variable(_("Priority"), type=Integer)
class RefundCreated(Event):
    identifier = "refund_created"
    name = _("Refund Created")

    order = Variable(_("Order"), type=Model("shuup.Order"))
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    payment_status = Variable(_("Order Payment Status"), type=Enum(PaymentStatus))
class VendorReviewCreated(Event):
    identifier = "vendor_review_created"
    name = _("Vendor Review Created")

    vendor_review = Variable(_("Vendor Review"),
                             type=Model("shuup_vendor_reviews.VendorReview"))

    reviewer_email = Variable(_("Customer Email"), type=Email)
    reviewer_phone = Variable(_("Customer Phone"), type=Phone)

    shop_email = Variable(_("Shop Email"), type=Email)
    shop_phone = Variable(_("Shop Phone"), type=Phone)
Пример #8
0
class OrderStatusChanged(Event):
    identifier = "order_status_changed"
    name = _("Order Status Changed")

    order = Variable(_("Order"), type=Model("shuup.Order"))
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    shop_email = Variable(_("Shop Email"), type=Email)
    shop_phone = Variable(_("Shop Phone"), type=Phone)
    old_status = Variable(_("Old Status"), type=Model("shuup.OrderStatus"))
    new_status = Variable(_("New Status"), type=Model("shuup.OrderStatus"))
    language = Variable(_("Language"), type=Language)
class ShipmentCreated(Event):
    identifier = "shipment_created"
    name = _("Shipment Created")

    order = Variable(_("Order"), type=Model("shuup.Order"))
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    shipment = Variable(_("Shipment"), type=Model("shuup.Shipment"))
    shipping_status = Variable(_("Order Shipping Status"), type=Enum(ShippingStatus))
    shipment_status = Variable(_("Shipment Status"), type=Enum(ShipmentStatus))
Пример #10
0
class ShipmentCreated(Event):
    identifier = "shipment_created"
    name = _("Shipment Created")

    order = Variable(_("Order"),
                     type=Model("shuup.Order"),
                     attributes=ORDER_ATTRIBUTES)
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    shipment = Variable(_("Shipment"), type=Model("shuup.Shipment"))
    shipping_status = Variable(_("Order Shipping Status"),
                               type=Enum(ShippingStatus))
    shipment_status = Variable(_("Shipment Status"), type=Enum(ShipmentStatus))
    shipment_tracking_code = Variable(_("Shipment Tracking Code"),
                                      type=Text,
                                      required=False)
    shipment_tracking_url = Variable(_("Shipment Tracking URL"),
                                     type=URL,
                                     required=False)
Пример #11
0
class OrderReceived(Event):
    identifier = "order_received"
    name = _("Order Received")

    order = Variable(_("Order"),
                     type=Model("shuup.Order"),
                     attributes=ORDER_ATTRIBUTES)
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    shop_email = Variable(_("Shop Email"), type=Email)
    shop_phone = Variable(_("Shop Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)
Пример #12
0
class PagSeguroPaymentStatusChanged(Event):
    identifier = "pagseguro_payment_status_changed"
    name = _("PagSeguro: Payment Status Changed")

    order = Variable(_("Order"), type=Model("shuup.Order"))
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    old_status = Variable(_("Old Status"),
                          type=Enum(PagSeguroTransactionStatus))
    new_status = Variable(_("New Status"),
                          type=Enum(PagSeguroTransactionStatus))
class ProductReviewCreated(Event):
    identifier = "product_review_created"
    name = _("Product Review Created")

    product_review = Variable(
        _("Product Review"), type=Model("shuup_product_reviews.ProductReview"))

    reviewer_email = Variable(_("Customer Email"), type=Email)
    reviewer_phone = Variable(_("Customer Phone"), type=Phone)

    shop_email = Variable(_("Shop Email"), type=Email)
    shop_phone = Variable(_("Shop Phone"), type=Phone)

    language = Variable(_("Language"), type=Language)
Пример #14
0
class PasswordReset(Event):
    identifier = "shuup_notify_password_reset"
    name = _("Password Reset")
    description = _("This event is triggered when password reset is requested.")

    site_name = Variable(_("Site name"), type=Text)
    uid = Variable(_("User secret"), type=Text)
    user_to_recover = Variable(_("User to recover"), type=Model(settings.AUTH_USER_MODEL))
    token = Variable(_("Token"), type=Text)
    recovery_url = Variable(_("Recovery URL"), type=Text)

    # Attribut name so email sending works with generic template
    # See: https://github.com/shuup/shuup/blob/master/shuup/notify/script_template/generic.py#L89
    customer_email = Variable(_("To Email"), type=Email)
Пример #15
0
class ShipmentDeleted(Event):
    identifier = "shipment_deleted"
    name = _("Shipment Deleted")

    order = Variable(_("Order"),
                     type=Model("shuup.Order"),
                     attributes=ORDER_ATTRIBUTES)
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    shipment = Variable(_("Shipment"), type=Model("shuup.Shipment"))
    shipping_status = Variable(_("Order Shipping Status"),
                               type=Enum(ShippingStatus))
Пример #16
0
class PaymentCreated(Event):
    identifier = "payment_created"
    name = _("Payment Created")

    order = Variable(_("Order"),
                     type=Model("shuup.Order"),
                     attributes=ORDER_ATTRIBUTES)
    customer_email = Variable(_("Customer Email"), type=Email)
    customer_phone = Variable(_("Customer Phone"), type=Phone)
    language = Variable(_("Language"), type=Language)

    payment_status = Variable(_("Order Payment Status"),
                              type=Enum(PaymentStatus))
    payment = Variable(_("Payment"), type=Model("shuup.Payment"))
Пример #17
0
class RegistrationReceived(Event):
    identifier = "registration_received"
    name = _("Registration Received")
    customer = Variable(_("Customer"), type=Model("shuup.Contact"))
    customer_email = Variable(_("Customer Email"), type=Email)
Пример #18
0
class RegistrationReceived(Event):
    identifier = "registration_received"
    name = _("Registration Received")

    customer_email = Variable(_("Customer Email"), type=Email)
Пример #19
0
class CompanyAccountCreated(Event):
    identifier = "company_account_created"

    contact = Variable("CompanyContact", type=Model("shuup.CompanyContact"))
    customer_email = Variable(_("Customer Email"), type=Email)
Пример #20
0
class AlertLimitReached(Event):
    identifier = "alert_limit_reached"
    name = _("Alert Limit Reached")

    supplier = Variable(_("Supplier"), type=Model("shuup.Supplier"))
    product = Variable(_("Product"), type=Model("shuup.Product"))