Changeset 2837637
- Timestamp:
- 12/21/2022 09:36:04 PM (3 years ago)
- Location:
- subscreasy-payment-gateway-for-woocommerce/trunk
- Files:
-
- 4 edited
-
class-wc-gateway-subscreasy-subscriptions.php (modified) (1 diff)
-
class-wc-gateway-subscreasy.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
-
wc-gateway-subscreasy.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
subscreasy-payment-gateway-for-woocommerce/trunk/class-wc-gateway-subscreasy-subscriptions.php
r2477716 r2837637 228 228 } 229 229 230 /** 231 * Add payment method via account screen. 232 * We don't store the token locally, but to the Stripe API. 233 * 234 * @since 3.0.0 235 * @version 4.0.0 236 */ 237 public function add_payment_method() { 238 $error = false; 239 $error_msg = __( 'There was a problem adding the payment method.', 'woocommerce-gateway-subscreasy' ); 240 241 $subscreasy_customer_id = get_user_option( SUBSCREASY_CUSTOMER_ID_KEY, get_current_user_id() ); 242 try { 243 $saved_card = $this->save_card($subscreasy_customer_id); 244 $this->log("save_card success: " . json_encode($saved_card)); 245 } catch (Exception $e) { 246 $this->log("save_card failure: " . $e); 247 } 248 249 $this->associate_saved_card_with_customer($saved_card->id); 250 $this->log("associate_saved_card_with_customer success"); 251 252 if ( $error ) { 253 wc_add_notice( $error_msg, 'error' ); 254 return; 255 } 256 257 do_action( 'wc_subscreasy_add_payment_method_' . $_POST['payment_method'] . '_success', $saved_card->id, $saved_card ); 258 259 return array( 260 'result' => 'success', 261 'redirect' => wc_get_endpoint_url( 'payment-methods' ), 262 ); 263 } 264 265 230 266 public function update_failing_payment_method( $subscription, $renewal_order ) { 231 267 update_post_meta( $subscription->get_id(), '_subscreasy_customer_id', $renewal_order->get_meta( '_subscreasy_customer_id', true ) ); -
subscreasy-payment-gateway-for-woocommerce/trunk/class-wc-gateway-subscreasy.php
r2836307 r2837637 36 36 'subscription_amount_changes', 37 37 'subscription_date_changes', 38 //'subscription_payment_method_change',38 'subscription_payment_method_change', 39 39 'subscription_payment_method_change_customer', 40 40 //'subscription_payment_method_change_admin', … … 418 418 // $ccNo = $this->testmode ? "9792030394440796" : ""; // paytr 419 419 $expMonth = $this->testmode ? "12" : ""; 420 $expYear = $this->testmode ? "202 0" : "";420 $expYear = $this->testmode ? "2024" : ""; 421 421 $cvv = $this->testmode ? "000" : ""; 422 422 … … 546 546 } 547 547 548 public function save_source($force_save_source = false, $existing_customer_id = null) { 549 $user_id = get_current_user_id(); 548 /** 549 * Associates saved card with the customer 550 */ 551 public function save_source() { 550 552 $card_id = wc_clean($_GET['cardId']); 551 553 $card = $this->get_saved_card($card_id); 552 553 554 $this->log("card id: " . $card->id . ", bin:" . $card->binNumber); 554 555 556 return $this->associate_saved_card_with_customer($card_id); 557 } 558 559 public function associate_saved_card_with_customer($card_id) { 560 $card = $this->get_saved_card($card_id); 561 562 $user_id = get_current_user_id(); 555 563 $customer = new WC_Subscreasy_Customer( $user_id ); 556 564 $wc_token_id = $customer->add_source($card); … … 625 633 626 634 if ($response["response"]["code"] != 200) { 627 $this->log( $response["response"]["code"]);635 $this->log("Response code: " . $response["response"]["code"]); 628 636 if ($response["response"]["code"] == 401) { 629 637 // TODO check api key … … 632 640 // TODO generic error handling e.g: $e = WC_Subscreasy_Util::translateException($responseResponse["code"]); 633 641 $errorMessage = $response["headers"]["x-subscreasy-error"]; 634 throw new Exception($errorMessage);642 return $this->request_failed(new Exception("$errorMessage"), null); 635 643 } 636 644 } … … 678 686 } else { 679 687 $this->log("Response received from " . $url . "\n" 680 . "body: " . $response2["body"] . "\n" . "response: " . $response2["response"]);688 . "response: " . json_encode($response2["response"]) . ", headers: " . json_encode($response2["headers"]) ); 681 689 } 682 690 } -
subscreasy-payment-gateway-for-woocommerce/trunk/readme.txt
r2836307 r2837637 1 1 === Subscreasy Payment Gateway for Woocommerce Subscriptions=== 2 2 Contributors: Subscreasy 3 Tags: credit card, stripe, paytr, payment, iyzico, sepa, sofort, bancontact, alipay, giropay, ideal, p24, woocommerce, automattic3 Tags: recurring payment, credit card, stripe, paytr, payment, iyzico, alipay, woocommerce, automattic 4 4 Requires at least: 4.4 5 5 Tested up to: 6.1.1 -
subscreasy-payment-gateway-for-woocommerce/trunk/wc-gateway-subscreasy.php
r2836309 r2837637 7 7 * Author: Subscreasy 8 8 * Author URI: https://www.subscreasy.com/ 9 * Version: 1. 0.109 * Version: 1.1.0 10 10 * Text Domain: wc-gateway-subscreasy 11 11 * Domain Path: /i18n/languages/
Note: See TracChangeset
for help on using the changeset viewer.