155 lines
3.2 KiB
Perl
155 lines
3.2 KiB
Perl
package Peace::Model::Customer;
|
|
use v5.30.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Params::ValidationCompiler qw/validation_for/;
|
|
use Types::Standard qw/Str InstanceOf Bool/;
|
|
|
|
use DateTime;
|
|
|
|
{
|
|
my $validator = validation_for(
|
|
params => {
|
|
uuid => { type => Str, optional => 1 },
|
|
date_creation => { type => InstanceOf ['DateTime'], optional => 1 },
|
|
secret_bcrypt => { type => Str },
|
|
stripe_id => { type => Str, optional => 1 },
|
|
}
|
|
);
|
|
|
|
sub new {
|
|
my $class = shift;
|
|
my %params = $validator->(@_);
|
|
my $self = bless {%params}, $class;
|
|
return $self;
|
|
}
|
|
}
|
|
|
|
{
|
|
my $validator =
|
|
validation_for( params => [ { type => Str, optional => 1 } ] );
|
|
|
|
sub uuid {
|
|
my $self = shift;
|
|
if (@_) {
|
|
my ($new_uuid) = $validator->(@_);
|
|
$self->{uuid} = $new_uuid;
|
|
}
|
|
return $self->{uuid};
|
|
}
|
|
}
|
|
|
|
{
|
|
my $validator =
|
|
validation_for(
|
|
params => [ { type => InstanceOf ['DateTime'], optional => 1 } ] );
|
|
|
|
sub date_creation {
|
|
my $self = shift;
|
|
if (@_) {
|
|
my ($new_date_creation) = $validator->(@_);
|
|
$self->{date_creation} = $new_date_creation;
|
|
}
|
|
return $self->{date_creation};
|
|
}
|
|
}
|
|
|
|
{
|
|
my $validator =
|
|
validation_for( params => [ { type => Str, optional => 1 } ] );
|
|
|
|
sub secret_bcrypt {
|
|
my $self = shift;
|
|
if (@_) {
|
|
my ($new_secret_bcrypt) = $validator->(@_);
|
|
$self->{secret_bcrypt} = $new_secret_bcrypt;
|
|
}
|
|
return $self->{secret_bcrypt};
|
|
}
|
|
}
|
|
|
|
{
|
|
my $validator =
|
|
validation_for( params => [ { type => Str, optional => 1 } ] );
|
|
|
|
sub stripe_id {
|
|
my $self = shift;
|
|
if (@_) {
|
|
my ($new_stripe_id) = $validator->(@_);
|
|
$self->{stripe_id} = $new_stripe_id;
|
|
}
|
|
return $self->{stripe_id};
|
|
}
|
|
}
|
|
1;
|
|
=encoding utf8
|
|
|
|
=head1 NAME
|
|
|
|
Peace::Model::Customer - The customer object representation
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
my $customer = Peace::Model::Customer->new(
|
|
secret_bcrypt => $secret_bcrypt
|
|
);
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
Describes a customer of Peace capable of buy applications.
|
|
|
|
=head1 INSTANCE METHODS
|
|
|
|
Peace::Model::Customer implements the following instance methods:
|
|
|
|
=head2 new
|
|
|
|
my $customer = Peace::Model::Customer->new(
|
|
uuid => $uuid, # optional
|
|
date_creation => $date_creation, # optional
|
|
secret_bcrypt => $secret_bcrypt,
|
|
stripe_id => $stripe_id, # optional
|
|
);
|
|
|
|
Instances a new Peace::Model::Customer.
|
|
|
|
=head1 METHODS
|
|
|
|
Peace::Model::Customer implements the following methods:
|
|
|
|
=head2 uuid
|
|
|
|
my $uuid = $customer->uuid;
|
|
|
|
$customer->uuid($uuid);
|
|
|
|
Allows to retrive and set the customer uuid.
|
|
|
|
=head2 date_creation
|
|
|
|
my $date_creation = $customer->date_creation;
|
|
|
|
$customer->date_creation($date_creation);
|
|
|
|
Allows to retrive and set the customer date_creation.
|
|
|
|
=head2 secret_bcrypt
|
|
|
|
my $secret_bcrypt = $customer->secret_bcrypt;
|
|
|
|
$customer->secret_bcrypt($secret_bcrypt);
|
|
|
|
Allows to retrive and set the customer secret_bcrypt.
|
|
|
|
=head2 stripe_id
|
|
|
|
my $stripe_id = $customer->stripe_id;
|
|
|
|
$customer->stripe_id($stripe_id);
|
|
|
|
=head1 SEE ALSO
|
|
|
|
L<Peace::DAO::Customer>
|