Checking in commerce stuff

This commit is contained in:
Martin Kamerbeek 2005-04-25 22:33:57 +00:00
parent d0374dcca3
commit 6e4cefc7c0
14 changed files with 1006 additions and 44 deletions

View file

@ -95,7 +95,7 @@ sub cancelRecurringPayment {
sub connectionError {
my ($self, $resultCode);
$self = shift;
return $self->resultMessage if ($self->{_connectionError});
return undef;
}
@ -555,7 +555,7 @@ sub getRecurringPaymentStatus {
sub errorCode {
my ($self, $resultCode);
$self = shift;
$resultCode = $self->{_response}->{Status};
return $resultCode unless ($resultCode eq 'OK');
return undef;
@ -633,6 +633,18 @@ sub resultMessage {
return $self->{_response}->{ErrorMessage};
}
#-------------------------------------------------------------------
sub shippingCost {
my $self = shift;
$self->{_shipping}->{cost} = shift;
}
#-------------------------------------------------------------------
sub shippingDescription {
my $self = shift;
$self->{_shipping}->{description} = shift;
}
#-------------------------------------------------------------------
sub submit {
my ($self, $xml, $items);
@ -703,6 +715,15 @@ my %transactionData = %{$self->{_transactionParams}};
</Item>\n";
}
if ($self->{_shipping}->{cost}) {
$xml .=
" <Item>
<Description>Shipping cost. ".$self->{_shipping}->{description}."</Description>
<Cost>".sprintf('%.2f', $self->{_shipping}->{cost})."</Cost>
<Qty>1</Qty>
</Item>\n";
};
$xml .=
" </OrderItems>
</TransactionData>
@ -752,6 +773,7 @@ sub supports {
#-------------------------------------------------------------------
sub transactionCompleted {
my ($self) = shift;
return ($self->{_response}->{Status} eq 'OK');
}
@ -759,7 +781,7 @@ sub transactionCompleted {
sub transactionError {
my ($self, $resultCode);
$self = shift;
$resultCode = $self->resultCode;
return $self->resultMessage if ($resultCode ne 'OK');
return undef;