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)
def process(self, order=None): """ """ if self.context.getPayed() == True: code = PAYED else: code = NOT_PAYED return PaymentResult(code, "")
def process(self, order=None): """ """ shop = IShopManagement(self.context).getShop() customer = ICustomerManagement(shop).getAuthenticatedCustomer() credit_card = IPaymentInformationManagement(customer).getSelectedPaymentInformation() card_num = credit_card.card_number exp_date = "%s/%s" % (credit_card.card_expiration_date_month, credit_card.card_expiration_date_year) line_items = [] for i, item in enumerate(IItemManagement(order).getItems()): if item.getProductTax() > 0: tax = "Y" else: tax = "N" line_items.append(( str(i+1), item.getProduct().Title(), str(item.getProductQuantity()), str(item.getProductPriceGross()), tax, )) amount = "%.2f" % IPrices(order).getPriceForCustomer() cc = EasyShopCcProcessor( server="test.authorize.net", login="******", key="9ME22bvLnu87P4FY") # Used for authorizeAndCapture result = cc.authorizeAndCapture( amount = amount, card_num = card_num, exp_date = exp_date) if result.response == "approved": return PaymentResult(PAYED, _(u"Your order has been payed.")) else: return PaymentResult(ERROR, _(result.response_reason))
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)
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)
def process(self, order=None): """ """ return PaymentResult(NOT_PAYED, "")
def process(self, order=None): """ """ context = aq_inner(self.context) shop = IShopManagement(context).getShop() customer = ICustomerManagement(shop).getAuthenticatedCustomer() line_items = [] for i, item in enumerate(IItemManagement(order).getItems()): if item.getProductTax() > 0: tax = "Y" else: tax = "N" line_items.append(( str(i+1), item.getProduct().Title(), str(item.getProductQuantity()), str(item.getProductPriceGross()), tax, )) amount = "%.2f" % IPrices(order).getPriceForCustomer() mpay24_url = context.getUrl() mpay24_merchant_id = context.getMerchant_id() mpay24_mdxi = context.getMdxi() conn_query = "OPERATION=SELECTPAYMENT&MERCHANTID=%s&MDXI=%s" % \ (mpay24_merchant_id, quote(mpay24_mdxi % dict(tid=order.id, price=amount, site_url=shop.absolute_url())),) conn_string = "%s?%s" % (mpay24_url, conn_query) h = httplib2.Http('.cache',timeout=10) try: http_response, data = h.request(conn_string,"GET",) except: return PaymentResult(ERROR,_('MPAY24 connection timeout')) if data: data_dict = dict([part.split('=') for part in data.split('&')]) if data_dict.get('STATUS','')=='ERROR': return PaymentResult(ERROR,"%s\n%s" % \ (unquote(data_dict.get('RETURNCODE','')), unquote(conn_string))) elif data_dict.get('RETURNCODE','')=='REDIRECT': new_loc = data_dict.get('LOCATION','').strip() # save redirection URL in cookie for later usage context.REQUEST.RESPONSE.setCookie( REDIR_COOKIE_NAME, quote(encodestring(new_loc)), path='/', ) return PaymentResult('SUCCESS', '') else: return PaymentResult(ERROR, data_dict) return PaymentResult(ERROR,_("no data"))