Commit 7cc620d4 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

Add support for PayPal (invoice number needs to be passed to PP)

Fixes #14.
parent 7a9293f7
......@@ -65,6 +65,9 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
// Custom table widget for custom variable definitions: Hooks for creating and storing values
add_action( 'woocommerce_admin_field_ordernumber_variables', array( $this, 'admin_field_variables' ) );
add_action( 'pre_update_option_ordernumber_variables', array( $this, 'update_option_variables'));
// SUPPORT FOR BUILT-IN PLUGINS AND PAYMENT METHODS:
$this->paypal_invoicenumber_init();
// THIRD-PARTY PLUGIN SUPPORT
// Install hooks for third-party plugin support:
......@@ -330,6 +333,18 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
$reps = apply_filters( 'opentools_ordernumber_replacements', $reps, $details, $nrtype);
}
// PAYPAL SUPPORT
protected function paypal_invoicenumber_init() {
add_filter ('woocommerce_paypal_args', array( &$this, 'paypal_arguments'), 10, 2/*<= Also get the order object! */);
}
public function paypal_arguments($vals, $order) {
if ($this->invoicenumbers_activated()) {
$vals['invoice'] = $this->get_or_create_number($order->order_id, $order, 'invoice');
}
return $vals;
}
// THIRD-PARTY PLUGIN SUPPORT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment