Ejemplo n.º 1
0
    def testGetPriceGross(self):
        """
        """
        p = IPrices(self.item1)
        self.assertEqual(p.getPriceGross(), 44.0)

        p = IPrices(self.item2)
        self.assertEqual(p.getPriceGross(), 57.0)
Ejemplo n.º 2
0
    def testGetPriceGross(self):
        """
        """
        p = IPrices(self.item1)
        self.assertEqual(p.getPriceGross(), 44.0)

        p = IPrices(self.item2)
        self.assertEqual(p.getPriceGross(), 57.0)
Ejemplo n.º 3
0
    def process(self, order=None):
        """
        """    
        shop = IShopManagement(self.context).getShop()
        callback_url = "%s/nochex?order=%s" % (shop.absolute_url(), order.UID())
        success_url  = "%s/thank-you" % shop.absolute_url()
        
        pc = IPrices(order)
        price_gross = "%.2f" % pc.getPriceGross()
        
        info = {
            "merchant_id" : NOCHEX_ID,
            "amount" : price_gross,
            "order_id": order.getId(),
            "success_url" : success_url,
            "callback_url" : callback_url,
        }

        # redirect to paypal    
        parameters = "&".join(["%s=%s" % (k, v) for (k, v) in info.items()])                
        
        url = NOCHEX_URL + "?" + parameters
        self.context.REQUEST.RESPONSE.redirect(url)
        
        return PaymentResult(NOT_PAYED)
Ejemplo n.º 4
0
    def process(self, order=None):
        """
        """
        shop = IShopManagement(self.context).getShop()
        callback_url = "%s/nochex?order=%s" % (shop.absolute_url(),
                                               order.UID())
        success_url = "%s/thank-you" % shop.absolute_url()

        pc = IPrices(order)
        price_gross = "%.2f" % pc.getPriceGross()

        info = {
            "merchant_id": NOCHEX_ID,
            "amount": price_gross,
            "order_id": order.getId(),
            "success_url": success_url,
            "callback_url": callback_url,
        }

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

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

        return PaymentResult(NOT_PAYED)
Ejemplo n.º 5
0
    def process(self, order):
        """
        """
        info = dict()

        pc = IPrices(order)

        customer = order.getCustomer()

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

        info = {
            "cmd" : "_cart",
            "upload" : "1",
            "business" : "*****@*****.**",
            "currency_code" : "EUR",
            "notify_url" : "",
            "return" : "",
            "last_name" : shipping_address.getName(),
            "address1" : shipping_address.address_1,
            "city" : shipping_address.city,
            "state" : shipping_address.country_title(),
            "zip" : shipping_address.zip_code,
            "shipping_1" : order.getShippingPriceNet(),
            "tax_1" : pc.getPriceGross() - pc.getPriceNet()
        }

        im = IItemManagement(order)
        for i, item in enumerate(im.getItems()):
            j = i + 1
            name     = "item_name_%s" % j
            quantity = "quantity_%s" % j
            amount   = "amount_%s" % j

            product = item.getProduct()

            info[name]     = product.Title()
            info[quantity] = str(int(item.getProductQuantity()))
            info[amount]   = str(item.getProductPriceGross())

        # 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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
 def testGetPriceGross(self):
     """
     """
     p = IPrices(self.shop.products.product_1)
     self.assertEqual(p.getPriceGross(), 22.0)
 def testGetPriceGross(self):
     """
     """
     p = IPrices(self.shop.products.product_1)
     self.assertEqual(p.getPriceGross(), 22.0)
Ejemplo n.º 9
0
 def testGetPriceGross(self):
     """
     """
     pp = IPrices(self.item1)
     self.assertEqual(pp.getPriceGross(), 4536.0)
Ejemplo n.º 10
0
 def testGetPriceGross(self):
     """
     """
     pp = IPrices(self.item1)
     self.assertEqual(pp.getPriceGross(), 4536.0)
Ejemplo n.º 11
0
 def testGetPriceGross(self):
     """
     """
     p = IPrices(self.order)
     self.assertEqual("%.2f" % p.getPriceGross(), "151.00")
Ejemplo n.º 12
0
 def testGetPriceGross(self):
     """
     """
     p = IPrices(self.cart)
     self.assertEqual(p.getPriceGross(), 211.00)