Generates Bitpay Invoice and returns iframe view
177107
def pay_now
      order = current_order || raise(ActiveRecord::RecordNotFound)
      session[:order_number] = current_order.number
      invoice = order.place_bitpay_order notificationURL: bitpay_notification_url
      @invoice_iframe_url = "#{invoice['url']}&view=iframe"
      render json: @invoice_iframe_url
    end
1103692
def build_xml( id, price, options )
      xml = ::Builder::XmlMarkup.new
      xml.GenerateRequest do
        xml.PxPayUserId       ::Pxpay::Base.pxpay_user_id
        xml.PxPayKey          ::Pxpay::Base.pxpay_key
        xml.AmountInput       sprintf("%.2f", price)
        xml.TxnId             id
        xml.TxnType           options[:txn_type]            ? options[:txn_type].to_s.capitalize : "Purchase"
        xml.CurrencyInput     options[:currency_input]      || "NZD"
        xml.MerchantReference options[:merchant_reference]  || options[:reference]       || id.to_s ## Backwards compatibility
        xml.UrlSuccess        options[:url_success]         || ::Pxpay::Base.url_success 
        xml.UrlFail           options[:url_failure]         || ::Pxpay::Base.url_failure
        xml.EmailAddress      options[:email_address]       if options[:email_address]
        xml.TxnData1          options[:txn_data1]           if options[:txn_data1]
        xml.TxnData2          options[:txn_data2]           if options[:txn_data2]
        xml.TxnData3          options[:txn_data3]           if options[:txn_data3]
        xml.TxnData4          options[:txn_data4]           if options[:txn_data4]
        xml.Opt               options[:opt]                 if options[:opt]
        xml.EnableAddBillCard 1                             if options[:token_billing]
        xml.BillingId         options[:billing_id]          if options[:token_billing]
      end
    end
597836
def render_summary(self, include_title=True, request=None):
        """"""
        title = ''
        frames = []
        classes = ['traceback']
        if not self.frames:
            classes.append('noframe-traceback')

        if include_title:
            if self.is_syntax_error:
                title = text_('Syntax Error')
            else:
                title = text_('Traceback <small>(most recent call last)'
                              '</small>')

        for frame in self.frames:
            frames.append(
                text_('<li%s>%s') % (
                    frame.info and text_(' title="%s"' % escape(frame.info)) or
                    text_(''),
                    frame.render()
                ))

        if self.is_syntax_error:
            description_wrapper = text_('<pre class=syntaxerror>%s</pre>')
        else:
            description_wrapper = text_('<blockquote>%s</blockquote>')

        vars = {
            'classes': text_(' '.join(classes)),
            'title': title and text_('<h3 class="traceback">%s</h3>'
                                     % title) or text_(''),
            'frames': text_('\n'.join(frames)),
            'description': description_wrapper % escape(self.exception),
        }
        app = request.app
        template = app.ps.jinja2.env.get_template('debugtoolbar/exception_summary.html')
        return template.render(app=app, request=request, **vars)
1022419
def get_billing_items(self, identifier):
        

        mask = """mask[
            id, description, hostName, domainName, oneTimeAfterTaxAmount, recurringAfterTaxAmount, createDate,
            categoryCode,
            category[name],
            location[name],
            children[id, category[name], description, oneTimeAfterTaxAmount, recurringAfterTaxAmount]
        ]"""
        return self.client.call(
            'Billing_Invoice',
            'getInvoiceTopLevelItems',
            id=identifier,
            mask=mask,
            iter=True,
            limit=100
        )
47174
def capture(amount = nil)
      
      return { :error => "This invoice doesn't seem to be authorized." } if !self.success
      
      ct = InvoiceTransaction.where(:parent_id => self.id, :transaction_type => InvoiceTransaction::TYPE_CAPTURE, :success => true).first      
      return { :error => "Funds for this invoice have already been captured." } if ct
      
      # Make sure the amount given isn't greater than the invoice total      
      return { :error => "Amount given to capture is greater than the current invoice total." } if amount && amount.to_f > self.invoice.total.to_f        
      amount = self.invoice.total if amount.nil?      
            
      resp = Caboose::StdClass.new
      sc = self.invoice.site.store_config                
      case sc.pp_name
                                  
        when StoreConfig::PAYMENT_PROCESSOR_STRIPE
                                                                                    
          Stripe.api_key = sc.stripe_secret_key.strip
          bt = nil
          begin            
            c = Stripe::Charge.retrieve(self.transaction_id)            
            return { :error => "Amount given to capture is greater than the amount authorized. amount = #{amount}, c.amount = #{c.amount}" } if (amount*100).to_i > c.amount            
            amount = (amount.to_f * 100.0).to_i
            if amount == c.amount              
              c = c.capture
            else
              c = c.capture({ :amount => amount })
            end
            bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)
          rescue Exception => ex
            resp.error = "Error during capture process\n#{ex.message}"                
          end
          
          if resp.error.nil?
            InvoiceTransaction.create(
              :invoice_id => self.invoice_id,
              :parent_id => self.id,
              :transaction_id => bt.id,
              :transaction_type => InvoiceTransaction::TYPE_CAPTURE,
              :payment_processor => sc.pp_name,
              :amount => bt.amount / 100.0,                
              :date_processed => DateTime.strptime(bt.created.to_s, '%s'),
              :success => bt.status == 'succeeded' || bt.status == 'pending'
            )
            if bt.status == 'succeeded' || bt.status == 'pending'
              self.captured = true
              self.save              
              self.invoice.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED
              self.invoice.save
              resp.success = true
            else
              resp.error = "Error capturing funds."
            end
          end
          
      end
      return resp
      
    end
472421
def invoice(self, **kwargs):
        """"""
        url = urljoin(self._url, '/invoices')

        if kwargs:
            response = self.http_request(url, 'POST', Invoice(**kwargs), {'Content-Type':
                'application/xml; charset=utf-8'})
        else:
            response = self.http_request(url, 'POST')

        if response.status != 201:
            self.raise_http_error(response)

        response_xml = response.read()
        logging.getLogger('recurly.http.response').debug(response_xml)
        elem = ElementTree.fromstring(response_xml)

        invoice_collection = InvoiceCollection.from_element(elem)
        return invoice_collection
124611
def draw_pdf(buffer, invoice):
    
    canvas = Canvas(buffer, pagesize=A4)
    canvas.translate(0, 29.7 * cm)
    canvas.setFont('Helvetica', 10)

    canvas.saveState()
    header_func(canvas)
    canvas.restoreState()

    canvas.saveState()
    footer_func(canvas)
    canvas.restoreState()

    canvas.saveState()
    address_func(canvas)
    canvas.restoreState()

    # Client address
    textobject = canvas.beginText(1.5 * cm, -2.5 * cm)
    try:
        if invoice.address.invoice_contact_name:
            textobject.textLine(invoice.address.invoice_contact_name)
        textobject.textLine(invoice.address.invoice_address_one)
        if invoice.address.invoice_address_two:
            textobject.textLine(invoice.address.invoice_address_two)
        textobject.textLine(invoice.address.invoice_town)
        if invoice.address.invoice_county:
            textobject.textLine(invoice.address.invoice_county)
        textobject.textLine(invoice.address.invoice_postcode)
        textobject.textLine(invoice.address.country.invoice_name)
    except:
        pass
    canvas.drawText(textobject)

    # Info
    textobject = canvas.beginText(1.5 * cm, -6.75 * cm)
    textobject.textLine(u'Invoice ID: %s' % invoice.invoice_id)
    textobject.textLine(u'Invoice Date: %s' % invoice.invoice_date.strftime(
        '%d %b %Y'))
    canvas.drawText(textobject)

    # Items
    data = [[u'Quantity', u'Description', u'Amount', u'Total'], ]
    for item in invoice.items.all():
        data.append([
            item.quantity,
            item.description,
            format_currency(item.unit_price, invoice.currency),
            format_currency(item.total(), invoice.currency)
        ])
    data.append([u'', u'', u'Total:', format_currency(invoice.total(),
                 invoice.currency)])
    table = Table(data, colWidths=[2 * cm, 11 * cm, 3 * cm, 3 * cm])
    table.setStyle([
        ('FONT', (0, 0), (-1, -1), 'Helvetica'),
        ('FONTSIZE', (0, 0), (-1, -1), 10),
        ('TEXTCOLOR', (0, 0), (-1, -1), (0.2, 0.2, 0.2)),
        ('GRID', (0, 0), (-1, -2), 1, (0.7, 0.7, 0.7)),
        ('GRID', (-2, -1), (-1, -1), 1, (0.7, 0.7, 0.7)),
        ('ALIGN', (-2, 0), (-1, -1), 'RIGHT'),
        ('BACKGROUND', (0, 0), (-1, 0), (0.8, 0.8, 0.8)),
    ])
    tw, th, = table.wrapOn(canvas, 15 * cm, 19 * cm)
    table.drawOn(canvas, 1 * cm, -8 * cm - th)

    canvas.showPage()
    canvas.save()

    return canvas
814465
function DoCaptTran($hostlogkey,
                        $authcode,
                        $amount,
                        $currency,
                        $instnumber,
                        $multpoint = "00",
                        $extpoint = "000000") {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->hostlogkey = $hostlogkey;
        $posnetRequest->authcode = $authcode;
        $posnetRequest->amount = $amount;
        $posnetRequest->currency = $currency;
        $posnetRequest->instnumber = $instnumber;
        $posnetRequest->multiplepoint = $multpoint;
        $posnetRequest->extrapoint = $extpoint;

        return $this->DoTran($posnetRequest, "capt");
    }
471837
def add_page_body
      payment_enabled = !Settings.payment.disabled

      @pdf.stroke_color '999999'

      #===============================
      # Invoice Reference
      #===============================
      @pdf.float do
        original_color = @pdf.fill_color
        @pdf.fill_color "F0F0F0"
        @pdf.fill_rounded_rectangle [310,@pdf.cursor], 230, 50, 5
        @pdf.fill_color = original_color

        @pdf.text_box "Your Reference", at: [310,@pdf.cursor], width: 65, height: 13, align: :center, valign: :center,
                      style: :bold_italic, size: 7

        @pdf.text_box @data[:invoice_reference], at: [310,@pdf.cursor], width: 230, height: 50, align: :center, valign: :center,
                      style: :bold
      end

      #===============================
      # Customer information
      #===============================
      @pdf.text @data[:customer_name], align: :left, inline_format: true

      if @data[:customer_email]
        @pdf.text "<color rgb='999999'>#{@data[:customer_email]}</color>", align: :left, inline_format: true
      end

      if @data[:customer_billing_address]
        @pdf.move_down 5
        @pdf.text "<color rgb='999999'>#{@data[:customer_billing_address]}</color>", align: :left, inline_format: true, style: :italic, size: 9
      end

      #===============================
      # Summary
      #===============================
      @pdf.move_down 40
      @pdf.font_size(20) { @pdf.text 'Summary', style: :bold }
      @pdf.stroke_horizontal_rule
      @pdf.move_down 10

      summary_data_amount = @data[:invoice_price]
      summary_data_amount = @data[:invoice_total_payable_with_tax] if payment_enabled

      summary_data = []
      summary_data << ['Period', 'Total Payable' + (@data[:invoice_tax_pips] > 0 ? "\n<font size='8'><i>(incl. GST)</i></font>" : '')]
      summary_data << ["#{@data[:period_started_at].strftime("%B, %e %Y")} to #{@data[:period_ended_at].strftime("%B, %e %Y")}",money(summary_data_amount)]

      # Draw Table background
      bg_height = @data[:invoice_tax_pips] > 0 ? 58 : 50
      @pdf.float do
        original_color = @pdf.fill_color
        @pdf.fill_color "d1e17c"
        @pdf.fill_rounded_rectangle [0,@pdf.cursor], 540, bg_height, 5
        @pdf.fill_color = original_color
      end

      # Draw Table
      @pdf.table(summary_data) do |t|
        t.header = true
        t.width = 540
        t.column_widths = [435,105]
        t.cell_style = { borders: [] }
        t.row(0).font_style = :bold

        t.cell_style = { padding: [5, 5, 5, 10], inline_format: true }
        t.cells.style do |c|
          if c.column == 1
            c.align = :center
          end
        end
      end

      @pdf.move_down 10
      @pdf.indent(5) do
        @pdf.font_size(8) do
          @pdf.text "<color rgb='999999'> This charge will appear as INV #{@data[:invoice_reference]} on your bank statement.</color>", inline_format: true
          @pdf.text "<color rgb='999999'> Charges are all displayed in #{@data[:invoice_currency_name]} (#{@data[:invoice_currency]})</color>", inline_format: true
          if @data[:invoice_fully_paid]
            @pdf.text "<color rgb='999999'>  No credit card payments required for this invoice</color>", inline_format: true
          else
            @pdf.text "<color rgb='999999'>  Your designated credit card will be charged on #{@data[:period_charge_date].strftime("%B,%e %Y")} at midnight UTC by Maestrano Pty Ltd as service provider to the #{MnoEnterprise.app_name} platform.</color>", inline_format: true
          end
        end
      end

      #===============================
      # Credit Remaining
      # ---
      # Only if greater than zero
      #===============================
      if @data[:customer_current_credit] && @data[:customer_current_credit].positive?
        @pdf.move_down 5
        @pdf.indent(5) do
          @pdf.font_size(8) do
            @pdf.text "<color rgb='999999'>  Note that your credit is shared with any organization you may have created</color>", inline_format: true
          end
        end

        @pdf.move_up 28

        @pdf.float do
          original_color = @pdf.fill_color
          @pdf.fill_color "67BBE9"
          @pdf.fill_rounded_rectangle [445,@pdf.cursor], 95, 50, 5
          @pdf.fill_color = original_color

          @pdf.text_box "Credit Remaining", at: [445,@pdf.cursor], width: 95, height: 23, align: :center, valign: :center,
                        style: :bold, size: 10

          @pdf.text_box money(@data[:customer_current_credit]), at: [445,@pdf.cursor], width: 95, height: 37, align: :center, valign: :bottom
        end

        @pdf.move_down 40
      end

      if payment_enabled
        #===============================
        # Account Situation
        #===============================
        @pdf.move_down 30
        @pdf.font_size(20) { @pdf.text 'Account Situation', style: :bold }
        @pdf.stroke_horizontal_rule
        @pdf.move_down 10

        # Situation Data
        situation_data = []
        # Header
        situation_data << [
          '',
          '',
          'Due Last Month',
          '',
          'Paid (Thank You)',
          '',
          'This Month',
          '',
          'Credit',
          '',
          'Total'
        ]

        #Content
        situation_data << [
          '',
          '',
          money(@data[:invoice_previous_total_due]),
          '-',
          money(@data[:invoice_previous_total_paid]),
          '+',
          money(@data[:invoice_price]),
          '-',
          money(@data[:invoice_credit_paid]),
          '=',
          money(@data[:invoice_total_payable])
        ]

        # Draw background
        @pdf.float do
          original_color = @pdf.fill_color
          @pdf.fill_color "F0F0F0"
          @pdf.fill_rounded_rectangle [0,@pdf.cursor], 540, 50, 5
          @pdf.fill_color = original_color
        end


        # Draw left background
        @pdf.float do
          original_color = @pdf.fill_color
          @pdf.fill_color "E0E0E0"
          @pdf.fill_rounded_rectangle [0,@pdf.cursor], 80, 50, 5
          @pdf.fill_color = original_color
          @pdf.move_down 21
          if @data[:invoice_tax_pips] > 0
            @pdf.text_box 'Excl. GST', at: [12,@pdf.cursor]
          else
            @pdf.text_box 'Details', at: [20,@pdf.cursor]
          end
        end

        # Draw table
        @pdf.table(situation_data) do |t|
          t.header = true
          t.width = 540
          t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]
          t.row(0).font_style = :bold
          t.row(0).size = 8
          t.row(0).height = 22
          t.row(1).height = 25

          t.cell_style = {
            borders: [],
            overflow: :shrink_to_fit,
            align: :center
          }

          # Color the '+','-' and '=' characters
          t.cells.style do |c|
            if c.row == 1 && c.column.odd?
              c.text_color = "a8a8a8"
            end
          end
        end


        #=================================
        # Account Situation - Tax Section
        #=================================
        if @data[:invoice_tax_pips] > 0

          #-----------------
          # GST row
          #-----------------
          @pdf.move_down 8

          table_data = []
          table_data << [
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            'GST',
            '+',
            money(@data[:invoice_tax_payable]),
          ]

          # Draw table background
          @pdf.float do
            original_color = @pdf.fill_color
            @pdf.fill_color "F0F0F0"
            @pdf.fill_rounded_rectangle [368,@pdf.cursor], 172, 24, 5
            @pdf.fill_color = original_color
          end

          # Draw left background
          @pdf.float do
            original_color = @pdf.fill_color
            @pdf.fill_color "FAB451"
            @pdf.fill_rounded_rectangle [368,@pdf.cursor], 80, 24, 5
            @pdf.fill_color = original_color
          end

          @pdf.table(table_data) do |t|
            t.header = true
            t.width = 540
            t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]
            t.row(0).height = 25

            t.cell_style = {
              borders: [],
              overflow: :shrink_to_fit,
              align: :center
            }

            # Color the '+','-' and '=' characters
            t.cells.style do |c|
              if c.row == 0 && c.column.odd?
                c.text_color = "a8a8a8"
              end
            end
          end


          #-----------------
          # Total (incl. GST)
          #-----------------
          @pdf.move_down 5

          table_data = []
          table_data << [
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            '',
            'Total (incl. GST)',
            '=',
            money(@data[:invoice_total_payable_with_tax]),
          ]

          # Draw table background
          @pdf.float do
            original_color = @pdf.fill_color
            @pdf.fill_color "F0F0F0"
            @pdf.fill_rounded_rectangle [368,@pdf.cursor], 172, 24, 5
            @pdf.fill_color = original_color
          end

          # Draw left background
          @pdf.float do
            original_color = @pdf.fill_color
            @pdf.fill_color "DAE173"
            @pdf.fill_rounded_rectangle [368,@pdf.cursor], 80, 24, 5
            @pdf.fill_color = original_color
          end

          @pdf.table(table_data) do |t|
            t.header = true
            t.width = 540
            t.row(0).font_style = :bold
            t.column_widths = [75,18,75,18,75,18,75,18,75,18,75]
            t.row(0).height = 25

            t.cell_style = {
              borders: [],
              overflow: :shrink_to_fit,
              align: :center
            }

            # Color the '+','-' and '=' characters
            t.cells.style do |c|
              if c.row == 0 && c.column.odd?
                c.text_color = "a8a8a8"
              end
            end
          end
        end
      end

      #===============================
      # Details
      #===============================
      @pdf.start_new_page
      @pdf.font_size(20) { @pdf.text 'Details', style: :bold }
      @pdf.stroke_horizontal_rule
      @pdf.move_down 10

      app_details_data = []
      app_details_data << ['Product', 'Type', 'Usage', 'Price' + (@data[:invoice_tax_pips] > 0 ? "\n<font size='8'><i>(excl. GST)</i></font>" : '')]
      app_details_data += @data[:billing_report]

      @pdf.table(app_details_data) do |t|
        t.header = true
        t.width = 540
        t.row_colors = ["FFFFFF", "F0F0F0"]
        t.column_widths = [240,100,100,100]
        t.cell_style = { borders: [:bottom],
                         border_width: 1,
                         border_color: "999999",
                         inline_format: true
        }
        t.row(0).borders = [:bottom]
        t.row(0).border_width = 2
        t.row(0).font_style = :bold
      end
    end
353104
private static BigDecimal computeInvoiceAmountAdjustedForAccountCredit(final Currency currency, final Iterable<InvoiceItem> invoiceItems) {
        BigDecimal amountAdjusted = BigDecimal.ZERO;
        if (invoiceItems == null || !invoiceItems.iterator().hasNext()) {
            return KillBillMoney.of(amountAdjusted, currency);
        }

        for (final InvoiceItem invoiceItem : invoiceItems) {
            final Iterable<InvoiceItem> otherInvoiceItems = Iterables.filter(invoiceItems, new Predicate<InvoiceItem>() {
                @Override
                public boolean apply(final InvoiceItem input) {
                    return !input.getId().equals(invoiceItem.getId());
                }
            });

            if (InvoiceItemType.CREDIT_ADJ.equals(invoiceItem.getInvoiceItemType()) &&
                (Iterables.size(otherInvoiceItems) == 1 &&
                 InvoiceItemType.CBA_ADJ.equals(otherInvoiceItems.iterator().next().getInvoiceItemType()) &&
                 otherInvoiceItems.iterator().next().getInvoiceId().equals(invoiceItem.getInvoiceId()) &&
                 otherInvoiceItems.iterator().next().getAmount().compareTo(invoiceItem.getAmount().negate()) == 0)) {
                amountAdjusted = amountAdjusted.add(invoiceItem.getAmount());
            }
        }

        return KillBillMoney.of(amountAdjusted, currency);
    }
1124700
def generate_report(book_url):
    
    with piecash.open_book(book_url, readonly=True, open_if_lock=True) as book:
        accounts = [acc.fullname for acc in book.accounts]

        return f"""<html>
        <body>
            Hello world from python !<br>
            Book : {book_url}<br>
            List of accounts : {accounts}
        </body>
        </html>"""
1269147
public function invoice()
    {
        $this->checkAuth();
        $this->checkCartNotEmpty();
        $this->checkValidDelivery();

        $message = false;

        $orderPayment = $this->createForm(FrontForm::ORDER_PAYMENT);

        try {
            $form = $this->validateForm($orderPayment, "post");

            $invoiceAddressId = $form->get("invoice-address")->getData();
            $paymentModuleId = $form->get("payment-module")->getData();

            /* check that the invoice address belongs to the current customer */
            $invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId);
            if ($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
                throw new \Exception(
                    $this->getTranslator()->trans(
                        "Invoice address does not belong to the current customer",
                        [],
                        Front::MESSAGE_DOMAIN
                    )
                );
            }

            $orderEvent = $this->getOrderEvent();
            $orderEvent->setInvoiceAddress($invoiceAddressId);
            $orderEvent->setPaymentModule($paymentModuleId);

            $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_INVOICE_ADDRESS, $orderEvent);
            $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_PAYMENT_MODULE, $orderEvent);

            return $this->generateRedirectFromRoute("order.payment.process");

        } catch (FormValidationException $e) {
            $message = $this->getTranslator()->trans(
                "Please check your input: %s",
                ['%s' => $e->getMessage()],
                Front::MESSAGE_DOMAIN
            );
        } catch (PropelException $e) {
            $this->getParserContext()->setGeneralError($e->getMessage());
        } catch (\Exception $e) {
            $message = $this->getTranslator()->trans(
                "Sorry, an error occured: %s",
                ['%s' => $e->getMessage()],
                Front::MESSAGE_DOMAIN
            );
        }

        if ($message !== false) {
            Tlog::getInstance()->error(
                sprintf("Error during order payment process : %s. Exception was %s", $message, $e->getMessage())
            );

            $orderPayment->setErrorMessage($message);

            $this->getParserContext()
                ->addForm($orderPayment)
                ->setGeneralError($message)
            ;
        }

        return $this->generateErrorRedirect($orderPayment);
    }
564863
def render_payment_form(self):
        """"""
        self.context[self.form_context_name] = self.payment_form_cls()
        return TemplateResponse(self.request, self.payment_template, self.context)
1052058
public static String micropay(boolean isSandbox, Map<String, String> params) {
		if (isSandbox)
			return WxPayApi.doPost(MICROPAY_SANDBOXNEW_RUL, params);
		return WxPayApi.doPost(MICROPAY_URL, params);
	}
694963
def esr_recipe(invoice, account, sender, print_payment_for)
      bounding_box [cm2pt(0.4), cm2pt(9.6)], :width => cm2pt(5) do
        indent cm2pt(0.4) do
          draw_account_detail(account.bank, sender, print_payment_for)
        end
        draw_account(account)
        draw_amount(invoice.balance.currency_round)

        bounding_box [cm2pt(0.4), bounds.top - cm2pt(5.2)], :width => cm2pt(5) do
          text esr9_reference(invoice, account), :size => 7

          text " "

          draw_address invoice.customer.vcard
        end
      end

      bounding_box [cm2pt(6.4), cm2pt(9.6)], :width => cm2pt(5) do
        draw_account_detail(account.bank, sender, print_payment_for)
        draw_account(account)
        draw_amount(invoice.balance.currency_round)
      end

      font_size 10 do
        character_spacing 1.1 do
          draw_text esr9_reference(invoice, account), :at => [cm2pt(12.7), cm2pt(6.8)]
        end
      end

      bounding_box [cm2pt(12.7), cm2pt(5.5)], :width => cm2pt(7.5) do
        draw_address(invoice.customer.vcard)
      end

      # ESR-Reference
      if ::Rails.root.join('data/ocrb10.ttf').exist?
        ocr_font = ::Rails.root.join('data/ocrb10.ttf')
      else
        ocr_font = "Helvetica"
        ::Rails.logger.warn("No ocrb10.ttf found for ESR reference in #{::Rails.root.join('data')}!")
      end

      font ocr_font, :size => 11 do
        character_spacing 0.5 do
          draw_text esr9(invoice, account), :at => [cm2pt(6.7), cm2pt(1.7)]
        end
      end
    end
672637
public function recurPayment(
        $iSourceOrderNumber,
        $iAmount,
        $sCurrency,
        $sOrderDescription,
        $iOrderNumber = null,
        $bDepositFlag = null
    ) {
        $this->_requestData[self::COMMAND] = self::$COMMAND_RECUR_PAYMENT;

        $this->_setField(self::SOURCE_ORDER_NUMBER, $iSourceOrderNumber);
        $this->_setField(self::AMOUNT, $iAmount);
        $this->_setField(self::CURRENCY, strtoupper($sCurrency));

        $this->_setField(self::ORDER_DESCRIPTION, $sOrderDescription);

        if (!is_null($iOrderNumber)) {
            $this->_setField(self::ORDER_NUMBER, $iOrderNumber);
        }

        if (!is_null($bDepositFlag)) {
            $this->_setField(self::AUTO_DEPOSIT, $bDepositFlag ? self::$BOOL_TRUE : self::$BOOL_FALSE);
        }


        $this->_fingerprintOrder->setOrder(Array(
            self::CUSTOMER_ID,
            self::SHOP_ID,
            self::TOOLKIT_PASSWORD,
            self::SECRET,
            self::COMMAND,
            self::LANGUAGE,
            self::ORDER_NUMBER,
            self::SOURCE_ORDER_NUMBER,
            self::AUTO_DEPOSIT,
            self::ORDER_DESCRIPTION,
            self::AMOUNT,
            self::CURRENCY
        ));

        return new WirecardCEE_QPay_Response_Toolkit_RecurPayment($this->_send());
    }
138968
function DoExpressCheckoutPayment($token, $payerId, $options = array()) {
    $values = array_merge($options, array('TOKEN'   => $token,
                                          'PAYERID' => $payerId));
    if (PAYPAL_DEV_MODE == 'true') $this->log('DoExpressCheckout - breakpoint 1 - ['.$token  . ' ' . $payerId . ' ' . "]\n\n[" . print_r($values, true) .']', $token);

    if ($this->_mode == 'payflow') {
      $values['ACTION'] = 'D'; /* ACTION=D denotes DoExpressCheckoutPayment via Payflow */
      $values['TENDER'] = 'P';
      $values['TRXTYPE'] = $this->_trxtype;
      $values['NOTIFYURL'] = zen_href_link('ipn_main_handler.php', '', 'SSL',false,false,true);
    } elseif ($this->_mode == 'nvp') {
      if (!isset($values['PAYMENTACTION']) || $this->checkHasApiCredentials() === FALSE) $values['PAYMENTACTION'] = ($this->_trxtype == 'S' || ($this->checkHasApiCredentials() === FALSE) ? 'Sale' : 'Authorization');
      $values['NOTIFYURL'] = urlencode(zen_href_link('ipn_main_handler.php', '', 'SSL',false,false,true));
    }
    $this->values = $values;
    $this->notify('NOTIFY_PAYPAL_DOEXPRESSCHECKOUTPAYMENT');
    if (PAYPAL_DEV_MODE == 'true') $this->log('DoExpressCheckout - breakpoint 2 '.print_r($this->values, true), $token);
    return $this->_request($this->values, 'DoExpressCheckoutPayment');
  }