/**
  * Get Member's Stripe Customer Object.
  *
  * @since  1.0.0
  * @internal
  *
  * @param MS_Model_Member $member The member.
  */
 public function find_customer($member)
 {
     $customer_id = $member->get_gateway_profile(self::ID, 'customer_id');
     $customer = null;
     if (!empty($customer_id)) {
         $customer = M2_Stripe_Customer::retrieve($customer_id);
         // Seems like the customer was manually deleted on Stripe website.
         if (isset($customer->deleted) && $customer->deleted) {
             $customer = null;
             $member->set_gateway_profile(self::ID, 'customer_id', '');
         }
     }
     return apply_filters('ms_gateway_stripe_find_customer', $customer, $member, $this);
 }
 /**
  * Save CIM profile IDs.
  *
  * @since  1.0.0
  * @param MS_Model_Member $member The member to save CIM IDs.
  * @param string $cim_profile_id The CIM profile ID to save.
  * @param string $cim_payment_profile_id The CIM payment profile ID to save.
  */
 protected function save_cim_profile($member, $cim_profile_id, $cim_payment_profile_id)
 {
     $member->set_gateway_profile($this->id, 'cim_profile_id', $cim_profile_id);
     $member->set_gateway_profile($this->id, 'cim_payment_profile_id', $cim_payment_profile_id);
     $this->save_card_info($member);
     $member->save();
     do_action('ms_gateway_authorize_save_cim_profile', $member, $cim_profile_id, $cim_payment_profile_id, $this);
 }