Making WordPress.org


Ignore:
Timestamp:
02/19/2016 12:10:43 AM (11 years ago)
Author:
iandunn
Message:

WordCamp Budgets Dashboard: Send Sponsor Invoices to QuickBooks.

This includes several interconnected pieces:

  • Creating new Customers
  • Fetching existing Customers
  • Creating Invoices
  • Sending Invoices
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/sponsor-invoices-dashboard.php

    r2528 r2532  
    217217        switch_to_blog( $site_id );
    218218
    219         $quickbooks_result = send_invoice_to_quickbooks( $site_id, $invoice_id );
     219        $quickbooks_result = \WordCamp_QBO_Client::send_invoice_to_quickbooks( $invoice_id );
    220220
    221221        if ( is_int( $quickbooks_result ) ) {
    … …  
    236236                wp_send_json_error( $result );
    237237        }
    238 }
    239 
    240 /**
    241  * Send an invoice to the sponsor through QuickBooks Online's API
    242  *
    243  * @param int $site_id
    244  * @param int $invoice_id
    245  *
    246  * @return int|string
    247  */
    248 function send_invoice_to_quickbooks( $site_id, $invoice_id ) {
    249         switch_to_blog( $site_id );
    250 
    251         $invoice_meta = get_post_custom( $invoice_id );
    252         $sponsor_meta = get_post_custom( $invoice_meta['_wcbsi_sponsor_id'][0] );
    253 
    254         /* these are the values needed for the API call. they're guaranteed to exist.
    255         wp_send_json_error( array(
    256                 $sponsor_meta['_wcpt_sponsor_company_name'][0],
    257                 $sponsor_meta['_wcpt_sponsor_first_name'][0],
    258                 $sponsor_meta['_wcpt_sponsor_last_name'][0],
    259                 $sponsor_meta['_wcpt_sponsor_email_address'][0],
    260                 $sponsor_meta['_wcpt_sponsor_phone_number'][0],
    261 
    262                 $sponsor_meta['_wcpt_sponsor_street_address1'][0],
    263                 $sponsor_meta['_wcpt_sponsor_street_address2'][0],
    264                 $sponsor_meta['_wcpt_sponsor_city'][0],
    265                 $sponsor_meta['_wcpt_sponsor_state'][0],
    266                 $sponsor_meta['_wcpt_sponsor_zip_code'][0],
    267                 $sponsor_meta['_wcpt_sponsor_country'][0],
    268 
    269                 $invoice_meta['_wcbsi_due_date'][0],
    270                 $invoice_meta['_wcbsi_description'][0],
    271                 $invoice_meta['_wcbsi_currency'][0],
    272                 $invoice_meta['_wcbsi_amount'][0],
    273         ) );
    274         */
    275 
    276         $sent = 'QuickBooks integration is not complete yet.';
    277         // todo return QBO invoice ID on success, or an error message string on failure
    278 
    279         restore_current_blog();
    280 
    281         return $sent;
    282238}
    283239
Note: See TracChangeset for help on using the changeset viewer.