package Test::ECS::Order;
use strict;
use warnings;
use ECS::Site;

sub shipping {
	my ($self, $args) = @_;
	return $self;
}

sub shipment {
	my ($self, $args) = @_;
	return $self;
}

sub scrub {
	#
}

sub status {
	my $self = shift;
	$self->{status} = $_[0] if @_;
	return $self->{_test}{options}{orderStatus} unless @_;
	$self->{_test}{options}{orderStatus} = shift();
}

sub orderID {
	my $self = shift;
	$self->{orderID}
}

sub ipaddress {
	my $self = shift;
	return $self->{_test}{options}{orderIpaddress} unless @_;
	$self->{_test}{options}{orderIpaddress} = shift;
}

sub user {
	my $self = shift;
	return $self->{_test}{options}{orderUser} unless @_;
	$self->{_test}{options}{orderUser} = shift;
}

sub logNote {
	my $self = shift;
	push @{ $self->{_test}{actions}{notes} }, shift();	
}

sub addNote {
	my $self = shift;
	push @{ $self->{_test}{actions}{notes} }, shift();	
}
sub save {
	my $self = shift;
	$self->{_test}{actions}{save}++;
	return if $self->{_test}{options}{failSave};
	return 1;
}

sub getPayments {
	my $self = shift;
	return ($self);
}

sub payment {
	my $self = shift;
	return $self;
}

sub automatePayments {
	my $self = shift;
	return if $self->{_test}{options}{paymentsFail};
	return if $self->{_test}{options}{paymentFraud};
	return 1;
}

sub reviewPaymentFraud {
	my $self = shift;
	return if $self->{_test}{options}{paymentsFail};
	return unless $self->{_test}{options}{paymentFraud};
	return 1;
}

sub customer {
	my $self = shift;
	return $self
}

sub site {
	my $self = shift;
	ECS::Site::fromName( $ECS::Site::PRIMARY_SITE );
}


1;
