Пример #1
0
    def process(self, order=None):
        """
        """
        info = dict()

        shop = IShopManagement(self.context).getShop()
        notify_url = "%s/paypal?order=%s" % (shop.absolute_url(), order.UID())
        return_url = "%s/thank-you" % shop.absolute_url()

        pc = IPrices(order)
        price_net = "%.2f" % pc.getPriceNet()
        tax = "%.2f" % (pc.getPriceGross() - float(price_net))

        customer = order.getCustomer()
        am = IAddressManagement(customer)
        invoice_address  = am.getInvoiceAddress()
        shipping_address = am.getShippingAddress()

        site_encoding = self.context.plone_utils.getSiteEncoding()

        info = {
            "cmd" : "_xclick",
            "upload" : "1",
            "business" : shop.getPayPalId(),
            "currency_code" : "EUR",
            "notify_url" : notify_url,
            "return" : return_url,
            "first_name" : invoice_address.firstname.encode(site_encoding),
            "last_name" : invoice_address.lastname.encode(site_encoding),
            "address1" : invoice_address.address_1.encode(site_encoding),
            "address2" : "",
            "city" : invoice_address.city.encode(site_encoding),
            "state" : invoice_address.country_title().encode(site_encoding),
            "zip" : invoice_address.zip_code.encode(site_encoding),
            "no_shipping" : "1",
            "item_name" : shop.getShopOwner(),
            "amount" : price_net,
            "tax" : tax,
        }

        # redirect to paypal
        parameters = "&".join(["%s=%s" % (k, v) for (k, v) in info.items()])

        url = PAYPAL_URL + "?" + parameters
        self.context.REQUEST.RESPONSE.redirect(url)

        return PaymentResult(NOT_PAYED)
Пример #2
0
 def getInformation(self):
     """Returns information for information page which is given by request.
     """
     page_id = self.request.get("page_id")    
     page = self.context.information.get(page_id)
     if page is None:
         return None
         
     shop = IShopManagement(self.context).getShop()
 
     return {
         "shop_owner"  : shop.getShopOwner(),
         "url"         : "%s/at_download/file" % page.absolute_url(),
         "title"       : page.Title(),
         "description" : page.Description(),
         "text"        : page.getText(),
     }
Пример #3
0
    def getInformation(self):
        """Returns information for information page which is given by request.
        """
        page_id = self.request.get("page_id")
        page = self.context.information.get(page_id)
        if page is None:
            return None

        shop = IShopManagement(self.context).getShop()

        return {
            "shop_owner": shop.getShopOwner(),
            "url": "%s/at_download/file" % page.absolute_url(),
            "title": page.Title(),
            "description": page.Description(),
            "text": page.getText(),
        }