Add the organization part of an address into the transaction and transactionitem. Fixes bug #12088.
This commit is contained in:
parent
f8021c3d3d
commit
d5ba73fac7
5 changed files with 184 additions and 107 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
7.10.14
|
7.10.14
|
||||||
- fixed #12094: Cannot enter in Macros in URLs inside TinyMCE.
|
- fixed #12094: Cannot enter in Macros in URLs inside TinyMCE.
|
||||||
- rfe #12093: Remotely stored photos for Story assets
|
- rfe #12093: Remotely stored photos for Story assets
|
||||||
|
- fixed #12088: Organization left out of transaction
|
||||||
|
|
||||||
7.10.13
|
7.10.13
|
||||||
- added #12079: Carousel Auto Play
|
- added #12079: Carousel Auto Play
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ my $quiet; # this line required
|
||||||
my $session = start(); # this line required
|
my $session = start(); # this line required
|
||||||
|
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
|
addOrganizationsToTransaction($session);
|
||||||
|
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
@ -45,6 +46,18 @@ finish($session); # this line required
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Describe what our function does
|
||||||
|
sub addOrganizationsToTransaction {
|
||||||
|
my $session = shift;
|
||||||
|
print "\tAdd organization fields to the addresses stored in the Transaction and TransactionItem... " unless $quiet;
|
||||||
|
# and here's our code
|
||||||
|
$session->db->write('ALTER TABLE transaction ADD COLUMN shippingOrganization CHAR(35)');
|
||||||
|
$session->db->write('ALTER TABLE transaction ADD COLUMN paymentOrganization CHAR(35)');
|
||||||
|
$session->db->write('ALTER TABLE transactionItem ADD COLUMN shippingOrganization CHAR(35)');
|
||||||
|
print "DONE!\n" unless $quiet;
|
||||||
|
}
|
||||||
|
|
||||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,9 @@ A hash reference with the address properties.
|
||||||
|
|
||||||
sub formatAddress {
|
sub formatAddress {
|
||||||
my ($self, $address) = @_;
|
my ($self, $address) = @_;
|
||||||
my $formatted = $address->{name} . "<br />" . $address->{address1} . "<br />";
|
my $formatted = $address->{name} . "<br />";
|
||||||
|
$formatted .= $address->{organization} . "<br />" if ($address->{organization} ne "");
|
||||||
|
$formatted .= $address->{address1} . "<br />";
|
||||||
$formatted .= $address->{address2} . "<br />" if ($address->{address2} ne "");
|
$formatted .= $address->{address2} . "<br />" if ($address->{address2} ne "");
|
||||||
$formatted .= $address->{address3} . "<br />" if ($address->{address3} ne "");
|
$formatted .= $address->{address3} . "<br />" if ($address->{address3} ne "");
|
||||||
$formatted .= $address->{city} . ", ";
|
$formatted .= $address->{city} . ", ";
|
||||||
|
|
@ -415,26 +417,28 @@ sub getTransactionVars {
|
||||||
taxes => sprintf( "%.2f", $self->get('taxes') ),
|
taxes => sprintf( "%.2f", $self->get('taxes') ),
|
||||||
shippingPrice => sprintf( "%.2f", $self->get('shippingPrice') ),
|
shippingPrice => sprintf( "%.2f", $self->get('shippingPrice') ),
|
||||||
shippingAddress => $self->formatAddress( {
|
shippingAddress => $self->formatAddress( {
|
||||||
name => $self->get('shippingAddressName'),
|
name => $self->get('shippingAddressName'),
|
||||||
address1 => $self->get('shippingAddress1'),
|
organization => $self->get('shippingOrganization'),
|
||||||
address2 => $self->get('shippingAddress2'),
|
address1 => $self->get('shippingAddress1'),
|
||||||
address3 => $self->get('shippingAddress3'),
|
address2 => $self->get('shippingAddress2'),
|
||||||
city => $self->get('shippingCity'),
|
address3 => $self->get('shippingAddress3'),
|
||||||
state => $self->get('shippingState'),
|
city => $self->get('shippingCity'),
|
||||||
code => $self->get('shippingCode'),
|
state => $self->get('shippingState'),
|
||||||
country => $self->get('shippingCountry'),
|
code => $self->get('shippingCode'),
|
||||||
phoneNumber => $self->get('shippingPhoneNumber'),
|
country => $self->get('shippingCountry'),
|
||||||
|
phoneNumber => $self->get('shippingPhoneNumber'),
|
||||||
} ),
|
} ),
|
||||||
paymentAddress => $self->formatAddress({
|
paymentAddress => $self->formatAddress({
|
||||||
name => $self->get('paymentAddressName'),
|
name => $self->get('paymentAddressName'),
|
||||||
address1 => $self->get('paymentAddress1'),
|
organization => $self->get('paymentOrganization'),
|
||||||
address2 => $self->get('paymentAddress2'),
|
address1 => $self->get('paymentAddress1'),
|
||||||
address3 => $self->get('paymentAddress3'),
|
address2 => $self->get('paymentAddress2'),
|
||||||
city => $self->get('paymentCity'),
|
address3 => $self->get('paymentAddress3'),
|
||||||
state => $self->get('paymentState'),
|
city => $self->get('paymentCity'),
|
||||||
code => $self->get('paymentCode'),
|
state => $self->get('paymentState'),
|
||||||
country => $self->get('paymentCountry'),
|
code => $self->get('paymentCode'),
|
||||||
phoneNumber => $self->get('paymentPhoneNumber'),
|
country => $self->get('paymentCountry'),
|
||||||
|
phoneNumber => $self->get('paymentPhoneNumber'),
|
||||||
} ),
|
} ),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -444,15 +448,16 @@ sub getTransactionVars {
|
||||||
my $address = '';
|
my $address = '';
|
||||||
if ($self->get('shippingAddressId') ne $item->get('shippingAddressId')) {
|
if ($self->get('shippingAddressId') ne $item->get('shippingAddressId')) {
|
||||||
$address = $self->formatAddress({
|
$address = $self->formatAddress({
|
||||||
name => $item->get('shippingAddressName'),
|
name => $item->get('shippingAddressName'),
|
||||||
address1 => $item->get('shippingAddress1'),
|
organization => $self->get('shippingOrganization'),
|
||||||
address2 => $item->get('shippingAddress2'),
|
address1 => $item->get('shippingAddress1'),
|
||||||
address3 => $item->get('shippingAddress3'),
|
address2 => $item->get('shippingAddress2'),
|
||||||
city => $item->get('shippingCity'),
|
address3 => $item->get('shippingAddress3'),
|
||||||
state => $item->get('shippingState'),
|
city => $item->get('shippingCity'),
|
||||||
code => $item->get('shippingCode'),
|
state => $item->get('shippingState'),
|
||||||
country => $item->get('shippingCountry'),
|
code => $item->get('shippingCode'),
|
||||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
country => $item->get('shippingCountry'),
|
||||||
|
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -747,28 +752,30 @@ sub update {
|
||||||
$newProperties->{taxes} = $cart->calculateTaxes;
|
$newProperties->{taxes} = $cart->calculateTaxes;
|
||||||
|
|
||||||
my $billingAddress = $cart->getBillingAddress;
|
my $billingAddress = $cart->getBillingAddress;
|
||||||
$newProperties->{paymentAddressId} = $billingAddress->getId;
|
$newProperties->{paymentAddressId} = $billingAddress->getId;
|
||||||
$newProperties->{paymentAddressName} = $billingAddress->get('firstName') . " " . $billingAddress->get('lastName');
|
$newProperties->{paymentAddressName} = $billingAddress->get('firstName') . " " . $billingAddress->get('lastName');
|
||||||
$newProperties->{paymentAddress1} = $billingAddress->get('address1');
|
$newProperties->{paymentOrganization} = $billingAddress->get('organization');
|
||||||
$newProperties->{paymentAddress2} = $billingAddress->get('address2');
|
$newProperties->{paymentAddress1} = $billingAddress->get('address1');
|
||||||
$newProperties->{paymentAddress3} = $billingAddress->get('address3');
|
$newProperties->{paymentAddress2} = $billingAddress->get('address2');
|
||||||
$newProperties->{paymentCity} = $billingAddress->get('city');
|
$newProperties->{paymentAddress3} = $billingAddress->get('address3');
|
||||||
$newProperties->{paymentState} = $billingAddress->get('state');
|
$newProperties->{paymentCity} = $billingAddress->get('city');
|
||||||
$newProperties->{paymentCountry} = $billingAddress->get('country');
|
$newProperties->{paymentState} = $billingAddress->get('state');
|
||||||
$newProperties->{paymentCode} = $billingAddress->get('code');
|
$newProperties->{paymentCountry} = $billingAddress->get('country');
|
||||||
$newProperties->{paymentPhoneNumber} = $billingAddress->get('phoneNumber');
|
$newProperties->{paymentCode} = $billingAddress->get('code');
|
||||||
|
$newProperties->{paymentPhoneNumber} = $billingAddress->get('phoneNumber');
|
||||||
|
|
||||||
my $shippingAddress = $cart->getShippingAddress;
|
my $shippingAddress = $cart->getShippingAddress;
|
||||||
$newProperties->{shippingAddressId} = $shippingAddress->getId;
|
$newProperties->{shippingAddressId} = $shippingAddress->getId;
|
||||||
$newProperties->{shippingAddressName} = $shippingAddress->get('firstName') . " " . $shippingAddress->get('lastName');
|
$newProperties->{shippingAddressName} = $shippingAddress->get('firstName') . " " . $shippingAddress->get('lastName');
|
||||||
$newProperties->{shippingAddress1} = $shippingAddress->get('address1');
|
$newProperties->{shippingOrganization} = $shippingAddress->get('organization');
|
||||||
$newProperties->{shippingAddress2} = $shippingAddress->get('address2');
|
$newProperties->{shippingAddress1} = $shippingAddress->get('address1');
|
||||||
$newProperties->{shippingAddress3} = $shippingAddress->get('address3');
|
$newProperties->{shippingAddress2} = $shippingAddress->get('address2');
|
||||||
$newProperties->{shippingCity} = $shippingAddress->get('city');
|
$newProperties->{shippingAddress3} = $shippingAddress->get('address3');
|
||||||
$newProperties->{shippingState} = $shippingAddress->get('state');
|
$newProperties->{shippingCity} = $shippingAddress->get('city');
|
||||||
$newProperties->{shippingCountry} = $shippingAddress->get('country');
|
$newProperties->{shippingState} = $shippingAddress->get('state');
|
||||||
$newProperties->{shippingCode} = $shippingAddress->get('code');
|
$newProperties->{shippingCountry} = $shippingAddress->get('country');
|
||||||
$newProperties->{shippingPhoneNumber} = $shippingAddress->get('phoneNumber');
|
$newProperties->{shippingCode} = $shippingAddress->get('code');
|
||||||
|
$newProperties->{shippingPhoneNumber} = $shippingAddress->get('phoneNumber');
|
||||||
|
|
||||||
if ($cart->requiresShipping) {
|
if ($cart->requiresShipping) {
|
||||||
my $shipper = $cart->getShipper;
|
my $shipper = $cart->getShipper;
|
||||||
|
|
@ -803,7 +810,8 @@ sub update {
|
||||||
shippingCountry shippingCode shippingPhoneNumber shippingDriverId shippingDriverLabel notes
|
shippingCountry shippingCode shippingPhoneNumber shippingDriverId shippingDriverLabel notes
|
||||||
shippingPrice paymentAddressId paymentAddressName originatingTransactionId isRecurring
|
shippingPrice paymentAddressId paymentAddressName originatingTransactionId isRecurring
|
||||||
paymentAddress1 paymentAddress2 paymentAddress3 paymentCity paymentState paymentCountry paymentCode
|
paymentAddress1 paymentAddress2 paymentAddress3 paymentCity paymentState paymentCountry paymentCode
|
||||||
paymentPhoneNumber paymentDriverId paymentDriverLabel taxes shopCreditDeduction));
|
paymentPhoneNumber paymentDriverId paymentDriverLabel taxes shopCreditDeduction
|
||||||
|
shippingOrganization paymentOrganization));
|
||||||
foreach my $field (@fields) {
|
foreach my $field (@fields) {
|
||||||
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
||||||
}
|
}
|
||||||
|
|
@ -1125,15 +1133,16 @@ sub www_view {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>}. $i18n->get("shipping address") .q{</th><td>}. $transaction->formatAddress({
|
<th>}. $i18n->get("shipping address") .q{</th><td>}. $transaction->formatAddress({
|
||||||
name => $transaction->get('shippingAddressName'),
|
name => $transaction->get('shippingAddressName'),
|
||||||
address1 => $transaction->get('shippingAddress1'),
|
organization => $transaction->get('shippingOrganization'),
|
||||||
address2 => $transaction->get('shippingAddress2'),
|
address1 => $transaction->get('shippingAddress1'),
|
||||||
address3 => $transaction->get('shippingAddress3'),
|
address2 => $transaction->get('shippingAddress2'),
|
||||||
city => $transaction->get('shippingCity'),
|
address3 => $transaction->get('shippingAddress3'),
|
||||||
state => $transaction->get('shippingState'),
|
city => $transaction->get('shippingCity'),
|
||||||
code => $transaction->get('shippingCode'),
|
state => $transaction->get('shippingState'),
|
||||||
country => $transaction->get('shippingCountry'),
|
code => $transaction->get('shippingCode'),
|
||||||
phoneNumber => $transaction->get('shippingPhoneNumber'),
|
country => $transaction->get('shippingCountry'),
|
||||||
|
phoneNumber => $transaction->get('shippingPhoneNumber'),
|
||||||
}) .q{</td>
|
}) .q{</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -1144,15 +1153,16 @@ sub www_view {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>}. $i18n->get("payment address") .q{</th><td>}. $transaction->formatAddress({
|
<th>}. $i18n->get("payment address") .q{</th><td>}. $transaction->formatAddress({
|
||||||
name => $transaction->get('paymentAddressName'),
|
name => $transaction->get('paymentAddressName'),
|
||||||
address1 => $transaction->get('paymentAddress1'),
|
organization => $transaction->get('paymentOrganization'),
|
||||||
address2 => $transaction->get('paymentAddress2'),
|
address1 => $transaction->get('paymentAddress1'),
|
||||||
address3 => $transaction->get('paymentAddress3'),
|
address2 => $transaction->get('paymentAddress2'),
|
||||||
city => $transaction->get('paymentCity'),
|
address3 => $transaction->get('paymentAddress3'),
|
||||||
state => $transaction->get('paymentState'),
|
city => $transaction->get('paymentCity'),
|
||||||
code => $transaction->get('paymentCode'),
|
state => $transaction->get('paymentState'),
|
||||||
country => $transaction->get('paymentCountry'),
|
code => $transaction->get('paymentCode'),
|
||||||
phoneNumber => $transaction->get('paymentPhoneNumber'),
|
country => $transaction->get('paymentCountry'),
|
||||||
|
phoneNumber => $transaction->get('paymentPhoneNumber'),
|
||||||
}) .q{</td>
|
}) .q{</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -1195,15 +1205,16 @@ sub www_view {
|
||||||
else {
|
else {
|
||||||
$output .= q{
|
$output .= q{
|
||||||
<td class="smallAddress">}. $transaction->formatAddress({
|
<td class="smallAddress">}. $transaction->formatAddress({
|
||||||
name => $item->get('shippingAddressName'),
|
name => $item->get('shippingAddressName'),
|
||||||
address1 => $item->get('shippingAddress1'),
|
organization => $item->get('shippingOrganization'),
|
||||||
address2 => $item->get('shippingAddress2'),
|
address1 => $item->get('shippingAddress1'),
|
||||||
address3 => $item->get('shippingAddress3'),
|
address2 => $item->get('shippingAddress2'),
|
||||||
city => $item->get('shippingCity'),
|
address3 => $item->get('shippingAddress3'),
|
||||||
state => $item->get('shippingState'),
|
city => $item->get('shippingCity'),
|
||||||
code => $item->get('shippingCode'),
|
state => $item->get('shippingState'),
|
||||||
country => $item->get('shippingCountry'),
|
code => $item->get('shippingCode'),
|
||||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
country => $item->get('shippingCountry'),
|
||||||
|
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||||
}) .q{</td>
|
}) .q{</td>
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,8 @@ A hash reference that contains one of the following:
|
||||||
|
|
||||||
A reference to a WebGUI::Shop::CartItem. Alternatively you can manually pass in any of the following
|
A reference to a WebGUI::Shop::CartItem. Alternatively you can manually pass in any of the following
|
||||||
fields that would be created automatically by this object: assetId configuredTitle options shippingAddressId
|
fields that would be created automatically by this object: assetId configuredTitle options shippingAddressId
|
||||||
shippingName shippingAddress1 shippingAddress2 shippingAddress3 shippingCity shippingState shippingCountry
|
shippingName shippingAddress1 shippingOrganization shippingAddress2 shippingAddress3 shippingCity shippingState
|
||||||
shippingCode shippingPhoneNumber quantity price vendorId
|
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId
|
||||||
|
|
||||||
=head4 shippingTrackingNumber
|
=head4 shippingTrackingNumber
|
||||||
|
|
||||||
|
|
@ -288,6 +288,7 @@ sub update {
|
||||||
my $address = $item->getShippingAddress;
|
my $address = $item->getShippingAddress;
|
||||||
$newProperties->{ shippingAddressId } = $address->getId;
|
$newProperties->{ shippingAddressId } = $address->getId;
|
||||||
$newProperties->{ shippingAddressName } = join ' ', $address->get('firstName'), $address->get('lastName');
|
$newProperties->{ shippingAddressName } = join ' ', $address->get('firstName'), $address->get('lastName');
|
||||||
|
$newProperties->{ shippingOrganization } = $address->get('organization');
|
||||||
$newProperties->{ shippingAddress1 } = $address->get('address1');
|
$newProperties->{ shippingAddress1 } = $address->get('address1');
|
||||||
$newProperties->{ shippingAddress2 } = $address->get('address2');
|
$newProperties->{ shippingAddress2 } = $address->get('address2');
|
||||||
$newProperties->{ shippingAddress3 } = $address->get('address3');
|
$newProperties->{ shippingAddress3 } = $address->get('address3');
|
||||||
|
|
@ -309,7 +310,7 @@ sub update {
|
||||||
my @fields = (qw(assetId configuredTitle options shippingAddressId shippingTrackingNumber orderStatus
|
my @fields = (qw(assetId configuredTitle options shippingAddressId shippingTrackingNumber orderStatus
|
||||||
shippingName shippingAddress1 shippingAddress2 shippingAddress3 shippingCity shippingState
|
shippingName shippingAddress1 shippingAddress2 shippingAddress3 shippingCity shippingState
|
||||||
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId
|
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId
|
||||||
vendorPayoutStatus vendorPayoutAmount taxRate taxConfiguration));
|
vendorPayoutStatus vendorPayoutAmount taxRate taxConfiguration shippingOrganization));
|
||||||
foreach my $field (@fields) {
|
foreach my $field (@fields) {
|
||||||
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ use strict;
|
||||||
use lib "$FindBin::Bin/../lib";
|
use lib "$FindBin::Bin/../lib";
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
|
use Test::LongString;
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Shop::Transaction;
|
use WebGUI::Shop::Transaction;
|
||||||
|
|
@ -32,39 +33,41 @@ my $session = WebGUI::Test->session;
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
plan tests => 77; # Increment this number for each test you create
|
plan tests => 83; # Increment this number for each test you create
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# put your tests here
|
# put your tests here
|
||||||
|
|
||||||
my $transaction = WebGUI::Shop::Transaction->create($session,{
|
my $transaction = WebGUI::Shop::Transaction->create($session,{
|
||||||
amount => 40,
|
amount => 40,
|
||||||
shippingAddressId => 'xxx1',
|
shippingAddressId => 'xxx1',
|
||||||
shippingAddressName => 'abc',
|
shippingAddressName => 'abc',
|
||||||
shippingAddress1 => 'def',
|
shippingOrganization => 'Ship To Us',
|
||||||
shippingAddress2 => 'hij',
|
shippingAddress1 => 'def',
|
||||||
shippingAddress3 => 'lmn',
|
shippingAddress2 => 'hij',
|
||||||
shippingCity => 'opq',
|
shippingAddress3 => 'lmn',
|
||||||
shippingState => 'wxy',
|
shippingCity => 'opq',
|
||||||
shippingCountry => 'z',
|
shippingState => 'wxy',
|
||||||
shippingCode => '53333',
|
shippingCountry => 'z',
|
||||||
shippingPhoneNumber => '123456',
|
shippingCode => '53333',
|
||||||
shippingDriverId => 'xxx2',
|
shippingPhoneNumber => '123456',
|
||||||
shippingDriverLabel => 'foo',
|
shippingDriverId => 'xxx2',
|
||||||
shippingPrice => 5,
|
shippingDriverLabel => 'foo',
|
||||||
paymentAddressId => 'xxx3',
|
shippingPrice => 5,
|
||||||
paymentAddressName => 'abc1',
|
paymentAddressId => 'xxx3',
|
||||||
paymentAddress1 => 'def1',
|
paymentAddressName => 'abc1',
|
||||||
paymentAddress2 => 'hij1',
|
paymentOrganization => 'Pay To Us',
|
||||||
paymentAddress3 => 'lmn1',
|
paymentAddress1 => 'def1',
|
||||||
paymentCity => 'opq1',
|
paymentAddress2 => 'hij1',
|
||||||
paymentState => 'wxy1',
|
paymentAddress3 => 'lmn1',
|
||||||
paymentCountry => 'z1',
|
paymentCity => 'opq1',
|
||||||
paymentCode => '66666',
|
paymentState => 'wxy1',
|
||||||
paymentPhoneNumber => '908765',
|
paymentCountry => 'z1',
|
||||||
paymentDriverId => 'xxx4',
|
paymentCode => '66666',
|
||||||
paymentDriverLabel => 'kkk',
|
paymentPhoneNumber => '908765',
|
||||||
taxes => 7,
|
paymentDriverId => 'xxx4',
|
||||||
|
paymentDriverLabel => 'kkk',
|
||||||
|
taxes => 7,
|
||||||
});
|
});
|
||||||
addToCleanup($transaction);
|
addToCleanup($transaction);
|
||||||
|
|
||||||
|
|
@ -76,6 +79,7 @@ isa_ok($transaction->session, "WebGUI::Session");
|
||||||
# basic transaction properties
|
# basic transaction properties
|
||||||
is($transaction->get("amount"), 40, "set and get amount");
|
is($transaction->get("amount"), 40, "set and get amount");
|
||||||
is($transaction->get("shippingAddressId"), 'xxx1', "set and get shipping address id");
|
is($transaction->get("shippingAddressId"), 'xxx1', "set and get shipping address id");
|
||||||
|
is($transaction->get("shippingOrganization"), 'Ship To Us', "set and get shipping organization");
|
||||||
is($transaction->get("shippingAddressName"), 'abc', "set and get shipping address name");
|
is($transaction->get("shippingAddressName"), 'abc', "set and get shipping address name");
|
||||||
is($transaction->get("shippingAddress1"), 'def', "set and get shipping address 1");
|
is($transaction->get("shippingAddress1"), 'def', "set and get shipping address 1");
|
||||||
is($transaction->get("shippingAddress2"), 'hij', "set and get shipping address 2");
|
is($transaction->get("shippingAddress2"), 'hij', "set and get shipping address 2");
|
||||||
|
|
@ -90,6 +94,7 @@ is($transaction->get("shippingDriverLabel"), 'foo', "set and get shipping driver
|
||||||
is($transaction->get("shippingPrice"), 5, "set and get shipping price");
|
is($transaction->get("shippingPrice"), 5, "set and get shipping price");
|
||||||
is($transaction->get("paymentAddressId"), 'xxx3', "set and get payment address id");
|
is($transaction->get("paymentAddressId"), 'xxx3', "set and get payment address id");
|
||||||
is($transaction->get("paymentAddressName"), 'abc1', "set and get payment address name");
|
is($transaction->get("paymentAddressName"), 'abc1', "set and get payment address name");
|
||||||
|
is($transaction->get("paymentOrganization"), 'Pay To Us', "set and get payment organization");
|
||||||
is($transaction->get("paymentAddress1"), 'def1', "set and get payment address 1");
|
is($transaction->get("paymentAddress1"), 'def1', "set and get payment address 1");
|
||||||
is($transaction->get("paymentAddress2"), 'hij1', "set and get payment address 2");
|
is($transaction->get("paymentAddress2"), 'hij1', "set and get payment address 2");
|
||||||
is($transaction->get("paymentAddress3"), 'lmn1', "set and get payment address 3");
|
is($transaction->get("paymentAddress3"), 'lmn1', "set and get payment address 3");
|
||||||
|
|
@ -128,6 +133,7 @@ my $item = $transaction->addItem({
|
||||||
assetId => 'a',
|
assetId => 'a',
|
||||||
configuredTitle => 'b',
|
configuredTitle => 'b',
|
||||||
options => {color=>'blue'},
|
options => {color=>'blue'},
|
||||||
|
shippingOrganization => 'organized',
|
||||||
shippingAddressId => 'c',
|
shippingAddressId => 'c',
|
||||||
shippingName => 'd',
|
shippingName => 'd',
|
||||||
shippingAddress1 => 'e',
|
shippingAddress1 => 'e',
|
||||||
|
|
@ -162,6 +168,7 @@ is($item->get("shippingPhoneNumber"), 'l', "set and get shipping phone number");
|
||||||
is($item->get("quantity"), 5, "set and get quantity");
|
is($item->get("quantity"), 5, "set and get quantity");
|
||||||
is($item->get("price"), 33, "set and get price");
|
is($item->get("price"), 33, "set and get price");
|
||||||
is($item->get('taxRate'), 19, 'set and get taxRate' );
|
is($item->get('taxRate'), 19, 'set and get taxRate' );
|
||||||
|
is($item->get('shippingOrganization'), 'organized', 'set and get shipping organization' );
|
||||||
|
|
||||||
$item->update({
|
$item->update({
|
||||||
shippingTrackingNumber => 'adfs',
|
shippingTrackingNumber => 'adfs',
|
||||||
|
|
@ -283,6 +290,50 @@ $session->setting->set('shopReceiptEmailTemplateId', $templateId);
|
||||||
WebGUI::Test->unmockAssetId($templateId);
|
WebGUI::Test->unmockAssetId($templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# formatAddress
|
||||||
|
#
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
my $formattedAddress = $transaction->formatAddress({
|
||||||
|
name => 'Red',
|
||||||
|
address1 => 'Cell Block #5',
|
||||||
|
city => 'Shawshank',
|
||||||
|
state => 'MN',
|
||||||
|
code => 55555,
|
||||||
|
country => 'USA',
|
||||||
|
phoneNumber => '555.555.5555',
|
||||||
|
});
|
||||||
|
|
||||||
|
is_string $formattedAddress, 'Red<br />Cell Block #5<br />Shawshank, MN 55555<br />USA<br />555.555.5555', 'formatAddress: a regular address';
|
||||||
|
|
||||||
|
my $formattedAddress = $transaction->formatAddress({
|
||||||
|
name => 'Red',
|
||||||
|
address1 => 'Cell Block #5',
|
||||||
|
address2 => 'Next to Andy',
|
||||||
|
city => 'Shawshank',
|
||||||
|
state => 'MN',
|
||||||
|
code => 55555,
|
||||||
|
country => 'USA',
|
||||||
|
phoneNumber => '555.555.5555',
|
||||||
|
});
|
||||||
|
|
||||||
|
is_string $formattedAddress, 'Red<br />Cell Block #5<br />Next to Andy<br />Shawshank, MN 55555<br />USA<br />555.555.5555', '... a regular address with address2';
|
||||||
|
|
||||||
|
my $formattedAddress = $transaction->formatAddress({
|
||||||
|
name => 'Red',
|
||||||
|
organization => 'Shawshank Prison',
|
||||||
|
address1 => 'Cell Block #5',
|
||||||
|
city => 'Shawshank',
|
||||||
|
state => 'MN',
|
||||||
|
code => 55555,
|
||||||
|
country => 'USA',
|
||||||
|
phoneNumber => '555.555.5555',
|
||||||
|
});
|
||||||
|
|
||||||
|
is_string $formattedAddress, 'Red<br />Shawshank Prison<br />Cell Block #5<br />Shawshank, MN 55555<br />USA<br />555.555.5555', '... a regular address with address2';
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# delete
|
# delete
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue