Adding isVendorInfoComplete method.
This commit is contained in:
parent
8da6751407
commit
be145261e0
2 changed files with 42 additions and 1 deletions
|
|
@ -194,6 +194,26 @@ sub getVendors {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 isVendorInfoComplete ( )
|
||||||
|
|
||||||
|
Returns a boolean indicating whether the payoutinformation entered by the vendor is complete.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub isVendorInfoComplete {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
my $complete =
|
||||||
|
defined $self->get( 'name' )
|
||||||
|
&& defined $self->get( 'userId' )
|
||||||
|
&& defined $self->get( 'preferredPaymentType' )
|
||||||
|
&& defined $self->get( 'paymentInformation' );
|
||||||
|
|
||||||
|
return $complete
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 new ( session, vendorId )
|
=head2 new ( session, vendorId )
|
||||||
|
|
||||||
Constructor. Returns a WebGUI::Shop::Vendor object.
|
Constructor. Returns a WebGUI::Shop::Vendor object.
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
my $tests = 44;
|
my $tests = 49;
|
||||||
plan tests => 1 + $tests;
|
plan tests => 1 + $tests;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -283,6 +283,27 @@ cmp_deeply(
|
||||||
'delete removed the correct vendor'
|
'delete removed the correct vendor'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# isVendorInfoComplete
|
||||||
|
#
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
my %completeProps = (
|
||||||
|
name => 'Esquerita',
|
||||||
|
userId => $fenceUser->userId,
|
||||||
|
preferredPaymentType => 'PayPal',
|
||||||
|
paymentInformation => 'esquerita@example.com',
|
||||||
|
);
|
||||||
|
$fence->update( { %completeProps } );
|
||||||
|
is( $fence->isVendorInfoComplete, 1, 'Vendor information is complete' );
|
||||||
|
|
||||||
|
foreach (keys %completeProps ) {
|
||||||
|
$fence->update( { %completeProps, $_ => undef } );
|
||||||
|
ok( !$fence->isVendorInfoComplete, "Vendor information is not complete without $_" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
undef $guard;
|
undef $guard;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue