Adding the getCart method to PayDriver.pm
This commit is contained in:
parent
7c184b26c3
commit
c2c258400d
2 changed files with 28 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ use Tie::IxHash;
|
|||
use WebGUI::International;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Exception::Shop;
|
||||
use WebGUI::Shop::Cart;
|
||||
use JSON;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -237,6 +238,23 @@ sub getButton {
|
|||
my $self = shift;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getCart ( )
|
||||
|
||||
Returns the WebGUI::Shop::Cart object for the current session.
|
||||
|
||||
=cut
|
||||
|
||||
sub getCart {
|
||||
my $self = shift;
|
||||
|
||||
my $cart = WebGUI::Shop::Cart->getCartBySession( $self->session );
|
||||
|
||||
return $cart;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ( )
|
||||
|
|
@ -327,7 +345,6 @@ sub new {
|
|||
croak "Somehow, the options property of this object, $paymentGatewayId, got broken in the db"
|
||||
unless exists $properties->{options} and $properties->{options};
|
||||
|
||||
#### TODO: Fix deprecated json sub
|
||||
my $options = from_json($properties->{options});
|
||||
|
||||
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $properties->{ label }, $options);
|
||||
|
|
@ -366,7 +383,6 @@ flattened into JSON and stored in the database as text. There is no content che
|
|||
|
||||
=cut
|
||||
|
||||
#### TODO: decide on what set() sets. Ie. does it only set options, or also label?
|
||||
sub set {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 45;
|
||||
my $tests = 46;
|
||||
plan tests => 1 + $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -273,6 +273,15 @@ $optionsCopy->{label} = 'And now for something completely different';
|
|||
isnt ($driver->get('label'), 'And now for something completely different',
|
||||
'hashref returned by get() is a copy of the internal hashref');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# getCart
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
my $cart = $driver->getCart;
|
||||
isa_ok ($cart, 'WebGUI::Shop::Cart', 'getCart returns an instantiated WebGUI::Shop::Cart object');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# getEditForm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue