diff --git a/Supporters/lib/Supporters.pm b/Supporters/lib/Supporters.pm index 8582415..90c5ab7 100644 --- a/Supporters/lib/Supporters.pm +++ b/Supporters/lib/Supporters.pm @@ -850,7 +850,8 @@ sub fulfillRequest($$) { die "fulfillRequest: donorId, \"$donorId\" not found in supporter database" unless $self->_verifyId($donorId); die "fulfillRequest: undefined who" unless defined $params->{who}; - die "fulfillRequest: undefined requestType" unless defined $params->{requestType}; + die "fulfillRequest: both requestType and requestTypeId undefined" + unless defined $params->{requestType} or defined $params->{requestTypeId}; my $req = $self->getRequest($params); return undef if not defined $req; diff --git a/Supporters/t/Supporters.t b/Supporters/t/Supporters.t index 2ed99b8..d4cd390 100644 --- a/Supporters/t/Supporters.t +++ b/Supporters/t/Supporters.t @@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 158; +use Test::More tests => 160; use Test::Exception; use Scalar::Util qw(looks_like_number reftype); @@ -360,6 +360,16 @@ lives_ok { $lookedUpFulfillmentId = $sp->fulfillRequest( { donorId => $drapperId is($lookedUpFulfillmentId, $fulfillRequestId, "fulfillRequest: ... but, rather, returns the same value from the previous fulfillRequest() call."); + +my $newFRID; +lives_ok { $newFRID = $sp->fulfillRequest( { donorId => $drapperId, + requestTypeId => $tShirt0RequestTypeId, who => 'john', + how => "mailed" }); } + "fulfillRequest: succeeds for existing request, using requestTypeId"; + +ok( (defined $newFRID and looks_like_number($newFRID) and $newFRID > 0 and ($newFRID != $fulfillRequestId)), + "fulfillRequest: id returned on successful fulfillRequest() is a number and is not the one returned by previous"); + =item getRequest =cut