def authorize(self): """Authorize all the transactions associated with the payment. """ PaymentTransaction = Pool().get('payment_gateway.transaction') PaymentTransaction.authorize( filter(lambda txn: txn.state == 'draft', self.payment_transactions))
def authorize(self): """Authorize all the transactions associated with the payment. """ PaymentTransaction = Pool().get('payment_gateway.transaction') PaymentTransaction.authorize( filter( lambda txn: txn.state == 'draft', self.payment_transactions ) )
def process(cls, sale, payment_method_id): """Begins the payment processing. Returns a response object if a redirect to third party website is required, else processes the payment. :param sale: Browse Record of the Sale :param payment_method_id: ID of payment method """ Sale = Pool().get('sale.sale') try_to_authorize = ( request.nereid_website.payment_mode == 'auth_if_available') payment_method = cls(payment_method_id) allowed_gateways = cls._get_available_gateways( sale.invoice_address.country) if payment_method not in allowed_gateways: current_app.logger.error("Payment method %s is not valid" % payment_method.name) abort(403) payment_method_obj = Pool().get(payment_method.model.model) Sale.write([sale], {'payment_method': payment_method.id}) if try_to_authorize and hasattr(payment_method_obj, 'authorize'): return payment_method_obj.authorize(sale) else: return payment_method_obj.capture(sale)
def authorize(self): """Authorize all the transactions associated with the payment. """ PaymentTransaction = Pool().get('payment_gateway.transaction') PaymentTransaction.authorize(self.payment_transactions)