Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added source_id attribute to charges request #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions classes/class-cio4wc_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}