Now with subscription table.

master
Manager Bot 3 years ago
parent 498703fada
commit 2eedb8114a
  1. 5
      Web/lib/MJB/Web/Controller/Auth.pm
  2. 7
      Web/lib/MJB/Web/Controller/UserSettings.pm

@ -254,9 +254,12 @@ sub do_register_stripe ( $c ) {
}); });
$person->new_related('auth_password', {})->set_password($c->param('password')); $person->new_related('auth_password', {})->set_password($c->param('password'));
# Create the subscription.
$person->subscription->insert;
# Notify the system about the new account. # Notify the system about the new account.
$c->db->system_notes->create({ $c->db->system_notes->create({
source => 'User Registration (Open)', source => 'User Registration (Stripe)',
content => 'An account was created for ' . $person->email, content => 'An account was created for ' . $person->email,
}); });

@ -132,10 +132,9 @@ sub subscription ($c) {
# Store the customer id along side the user in the DB. # Store the customer id along side the user in the DB.
if ( $customer_id ) { if ( $customer_id ) {
$c->db->storage->schema->txn_do( sub { $c->db->storage->schema->txn_do( sub {
$c->stash->{person}->stripe_customer_id( $customer_id ); $c->stash->{person}->subscription->stripe_customer_id( $customer_id );
$c->stash->{person}->is_subscribed( 1 ); $c->stash->{person}->subscription->is_valid( 1 );
$c->stash->{person}->is_enabled( 1 ); $c->stash->{person}->subscription->update;
$c->stash->{person}->update;
}); });
} }

Loading…
Cancel
Save