From 63951f84683ec348ac4365c03e0401346b3f5c28 Mon Sep 17 00:00:00 2001 From: Jason Tobias Date: Tue, 2 Jan 2018 08:06:25 -0600 Subject: [PATCH] Added source_id attribute to be sent with charges. --- classes/class-cio4wc_gateway.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/classes/class-cio4wc_gateway.php b/classes/class-cio4wc_gateway.php index bdfeb3f..4e19924 100644 --- a/classes/class-cio4wc_gateway.php +++ b/classes/class-cio4wc_gateway.php @@ -781,10 +781,23 @@ private function charge_set_up() { // Charge description //$chargeio_charge_data['description'] = $this->get_charge_description(); + $chargeio_charge_data['source_id'] = $this->generate_source_id(); + // Create the charge on ChargeIO's servers - this will charge the user's card $charge = CIO4WC_API::create_charge( $chargeio_charge_data ); $this->charge = $charge; $this->transaction_id = $charge->id; } + + /** + * Generates a URI to identify the source of a transaction. + * + * @access private + * @return string + */ + private function generate_source_id() { + $order_key = ($this->order->order_key != null ? $this->order->order_key : current_time('timestamp')); + return 'affinipay-woocommerce://'. $_SERVER['SERVER_NAME'] .'?'. $order_key; + } }