Skip to content

Commit

Permalink
Merge pull request #1243 from angelleye/PFW-299
Browse files Browse the repository at this point in the history
Feature Request: Adding PayPal fee as meta data, PFW-299
  • Loading branch information
Drew Angell committed Dec 8, 2018
2 parents b217acc + a8ad96c commit 658d313
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions angelleye-includes/angelleye-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -2227,4 +2227,10 @@ public function angelleye_wc_braintree_docapture($order) {
}
}
}

public static function angelleye_add_paypal_payment_meta($order_id, $payment_meta) {
foreach ($payment_meta as $key => $value) {
update_post_meta($order_id, $key, wc_clean($value));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ public function angelleye_do_express_checkout_payment() {
if ($this->gateway->payment_action != 'Sale') {
AngellEYE_Utility::angelleye_paypal_for_woocommerce_add_paypal_transaction($this->paypal_response, $order, $this->gateway->payment_action);
}
$payment_meta = array('Payment type' => !empty($this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE']) ? $this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE'] : '', 'PayPal Transaction Fee' => !empty($this->paypal_response['PAYMENTINFO_0_FEEAMT']) ? $this->paypal_response['PAYMENTINFO_0_FEEAMT'] : '');
AngellEYE_Utility::angelleye_add_paypal_payment_meta($order_id, $payment_meta);
if ($this->response_helper->ec_is_response_success($this->paypal_response)) {
do_action('ae_add_custom_order_note', $order, $card = null, $token = null, $this->paypal_response);
apply_filters('woocommerce_payment_successful_result', array('result' => 'success'), $order_id);
Expand Down
2 changes: 1 addition & 1 deletion angelleye-includes/paypal-rest-api-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public function set_payment() {
public function getAuth() {
$this->mode = $this->testmode == true ? 'SANDBOX' : 'LIVE';
$auth = new ApiContext(new OAuthTokenCredential($this->rest_client_id, $this->rest_secret_id));
$auth->setConfig(array('mode' => $this->mode, 'http.headers.PayPal-Partner-Attribution-Id' => 'AngellEYE_SP_WooCommerce', 'log.LogEnabled' => $this->debug , 'log.LogLevel' => ($this->mode == 'DEBUG') ? 'DEBUG' : 'INFO', 'log.FileName' => wc_get_log_file_path('paypal_credit_card_rest')));
$auth->setConfig(array('mode' => $this->mode, 'http.headers.PayPal-Partner-Attribution-Id' => 'AngellEYE_SP_WooCommerce', 'log.LogEnabled' => $this->debug , 'log.LogLevel' => ($this->mode == 'SANDBOX') ? 'DEBUG' : 'INFO', 'log.FileName' => wc_get_log_file_path('paypal_credit_card_rest')));
return $auth;
}

Expand Down

0 comments on commit 658d313

Please sign in to comment.