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

Feature Request: Adding PayPal fee as meta data, PFW-299 #1243

Merged
merged 1 commit into from
Dec 8, 2018
Merged
Show file tree
Hide file tree
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
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