v1.7 beta.1

This commit is contained in:
carodej
2020-07-16 10:26:41 +02:00
parent 6b36480097
commit eeada5468b
36 changed files with 923 additions and 42 deletions
+24
View File
@@ -86,6 +86,30 @@ class StripeService
}
}
/**
* Register new payment method
*
* @param $request
* @param $user
* @return mixed
*/
public function registerNewPaymentMethod($request, $user)
{
// Clear cached payment methods
cache_forget_many([
'payment-methods-user-' . $user->id,
'default-payment-methods-user-' . $user->id
]);
// Set new payment method
$user->addPaymentMethod($request->token)->paymentMethod;
// Set new default payment
if ($request->default) {
$user->updateDefaultPaymentMethod($request->token)->paymentMethod;
}
}
/**
* Create new subscription or replace by new subscription
*