Google-Checkout
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Google/Checkout/Command/RefundOrder.pm view on Meta::CPAN
=item get_comment
Returns the comment.
=item set_comment COMMENT
Sets the comment.
=item get_reason
Returns the reason for the refund.
=item set_reason REASON
Sets the reason for the refund.
=item to_xml
Return the XML that will be sent to Google Checkout. Note that
this function should not be used directly. Instead, it's called
indirectly by the C<Google::Checkout::General::GCO> object internally.
=back
=cut
=head1 COPYRIGHT
Copyright 2006 Google. All rights reserved.
=head1 SEE ALSO
Google::Checkout::Command::GCOCommand
=cut
#--
#-- <refund-order>
#--
use strict;
use warnings;
use Google::Checkout::General::Error;
use Google::Checkout::XML::Constants;
use Google::Checkout::General::Util qw/is_gco_error/;
use Google::Checkout::Command::GCOCommand;
our @ISA = qw/Google::Checkout::Command::GCOCommand/;
sub new
{
my ($class, %args) = @_;
my $self = $class->SUPER::new(%args, name => Google::Checkout::XML::Constants::REFUND_ORDER);
$self->{amount} = $args{amount} || 0;
$self->{comment} = $args{comment} || '';
$self->{reason} = $args{reason} || '';
return bless $self => $class;
}
sub get_amount
{
my ($self) = @_;
return $self->{amount};
}
sub set_amount
{
my ($self, $amount) = @_;
$self->{amount} = $amount || 0;
}
sub get_comment
{
my ($self) = @_;
return $self->{comment};
}
sub set_comment
{
my ($self, $comment) = @_;
$self->{comment} = $comment if $comment;
}
sub get_reason
{
my ($self) = @_;
return $self->{reason};
}
sub set_reason
{
my ($self, $reason) = @_;
$self->{reason} = $reason if $reason;
}
sub to_xml
{
my ($self, %args) = @_;
return Google::Checkout::General::Error(
@{$Google::Checkout::General::Error::ERRORS{REQUIRE_REASON_FOR_REFUND}})
unless $self->get_reason;
my $code = $self->SUPER::to_xml(%args);
return $code if is_gco_error($code);
if ($self->get_amount)
{
my $sstring = Google::Checkout::XML::Constants::CURRENCY_SUPPORTED;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.217 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )