예제 #1
0
 def payment_text(self, payment):
     settings = get_shop_payment_settings()
     portal_state = self.context.restrictedTraverse('@@plone_portal_state')
     lang = portal_state.language()
     for entry in settings.payment_text:
         if entry['lang'] == lang and entry['payment'] == payment:
             return entry['text']
     return u''
예제 #2
0
 def payment_text(self, payment):
     settings = get_shop_payment_settings()
     portal_state = self.context.restrictedTraverse('@@plone_portal_state')
     lang = portal_state.language()
     for entry in settings.payment_text:
         if entry['lang'] == lang and entry['payment'] == payment:
             return entry['text']
     return u''
예제 #3
0
 def payment_text(self, payment):
     settings = get_shop_payment_settings()
     portal_state = self.context.restrictedTraverse("@@plone_portal_state")
     lang = portal_state.language()
     for entry in settings.payment_text:
         if entry["lang"] == lang and entry["payment"] == payment:
             return entry["text"]
     return u""
예제 #4
0
 def surcharge_vat(self, working_total):
     try:
         settings = get_shop_payment_settings()
     except KeyError:
         # happens GS profile application if registry entries not present
         # yet
         return Decimal('0')
     surcharge_net = self.surcharge_net(working_total)
     vat_percentage = (Decimal(str((settings.surcharge_vat))) if
                       settings.surcharge_vat else Decimal('0'))
     return (surcharge_net / Decimal(100)) * vat_percentage
예제 #5
0
 def percent_surcharge(self):
     try:
         settings = get_shop_payment_settings()
     except KeyError:
         # happens GS profile application if registry entries not present
         # yet
         return Decimal('0')
     surcharge = settings.percent_surcharge
     if surcharge:
         return format_amount(Decimal(str(surcharge)))
     else:
         return ''
예제 #6
0
 def surcharge_net(self, working_total):
     try:
         settings = get_shop_payment_settings()
     except KeyError:
         # happens GS profile application if registry entries not present
         # yet
         return Decimal('0')
     fixed = (Decimal(str(settings.fixed_surcharge)) if
              settings.fixed_surcharge else Decimal('0'))
     percent = (Decimal(str(settings.percent_surcharge)) if
                settings.percent_surcharge else Decimal('0'))
     return (working_total * percent) / Decimal('100') + fixed
예제 #7
0
 def skip_payment(self, uid):
     settings = get_shop_payment_settings()
     order_data = OrderData(self.context, uid=uid)
     # order total is 0, skip
     if not Decimal(str(order_data.total)).quantize(Decimal("1.000")):
         return True
     # if payment should be skipped if order contains reservations and
     # order contains reservations, skip
     if settings.skip_payment_if_order_contains_reservations:
         if order_data.state in (STATE_RESERVED, STATE_MIXED):
             return True
     return False
예제 #8
0
 def skip_payment(self, uid):
     settings = get_shop_payment_settings()
     order_data = OrderData(self.context, uid=uid)
     # order total is 0, skip
     if not Decimal(str(order_data.total)).quantize(Decimal('1.000')):
         return True
     # if payment should be skipped if order contains reservations and
     # order contains reservations, skip
     if settings.skip_payment_if_order_contains_reservations:
         if order_data.state in (STATE_RESERVED, STATE_MIXED):
             return True
     return False
예제 #9
0
 def costs(self):
     try:
         settings = get_shop_payment_settings()
     except KeyError:
         # happens GS profile application if registry entries not present
         # yet
         return Decimal('0')
     costs = settings.cash_on_delivery_costs
     if costs:
         costs = Decimal(str(costs))
     else:
         costs = Decimal('0')
     return format_amount(costs)
예제 #10
0
 def costs(self):
     try:
         settings = get_shop_payment_settings()
     except KeyError:
         # happens GS profile application if registry entries not present
         # yet
         return Decimal('0')
     costs = settings.cash_on_delivery_costs
     if costs:
         costs = Decimal(str(costs))
     else:
         costs = Decimal('0')
     return format_amount(costs)
예제 #11
0
 def payment_method_surchargeable(self):
     settings = get_shop_payment_settings()
     return settings.surchargeable_payment_methods
예제 #12
0
 def default(self):
     settings = get_shop_payment_settings()
     return settings.payment_method
예제 #13
0
 def available(self):
     settings = get_shop_payment_settings()
     return settings.available_payment_methods
예제 #14
0
 def default(self):
     settings = get_shop_payment_settings()
     return settings.payment_method
예제 #15
0
 def available(self):
     settings = get_shop_payment_settings()
     return settings.available_payment_methods