Version Description
- Fix - Free subscription trails not allowed.
- Fix - Subscription recurring billing after free trial not working.
Download this release
Release Info
| Developer | dwainm |
| Plugin | |
| Version | 1.2.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.3 to 1.2.4
assets/js/checkout.js
CHANGED
|
@@ -145,7 +145,14 @@ jQuery( document ).ready( function( $ ) {
|
|
| 145 |
|
| 146 |
// In the middle of loading or unloading something? Just return.
|
| 147 |
if ( state === states.LOADING || state === states.UNLOADING ) {
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
}
|
| 150 |
|
| 151 |
// Are key things missing? Just return.
|
|
@@ -154,7 +161,7 @@ jQuery( document ).ready( function( $ ) {
|
|
| 154 |
}
|
| 155 |
|
| 156 |
// No checkout form? Just return.
|
| 157 |
-
checkoutForm = jQuery( 'form.checkout' );
|
| 158 |
if ( ! checkoutForm.length ) {
|
| 159 |
return;
|
| 160 |
}
|
|
@@ -213,6 +220,15 @@ jQuery( document ).ready( function( $ ) {
|
|
| 213 |
|
| 214 |
// Does it look like the form got re-rendered on us? Start unloading (so we can reload).
|
| 215 |
if ( ! paymentDiv.hasClass( 'wc_paypalbraintree_loaded' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
unloadMethod();
|
| 217 |
return;
|
| 218 |
}
|
| 145 |
|
| 146 |
// In the middle of loading or unloading something? Just return.
|
| 147 |
if ( state === states.LOADING || state === states.UNLOADING ) {
|
| 148 |
+
|
| 149 |
+
// If we're waiting for onReady to fire, return. Otherwise, reset state in
|
| 150 |
+
// order to attempt Braintree.setup again.
|
| 151 |
+
if ( 0 != jQuery( '#wc-paypal-braintree-cvv' ).children().length ) {
|
| 152 |
+
return;
|
| 153 |
+
} else {
|
| 154 |
+
state = states.NOTLOADED;
|
| 155 |
+
}
|
| 156 |
}
|
| 157 |
|
| 158 |
// Are key things missing? Just return.
|
| 161 |
}
|
| 162 |
|
| 163 |
// No checkout form? Just return.
|
| 164 |
+
checkoutForm = jQuery( 'form.checkout, form#order_review, form#add_payment_method' );
|
| 165 |
if ( ! checkoutForm.length ) {
|
| 166 |
return;
|
| 167 |
}
|
| 220 |
|
| 221 |
// Does it look like the form got re-rendered on us? Start unloading (so we can reload).
|
| 222 |
if ( ! paymentDiv.hasClass( 'wc_paypalbraintree_loaded' ) ) {
|
| 223 |
+
|
| 224 |
+
// Check if last field is loaded from previous Braintree setup.
|
| 225 |
+
// onReady can take some time to fire causing Braintree to attempt setup
|
| 226 |
+
// again after a previous successful setup. No need to unload.
|
| 227 |
+
if ( 0 != jQuery( '#wc-paypal-braintree-cvv' ).children().length ) {
|
| 228 |
+
state = states.LOADED;
|
| 229 |
+
return;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
unloadMethod();
|
| 233 |
return;
|
| 234 |
}
|
classes/class-wc-gateway-paypal-braintree-subscription.php
CHANGED
|
@@ -57,8 +57,8 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 57 |
* renewal orders
|
| 58 |
*
|
| 59 |
* @param int $order_id
|
| 60 |
-
* @return
|
| 61 |
-
|
| 62 |
public function process_payment( $order_id ) {
|
| 63 |
|
| 64 |
// If the order contains no subscriptions, just let the parent process it
|
|
@@ -72,14 +72,14 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 72 |
|
| 73 |
$paypal_braintree_nonce = self::get_posted_variable( 'paypalbraintree_nonce' );
|
| 74 |
if ( empty( $paypal_braintree_nonce ) ) {
|
| 75 |
-
$this->log( __FUNCTION__,
|
| 76 |
wc_add_notice( __( 'Error: PayPal Powered by Braintree did not supply a payment nonce. Please try again later or use another means of payment.', 'woocommerce-gateway-paypal-braintree' ), 'error' );
|
| 77 |
return false;
|
| 78 |
}
|
| 79 |
|
| 80 |
$user_id = $order->get_user_id();
|
| 81 |
if ( ! is_user_logged_in() ) {
|
| 82 |
-
$this->log( __FUNCTION__,
|
| 83 |
wc_add_notice( __( 'Error: You must login or create an account before you can purchase a subscription.', 'woocommerce-gateway-paypal-braintree' ), 'error' );
|
| 84 |
return false;
|
| 85 |
}
|
|
@@ -94,7 +94,7 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 94 |
$braintree_customer_id = get_user_meta( $user_id, '_wc_paypal_braintree_customer_id', true );
|
| 95 |
if ( empty( $braintree_customer_id ) ) {
|
| 96 |
|
| 97 |
-
$this->log( __FUNCTION__,
|
| 98 |
|
| 99 |
// Create a new customer id, passing the nonce so we can add the card to the vault
|
| 100 |
// ref https://developers.braintreepayments.com/reference/request/customer/create/php
|
|
@@ -104,7 +104,7 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 104 |
'company' => $order->billing_company,
|
| 105 |
'phone' => $order->billing_phone,
|
| 106 |
'email' => $order->billing_email,
|
| 107 |
-
'paymentMethodNonce' => $paypal_braintree_nonce
|
| 108 |
);
|
| 109 |
|
| 110 |
try {
|
|
@@ -147,111 +147,128 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 147 |
|
| 148 |
}
|
| 149 |
|
| 150 |
-
|
| 151 |
-
$billing = array(
|
| 152 |
-
'firstName' => $order->billing_first_name,
|
| 153 |
-
'lastName' => $order->billing_last_name,
|
| 154 |
-
'company' => $order->billing_company,
|
| 155 |
-
'streetAddress' => $order->billing_address_1,
|
| 156 |
-
'extendedAddress' => $order->billing_address_2,
|
| 157 |
-
'locality' => $order->billing_city,
|
| 158 |
-
'region' => $order->billing_state,
|
| 159 |
-
'postalCode' => $order->billing_postcode,
|
| 160 |
-
'countryCodeAlpha2' => $order->billing_country
|
| 161 |
-
);
|
| 162 |
-
|
| 163 |
-
// Shipping data, assemble
|
| 164 |
-
$shipping = array(
|
| 165 |
-
'firstName' => $order->shipping_first_name,
|
| 166 |
-
'lastName' => $order->shipping_last_name,
|
| 167 |
-
'company' => $order->shipping_company,
|
| 168 |
-
'streetAddress' => $order->shipping_address_1,
|
| 169 |
-
'extendedAddress' => $order->shipping_address_2,
|
| 170 |
-
'locality' => $order->shipping_city,
|
| 171 |
-
'region' => $order->shipping_state,
|
| 172 |
-
'postalCode' => $order->shipping_postcode,
|
| 173 |
-
'countryCodeAlpha2' => $order->shipping_country
|
| 174 |
-
);
|
| 175 |
-
|
| 176 |
-
$sale_args = array(
|
| 177 |
-
'amount' => $order->order_total,
|
| 178 |
-
'billing' => $billing,
|
| 179 |
-
'shipping' => $shipping,
|
| 180 |
-
'customerId' => $braintree_customer_id,
|
| 181 |
-
'channel' => 'WooThemes_BT', // aka BN tracking code
|
| 182 |
-
'orderId' => $order_id,
|
| 183 |
-
'options' => array(
|
| 184 |
-
'submitForSettlement' => true,
|
| 185 |
-
'storeInVaultOnSuccess' => true,
|
| 186 |
-
)
|
| 187 |
-
);
|
| 188 |
-
|
| 189 |
$sale_args = array_merge( $sale_args, $authentication );
|
|
|
|
| 190 |
|
| 191 |
// Process trial periods and possible coupon discounts.
|
| 192 |
if ( isset( $sale_args['amount'] ) && 0.00 === doubleval( $sale_args['amount'] ) ) {
|
| 193 |
|
| 194 |
$user_id = $order->get_user_id();
|
| 195 |
$this->log( __FUNCTION__, "Zero payment amount for trial or coupon. Order ID: $order_id, User ID: $user_id" );
|
| 196 |
-
$
|
| 197 |
-
return array(
|
| 198 |
-
'result' => 'success',
|
| 199 |
-
'redirect' => $this->get_return_url( $order ),
|
| 200 |
-
);
|
| 201 |
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
-
|
| 205 |
-
$result = $gateway->transaction()->sale( $sale_args );
|
| 206 |
-
if ( ! $result->success ) {
|
| 207 |
-
$notice = sprintf( __( 'Error: PayPal Powered by Braintree was unable to complete the transaction. Please try again later or use another means of payment. Reason: %s', 'woocommerce-gateway-paypal-braintree' ), $error_message );
|
| 208 |
-
wc_add_notice( $notice, 'error' );
|
| 209 |
-
$this->log( __FUNCTION__, "Error: Unable to complete transaction. Reason: {$result->message}" );
|
| 210 |
-
return false;
|
| 211 |
-
}
|
| 212 |
|
| 213 |
-
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
-
|
| 219 |
-
$credit_card_meta = $result->transaction->creditCard;
|
| 220 |
-
$payment_method_token = $credit_card_meta['token'];
|
| 221 |
-
if ( empty( $payment_method_token ) ) {
|
| 222 |
-
$this->log( __FUNCTION__, "Info: Customer used the paypal subflow" );
|
| 223 |
-
$paypal_meta = $result->transaction->paypal;
|
| 224 |
-
$payment_method_token = $paypal_meta['token'];
|
| 225 |
-
} else {
|
| 226 |
-
$this->log( __FUNCTION__, "Info: Customer used the credit card subflow" );
|
| 227 |
}
|
| 228 |
|
|
|
|
| 229 |
if ( empty( $payment_method_token ) ) {
|
| 230 |
-
$this->log( __FUNCTION__,
|
| 231 |
}
|
| 232 |
|
| 233 |
// Save the customer ID in each subscription for this order for later use during renewal
|
| 234 |
-
$braintree_customer_id = $result->transaction->customer['id'];
|
| 235 |
if ( empty( $braintree_customer_id ) ) {
|
| 236 |
-
$this->log( __FUNCTION__,
|
| 237 |
} else {
|
| 238 |
$this->log( __FUNCTION__, "Info: Saving to subscription(s) recurring payment braintree customer ID $braintree_customer_id" );
|
| 239 |
}
|
| 240 |
|
| 241 |
// Note: A single order may contain multiple subscriptions
|
|
|
|
| 242 |
foreach ( wcs_get_subscriptions_for_order( $order->id ) as $subscription ) {
|
| 243 |
update_post_meta( $subscription->id, '_wc_paypal_braintree_payment_method_token', $payment_method_token );
|
| 244 |
update_post_meta( $subscription->id, '_wc_paypal_braintree_customer_id', $braintree_customer_id );
|
| 245 |
}
|
| 246 |
|
|
|
|
| 247 |
$this->log( __FUNCTION__, "Info: Completed processing of payment for order $order_id" );
|
| 248 |
|
| 249 |
return array(
|
| 250 |
'result' => 'success',
|
| 251 |
-
'redirect' => $this->get_return_url( $order )
|
| 252 |
);
|
| 253 |
}
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
/**
|
| 256 |
* scheduled_subscription_payment
|
| 257 |
*
|
|
@@ -315,8 +332,8 @@ abstract class WC_Gateway_Paypal_Braintree_Subscription extends WC_Gateway_Paypa
|
|
| 315 |
$this->log( __FUNCTION__, "Info: Successfully processed schedule payment, transaction id = $transaction_id" );
|
| 316 |
|
| 317 |
WC_Subscriptions_Manager::process_subscription_payments_on_order( $order );
|
| 318 |
-
$this->log(
|
| 319 |
-
|
| 320 |
$order->payment_complete( $transaction_id );
|
| 321 |
}
|
| 322 |
|
| 57 |
* renewal orders
|
| 58 |
*
|
| 59 |
* @param int $order_id
|
| 60 |
+
* @return mixed
|
| 61 |
+
*/
|
| 62 |
public function process_payment( $order_id ) {
|
| 63 |
|
| 64 |
// If the order contains no subscriptions, just let the parent process it
|
| 72 |
|
| 73 |
$paypal_braintree_nonce = self::get_posted_variable( 'paypalbraintree_nonce' );
|
| 74 |
if ( empty( $paypal_braintree_nonce ) ) {
|
| 75 |
+
$this->log( __FUNCTION__, 'Error: The paypal_braintree_nonce was unexpectedly empty' );
|
| 76 |
wc_add_notice( __( 'Error: PayPal Powered by Braintree did not supply a payment nonce. Please try again later or use another means of payment.', 'woocommerce-gateway-paypal-braintree' ), 'error' );
|
| 77 |
return false;
|
| 78 |
}
|
| 79 |
|
| 80 |
$user_id = $order->get_user_id();
|
| 81 |
if ( ! is_user_logged_in() ) {
|
| 82 |
+
$this->log( __FUNCTION__, 'Error: No user logged in / being created for the initial subscription payment' );
|
| 83 |
wc_add_notice( __( 'Error: You must login or create an account before you can purchase a subscription.', 'woocommerce-gateway-paypal-braintree' ), 'error' );
|
| 84 |
return false;
|
| 85 |
}
|
| 94 |
$braintree_customer_id = get_user_meta( $user_id, '_wc_paypal_braintree_customer_id', true );
|
| 95 |
if ( empty( $braintree_customer_id ) ) {
|
| 96 |
|
| 97 |
+
$this->log( __FUNCTION__, 'Info: Did not find braintree customer id on user meta. Need to create customer' );
|
| 98 |
|
| 99 |
// Create a new customer id, passing the nonce so we can add the card to the vault
|
| 100 |
// ref https://developers.braintreepayments.com/reference/request/customer/create/php
|
| 104 |
'company' => $order->billing_company,
|
| 105 |
'phone' => $order->billing_phone,
|
| 106 |
'email' => $order->billing_email,
|
| 107 |
+
'paymentMethodNonce' => $paypal_braintree_nonce,
|
| 108 |
);
|
| 109 |
|
| 110 |
try {
|
| 147 |
|
| 148 |
}
|
| 149 |
|
| 150 |
+
$sale_args = $this->generate_sales_args( $order, $braintree_customer_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
$sale_args = array_merge( $sale_args, $authentication );
|
| 152 |
+
$transaction_id = '';
|
| 153 |
|
| 154 |
// Process trial periods and possible coupon discounts.
|
| 155 |
if ( isset( $sale_args['amount'] ) && 0.00 === doubleval( $sale_args['amount'] ) ) {
|
| 156 |
|
| 157 |
$user_id = $order->get_user_id();
|
| 158 |
$this->log( __FUNCTION__, "Zero payment amount for trial or coupon. Order ID: $order_id, User ID: $user_id" );
|
| 159 |
+
$customer = $gateway->customer()->find( $braintree_customer_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
$payment_method_token = '';
|
| 162 |
+
foreach ( (array) $customer->paymentMethods as $payment_method ) {
|
| 163 |
+
if ( $payment_method->default ) {
|
| 164 |
+
$payment_method_token = $payment_method->token;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
|
| 168 |
+
} else { // charges more than zero should be sent away
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
+
// We have a customer id now, so let's do the sale and store the payment method in the vault.
|
| 171 |
+
$result = $gateway->transaction()->sale( $sale_args );
|
| 172 |
+
if ( ! $result->success ) {
|
| 173 |
+
$notice = sprintf( __( 'Error: PayPal Powered by Braintree was unable to complete the transaction. Please try again later or use another means of payment. Reason: %s', 'woocommerce-gateway-paypal-braintree' ), $error_message );
|
| 174 |
+
wc_add_notice( $notice, 'error' );
|
| 175 |
+
$this->log( __FUNCTION__, "Error: Unable to complete transaction. Reason: {$result->message}" );
|
| 176 |
+
return false;
|
| 177 |
+
}
|
| 178 |
|
| 179 |
+
$transaction_id = $result->transaction->id;
|
| 180 |
+
$this->log( __FUNCTION__, "Info: Successfully processed initial payment, transaction id = $transaction_id" );
|
| 181 |
+
$credit_card_meta = $result->transaction->creditCard;
|
| 182 |
+
$payment_method_token = $credit_card_meta['token'];
|
| 183 |
+
|
| 184 |
+
if ( empty( $payment_method_token ) ) {
|
| 185 |
+
$this->log( __FUNCTION__, 'Info: Customer used the paypal subflow' );
|
| 186 |
+
$paypal_meta = $result->transaction->paypal;
|
| 187 |
+
$payment_method_token = $paypal_meta['token'];
|
| 188 |
+
} else {
|
| 189 |
+
$this->log( __FUNCTION__, 'Info: Customer used the credit card subflow' );
|
| 190 |
+
}
|
| 191 |
|
| 192 |
+
$braintree_customer_id = $result->transaction->customer['id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
}
|
| 194 |
|
| 195 |
+
|
| 196 |
if ( empty( $payment_method_token ) ) {
|
| 197 |
+
$this->log( __FUNCTION__, 'Warning: Initial payment succeeded, but no token was provided by the gateway for recurring payments.' );
|
| 198 |
}
|
| 199 |
|
| 200 |
// Save the customer ID in each subscription for this order for later use during renewal
|
|
|
|
| 201 |
if ( empty( $braintree_customer_id ) ) {
|
| 202 |
+
$this->log( __FUNCTION__, 'Warning: Initial payment succeeded, but no braintree customer ID was provided by the gateway for recurring payments.' );
|
| 203 |
} else {
|
| 204 |
$this->log( __FUNCTION__, "Info: Saving to subscription(s) recurring payment braintree customer ID $braintree_customer_id" );
|
| 205 |
}
|
| 206 |
|
| 207 |
// Note: A single order may contain multiple subscriptions
|
| 208 |
+
// Save the token in each subscription for this order for later use during renewal
|
| 209 |
foreach ( wcs_get_subscriptions_for_order( $order->id ) as $subscription ) {
|
| 210 |
update_post_meta( $subscription->id, '_wc_paypal_braintree_payment_method_token', $payment_method_token );
|
| 211 |
update_post_meta( $subscription->id, '_wc_paypal_braintree_customer_id', $braintree_customer_id );
|
| 212 |
}
|
| 213 |
|
| 214 |
+
$order->payment_complete( $transaction_id );
|
| 215 |
$this->log( __FUNCTION__, "Info: Completed processing of payment for order $order_id" );
|
| 216 |
|
| 217 |
return array(
|
| 218 |
'result' => 'success',
|
| 219 |
+
'redirect' => $this->get_return_url( $order ),
|
| 220 |
);
|
| 221 |
}
|
| 222 |
|
| 223 |
+
/**
|
| 224 |
+
* Create sales args.
|
| 225 |
+
* @param $order
|
| 226 |
+
* @param $braintree_customer_id
|
| 227 |
+
*
|
| 228 |
+
* @return array
|
| 229 |
+
*/
|
| 230 |
+
public function generate_sales_args( $order, $braintree_customer_id ) {
|
| 231 |
+
$billing = array(
|
| 232 |
+
'firstName' => $order->billing_first_name,
|
| 233 |
+
'lastName' => $order->billing_last_name,
|
| 234 |
+
'company' => $order->billing_company,
|
| 235 |
+
'streetAddress' => $order->billing_address_1,
|
| 236 |
+
'extendedAddress' => $order->billing_address_2,
|
| 237 |
+
'locality' => $order->billing_city,
|
| 238 |
+
'region' => $order->billing_state,
|
| 239 |
+
'postalCode' => $order->billing_postcode,
|
| 240 |
+
'countryCodeAlpha2' => $order->billing_country,
|
| 241 |
+
);
|
| 242 |
+
|
| 243 |
+
// Shipping data, assemble
|
| 244 |
+
$shipping = array(
|
| 245 |
+
'firstName' => $order->shipping_first_name,
|
| 246 |
+
'lastName' => $order->shipping_last_name,
|
| 247 |
+
'company' => $order->shipping_company,
|
| 248 |
+
'streetAddress' => $order->shipping_address_1,
|
| 249 |
+
'extendedAddress' => $order->shipping_address_2,
|
| 250 |
+
'locality' => $order->shipping_city,
|
| 251 |
+
'region' => $order->shipping_state,
|
| 252 |
+
'postalCode' => $order->shipping_postcode,
|
| 253 |
+
'countryCodeAlpha2' => $order->shipping_country,
|
| 254 |
+
);
|
| 255 |
+
|
| 256 |
+
$sale_args = array(
|
| 257 |
+
'amount' => $order->order_total,
|
| 258 |
+
'billing' => $billing,
|
| 259 |
+
'shipping' => $shipping,
|
| 260 |
+
'customerId' => $braintree_customer_id,
|
| 261 |
+
'channel' => 'WooThemes_BT', // aka BN tracking code
|
| 262 |
+
'orderId' => $order->id,
|
| 263 |
+
'options' => array(
|
| 264 |
+
'submitForSettlement' => true,
|
| 265 |
+
'storeInVaultOnSuccess' => true,
|
| 266 |
+
),
|
| 267 |
+
);
|
| 268 |
+
|
| 269 |
+
return $sale_args;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
/**
|
| 273 |
* scheduled_subscription_payment
|
| 274 |
*
|
| 332 |
$this->log( __FUNCTION__, "Info: Successfully processed schedule payment, transaction id = $transaction_id" );
|
| 333 |
|
| 334 |
WC_Subscriptions_Manager::process_subscription_payments_on_order( $order );
|
| 335 |
+
$this->log( __FUNCTION__, "Info: Completed processing of scheduled payment for order {$order->id}" );
|
| 336 |
+
$order->add_order_note( sprintf( __( 'PayPal Braintree charge complete (Charge ID: %s)', 'woocommerce-gateway-paypal-braintree' ), $transaction_id ) );
|
| 337 |
$order->payment_complete( $transaction_id );
|
| 338 |
}
|
| 339 |
|
classes/class-wc-gateway-paypal-braintree.php
CHANGED
|
@@ -335,6 +335,18 @@ abstract class WC_Gateway_Paypal_Braintree extends WC_Payment_Gateway {
|
|
| 335 |
<tr>
|
| 336 |
<th>
|
| 337 |
<?php _e( 'Connect/Disconnect', 'woocommerce-gateway-paypal-braintree' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
</th>
|
| 339 |
<td>
|
| 340 |
<?php if ( ! empty( $this->merchant_access_token ) ) { ?>
|
| 335 |
<tr>
|
| 336 |
<th>
|
| 337 |
<?php _e( 'Connect/Disconnect', 'woocommerce-gateway-paypal-braintree' ); ?>
|
| 338 |
+
<?php
|
| 339 |
+
$connect_help_tip = __( 'Click button to create an account with Braintree and start transacting.', 'woocommerce-gateway-paypal-braintree' );
|
| 340 |
+
if ( ! empty( $this->merchant_access_token ) ) {
|
| 341 |
+
$connect_help_tip = sprintf(
|
| 342 |
+
'%s<br><br>%s<br><br>%s',
|
| 343 |
+
__( 'You just connected your Braintree account to WooCommerce. You can start taking payments now.', 'woocommerce-gateway-paypal-braintree' ),
|
| 344 |
+
__( 'Once you have processed a payment, PayPal will review your application for final approval. Before you ship any goods make sure you have received a final approval for your Braintree account.', 'woocommerce-gateway-paypal-braintree' ),
|
| 345 |
+
__( 'Questions? We are a phone call away: 1-855-489-0345.', 'woocommerce-gateway-paypal-braintree' )
|
| 346 |
+
);
|
| 347 |
+
}
|
| 348 |
+
echo wc_help_tip( $connect_help_tip );
|
| 349 |
+
?>
|
| 350 |
</th>
|
| 351 |
<td>
|
| 352 |
<?php if ( ! empty( $this->merchant_access_token ) ) { ?>
|
readme.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
=== WooCommerce PayPal Powered by Braintree Payment Gateway ===
|
| 2 |
-
Contributors: automattic,
|
| 3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
| 4 |
Requires at least: 4.4
|
| 5 |
-
Tested up to: 4.
|
| 6 |
-
Stable tag: 1.2.
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -77,7 +77,7 @@ For help setting up and configuring, please refer to our [user guide](http://doc
|
|
| 77 |
|
| 78 |
Make sure PayPal is enabled on your Braintree account by following the [Braintree PayPal Setup Guide](https://articles.braintreepayments.com/guides/paypal/setup-guide).
|
| 79 |
|
| 80 |
-
= What do I need to do if I'm updating from the retired premium Braintree plugin from WooThemes.com?
|
| 81 |
|
| 82 |
You'll need to go through the same installation process as everyone else. Luckily it's only a few clicks (no need to copy and paste API keys) so it should only take a minute.
|
| 83 |
|
|
@@ -110,6 +110,10 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
| 110 |
|
| 111 |
== Changelog ==
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
= 1.2.3 =
|
| 114 |
* Fix - Handle uncaught exceptions thrown by Braintree SDK. API calls from SDK may throws exception, thus it need to be handled properly in try/catch block.
|
| 115 |
* Fix - Issue where deactivating WooCommerce might throws an error
|
|
@@ -146,3 +150,9 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
| 146 |
|
| 147 |
= 1.0.0 =
|
| 148 |
* Initial release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
=== WooCommerce PayPal Powered by Braintree Payment Gateway ===
|
| 2 |
+
Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb
|
| 3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
| 4 |
Requires at least: 4.4
|
| 5 |
+
Tested up to: 4.6.1
|
| 6 |
+
Stable tag: 1.2.4
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 77 |
|
| 78 |
Make sure PayPal is enabled on your Braintree account by following the [Braintree PayPal Setup Guide](https://articles.braintreepayments.com/guides/paypal/setup-guide).
|
| 79 |
|
| 80 |
+
= What do I need to do if I'm updating from the retired premium Braintree plugin from WooThemes.com? =
|
| 81 |
|
| 82 |
You'll need to go through the same installation process as everyone else. Luckily it's only a few clicks (no need to copy and paste API keys) so it should only take a minute.
|
| 83 |
|
| 110 |
|
| 111 |
== Changelog ==
|
| 112 |
|
| 113 |
+
= 1.2.4 =
|
| 114 |
+
* Fix - Free subscription trails not allowed.
|
| 115 |
+
* Fix - Subscription recurring billing after free trial not working.
|
| 116 |
+
|
| 117 |
= 1.2.3 =
|
| 118 |
* Fix - Handle uncaught exceptions thrown by Braintree SDK. API calls from SDK may throws exception, thus it need to be handled properly in try/catch block.
|
| 119 |
* Fix - Issue where deactivating WooCommerce might throws an error
|
| 150 |
|
| 151 |
= 1.0.0 =
|
| 152 |
* Initial release
|
| 153 |
+
|
| 154 |
+
== Upgrade Notice ==
|
| 155 |
+
|
| 156 |
+
= 1.2.4 =
|
| 157 |
+
* Fix - Free subscription trails not allowed.
|
| 158 |
+
* Fix - Subscription recurring billing after free trial not working.
|
woocommerce-gateway-paypal-powered-by-braintree.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: Receive payments using Paypal Powered by Braintree. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
|
| 6 |
* Author: WooThemes
|
| 7 |
* Author URI: http://woothemes.com/
|
| 8 |
-
* Version: 1.2.
|
| 9 |
*
|
| 10 |
* Copyright (c) 2016 WooThemes
|
| 11 |
*
|
| 5 |
* Description: Receive payments using Paypal Powered by Braintree. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
|
| 6 |
* Author: WooThemes
|
| 7 |
* Author URI: http://woothemes.com/
|
| 8 |
+
* Version: 1.2.4
|
| 9 |
*
|
| 10 |
* Copyright (c) 2016 WooThemes
|
| 11 |
*
|
