diff --git a/docs/upgrades/upgrade_7.5.10-7.5.11.pl b/docs/upgrades/upgrade_7.5.10-7.5.11.pl
index d1fc1835a..fe21a1986 100644
--- a/docs/upgrades/upgrade_7.5.10-7.5.11.pl
+++ b/docs/upgrades/upgrade_7.5.10-7.5.11.pl
@@ -532,8 +532,8 @@ sub convertTransactionLog {
shippingCode varchar(35),
shippingPhoneNumber varchar(35),
shippingTrackingNumber varchar(255),
- shippingStatus varchar(35) not null default 'NotShipped',
- shippingDate datetime,
+ orderStatus varchar(35) not null default 'NotShipped',
+ lastUpdated datetime,
quantity int not null default 1,
price float,
vendorId varchar(22) binary not null default 'defaultvendor000000000',
@@ -566,8 +566,8 @@ sub convertTransactionLog {
configuredTitle => $oldItem->{itemName},
options => '{}',
shippingTrackingNumber => $oldTranny->{trackingNumber},
- shippingStatus => $oldTranny->{shippingStatus},
- shippingDate => $oldTranny->{completionDate},
+ orderStatus => $oldTranny->{shippingStatus},
+ lastUpdated => $oldTranny->{completionDate},
quantity => $oldItem->{quantity},
price => $oldItem->{amount},
vendorId => "defaultvendor000000000",
diff --git a/lib/WebGUI/Content/Shop.pm b/lib/WebGUI/Content/Shop.pm
index 2ddebabd0..c69d834d9 100644
--- a/lib/WebGUI/Content/Shop.pm
+++ b/lib/WebGUI/Content/Shop.pm
@@ -63,7 +63,9 @@ The content handler for this package.
sub handler {
my ($session) = @_;
my $output = undef;
- my $function = "www_".$session->form->get("shop");
+ my $shop = $session->form->get("shop");
+ return $output unless ($shop);
+ my $function = "www_".$shop;
if ($function ne "www_" && (my $sub = __PACKAGE__->can($function))) {
$output = $sub->($session);
}
diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm
index 88dbeb738..3e47ba4e3 100644
--- a/lib/WebGUI/Shop/Cart.pm
+++ b/lib/WebGUI/Shop/Cart.pm
@@ -773,9 +773,7 @@ sub www_viewItem {
if (WebGUI::Error->caught()) {
return $self->www_view;
}
- my $sku = $item->getSku;
- $sku->applyOptions($item->get("options"));
- return $sku->www_view;
+ return $item->getSku->www_view;
}
diff --git a/lib/WebGUI/Shop/CartItem.pm b/lib/WebGUI/Shop/CartItem.pm
index e3e5b0375..d9893a7be 100644
--- a/lib/WebGUI/Shop/CartItem.pm
+++ b/lib/WebGUI/Shop/CartItem.pm
@@ -160,7 +160,6 @@ Returns the WebGUI::Shop::Address object that is attached to this item for shipp
sub getShippingAddress {
my $self = shift;
my $addressId = $self->get("shippingAddressId") || $self->cart->get("shippingAddressId");
- $self->cart->session->errorHandler->warn("address id: ". $addressId);
return $self->cart->getAddressBook->getAddress($addressId);
}
diff --git a/lib/WebGUI/Shop/PayDriver.pm b/lib/WebGUI/Shop/PayDriver.pm
index 7e141fe96..18b407df9 100644
--- a/lib/WebGUI/Shop/PayDriver.pm
+++ b/lib/WebGUI/Shop/PayDriver.pm
@@ -496,7 +496,7 @@ sub processTransaction {
my $cart = $self->getCart;
my $transaction = WebGUI::Shop::Transaction->create($self->session,{
paymentMethod => $self,
-# paymentAddress => $paymentAddress,
+ paymentAddress => $paymentAddress,
cart => $cart,
});
my ($success, $transactionCode, $statusCode, $statusMessage) = $self->processPayment( $transaction );
diff --git a/lib/WebGUI/Shop/PayDriver/Cash.pm b/lib/WebGUI/Shop/PayDriver/Cash.pm
index 2ac67ace1..161f2bfe5 100644
--- a/lib/WebGUI/Shop/PayDriver/Cash.pm
+++ b/lib/WebGUI/Shop/PayDriver/Cash.pm
@@ -18,15 +18,6 @@ sub canCheckoutCart {
return 1;
}
-#-------------------------------------------------------------------
-sub credentialsOkay {
- my $self = shift;
-
- return 0 unless $self->getBillingAddress;
-
- return 1;
-}
-
#-------------------------------------------------------------------
sub definition {
@@ -73,15 +64,11 @@ sub definition {
}
#-------------------------------------------------------------------
-sub getBillingAddress {
- my $self = shift;
- my $session = $self->session;
-
- my $addressId = $session->scratch->get('ShopPayDriverCash_billingAddress');
+sub getAddress {
+ my ($self, $addressId) = @_;
if ($addressId) {
return $self->getCart->getAddressBook->getAddress( $addressId );
}
-
# No billing address selected yet so return undef.
return undef;
}
@@ -154,9 +141,9 @@ sub www_displayStatus {
#-------------------------------------------------------------------
sub www_getCredentials {
- my $self = shift;
+ my ($self, $addressId) = @_;
my $session = $self->session;
-
+ $addressId = $session->form->process('addressId') if ($addressId eq "");
# Generate the json string that defines where the address book posts the selected address
my $callbackParams = {
url => $session->url->page,
@@ -178,11 +165,7 @@ sub www_getCredentials {
. WebGUI::Form::formFooter( $session);
# Get billing address
- my $billingAddress = eval { $self->getBillingAddress };
- if ( WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
- # The stored address id is invalid, so remove it
- $session->scratch->delete('ShopPayDriverCash_billingAddress');
- }
+ my $billingAddress = eval { $self->getAddress($addressId) };
my $billingAddressHtml;
if ($billingAddress) {
@@ -192,6 +175,7 @@ sub www_getCredentials {
# Generate 'Proceed' button
my $proceedButton = WebGUI::Form::formHeader( $session )
. $self->getDoFormTags('pay')
+ . WebGUI::Form::hidden($session, {name=>"addressId", value=>$addressId})
. WebGUI::Form::submit( $session, { value => 'Pay' } )
. WebGUI::Form::formFooter( $session);
@@ -211,7 +195,8 @@ sub www_pay {
return "" unless $self->canCheckoutCart;
# Make sure all required credentials have been supplied
- return $self->www_getCredentials unless $self->credentialsOkay;
+ my $billingAddress = $self->getAddress( $session->form->process('addressId') );
+ return $self->www_getCredentials unless $billingAddress;
# Generate a receipt and send it if enabled.
if ( $self->get('sendReceipt') ) {
@@ -233,7 +218,6 @@ sub www_pay {
$receipt->queue;
}
- my $billingAddress = $self->getBillingAddress( $session->scratch->get( 'ShopPayDriverCash_billingAddressId' ) );
# Complete the transaction
my $transaction = $self->processTransaction( $billingAddress );
@@ -246,10 +230,7 @@ sub www_pay {
sub www_setBillingAddress {
my $self = shift;
my $session = $self->session;
-
- $session->scratch->set( 'ShopPayDriverCash_billingAddress', $session->form->process('addressId') );
-
- return $self->www_getCredentials;
+ return $self->www_getCredentials($session->form->process('addressId'));
}
1;
diff --git a/lib/WebGUI/Shop/PayDriver/ITransact.pm b/lib/WebGUI/Shop/PayDriver/ITransact.pm
index 1963b41d9..16f2a7c0f 100644
--- a/lib/WebGUI/Shop/PayDriver/ITransact.pm
+++ b/lib/WebGUI/Shop/PayDriver/ITransact.pm
@@ -124,22 +124,22 @@ sub _generatePaymentRequestXML {
# Check if recurring payments have a unique transaction
#### TODO: Throw the correct Exception Class
WebGUI::Error::InvalidParam->throw( error => 'Recurring transaction mixed with other transactions' )
- if ( (scalar @{ $items } > 1) && (grep { $_->get('isRecurring') } @{ $items }) );
+ if ( (scalar @{ $items } > 1) && (grep { $_->getSku->isRecurring } @{ $items }) );
- foreach my $item (@{ $transaction->getItems }) {
+ foreach my $item (@{ $items }) {
my $sku = $item->getSku;
####TODO: How to handle intial payment?
- if ( $item->get('isRecurring') ) {
- $recurringData->{ RecurRecipe } = $self->resolveRecurRecipe( $sku->get('recurInterval') );
+ if ( $sku->isRecurring ) {
+ $recurringData->{ RecurRecipe } = $self->resolveRecurRecipe( $sku->getRecurInterval );
$recurringData->{ RecurReps } = 99999;
- $recurringData->{ RecurTotal } = $sku->getPrice;
- $recurringData->{ RecurDesc } = $sku->get('title');
+ $recurringData->{ RecurTotal } = $item->get('price');
+ $recurringData->{ RecurDesc } = $item->get('configuredTitle');
}
push @{ $orderItems->{ Item } }, {
- Description => $sku->get('title'),
- Cost => $sku->getPrice,
+ Description => $item->get('configuredTitle'),
+ Cost => $item->get('price'),
Qty => $item->get('quantity'),
}
}
diff --git a/lib/WebGUI/Shop/Transaction.pm b/lib/WebGUI/Shop/Transaction.pm
index c377fa303..934081d5e 100644
--- a/lib/WebGUI/Shop/Transaction.pm
+++ b/lib/WebGUI/Shop/Transaction.pm
@@ -649,8 +649,11 @@ sub www_view {
#render page
my $output = q{
};
unless ($print) {
$output .= q{
@@ -658,13 +661,36 @@ sub www_view {
};
}
$output .= q{
-
+
- | }. $i18n->get("transaction id") .q{ | }. $transaction->getId .q{ |
+ }. $i18n->get("transaction id") .q{ | }. $transaction->getId . ' '. $transaction->get('transactionCode').q{ |
| }. $i18n->get("order number") .q{ | }. $transaction->get('orderNumber') .q{ |
+
+ | }. $i18n->get("date") .q{ | }. $transaction->get('dateOfPurchase') .q{ |
+
+
+ | }. $i18n->get("username") .q{ | }. $transaction->get('username') .q{ |
+
+
+ | }. $i18n->get("price") .q{ | }. sprintf("%.2f", $transaction->get('amount')) .q{ |
+
+
+ | }. $i18n->get("in shop credit used") .q{ | }. sprintf("%.2f", $transaction->get('shopCreditDeduction')) .q{ |
+
+
+ | }. $i18n->get("taxes") .q{ | }. sprintf("%.2f", $transaction->get('taxes')) .q{ |
+
+
+
+
+ | }. $i18n->get("shipping method") .q{ | }. $transaction->get('shippingDriverLabel') .q{ |
+
+
+ | }. $i18n->get("shipping amount") .q{ | }. sprintf("%.2f", $transaction->get('shippingPrice')) .q{ |
+
| }. $i18n->get("shipping address") .q{ | }. $transaction->formatAddress({
name => $transaction->get('shippingAddressName'),
@@ -678,6 +704,14 @@ sub www_view {
phoneNumber => $transaction->get('shippingPhoneNumber'),
}) .q{ |
+
+
+
+ | }. $i18n->get("payment method") .q{ | }. $transaction->get('paymentDriverLabel') .q{ |
+
+
+ | }. $i18n->get("status message") .q{ | }. $transaction->get('statusCode') .': '.$transaction->get('statusMessage').q{ |
+
| }. $i18n->get("payment address") .q{ | }. $transaction->formatAddress({
name => $transaction->get('paymentAddressName'),
@@ -691,10 +725,8 @@ sub www_view {
phoneNumber => $transaction->get('paymentPhoneNumber'),
}) .q{ |
-
- | }. $i18n->get("price") .q{ | }. sprintf("%.2f", $transaction->get('amount')) .q{ |
-
+
};
# item detail
@@ -702,13 +734,14 @@ sub www_view {
- | Item |
- Price |
- Quantity |
- Status |
- Address |
- Date |
- Tracking # |
+ }.$i18n->get('date').q{ |
+ }.$i18n->get('item').q{ |
+ }.$i18n->get('price').q{ |
+ }.$i18n->get('quantity').q{ |
+ }.$i18n->get('shipping address').q{ |
+ }.$i18n->get('order status').q{ |
+ }.$i18n->get('tracking number').q{ |
+ }.$i18n->get('manage').q{ |
@@ -717,10 +750,11 @@ sub www_view {
my $sku = $item->getSku;
$output .= q{
+
};
}
@@ -752,40 +803,41 @@ sub www_view {
};
# render data table
- $output .= <
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.EnhanceFromMarkup = new function() {
var myColumnDefs = [
- {key:"item",sortable:true},
- {key:"price",sortable:true},
- {key:"quantity",formatter:YAHOO.widget.DataTable.formatNumber,sortable:true},
- {key:"status",sortable:true},
- {key:"address"},
- {key:"date",sortable:true,formatter:YAHOO.widget.DataTable.formatDate},
- {key:"tracking"}
+ {key:"date",sortable:true,label:'|.$i18n->get('date').q|'},
+ {key:"item",sortable:true,label:'|.$i18n->get('item').q|'},
+ {key:"price",sortable:true,label:'|.$i18n->get('price').q|'},
+ {key:"quantity",formatter:YAHOO.widget.DataTable.formatNumber,sortable:true,label:'|.$i18n->get('quantity').q|'},
+ {key:"address",label:'|.$i18n->get('shipping address').q|'},
+ {key:"status",sortable:true,label:'|.$i18n->get('order status').q|'},
+ {key:"tracking",label:'|.$i18n->get('tracking number').q|'},
+ {key:"manage",label:'|.$i18n->get('manage').q|'}
];
-
this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("transactionItems"));
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
this.myDataSource.responseSchema = {
fields: [
+ {key:"date"},
{key:"item"},
{key:"price", parser:this.parseNumberFromCurrency},
{key:"quantity", parser:YAHOO.util.DataSource.parseNumber},
- {key:"status"},
{key:"address"},
- {key:"date", parser:YAHOO.util.DataSource.parseDate},
- {key:"tracking"}
+ {key:"status"},
+ {key:"tracking"},
+ {key:"manage"}
]
};
this.myDataTable = new YAHOO.widget.DataTable("transactionItemWrapper", myColumnDefs, this.myDataSource,{});
};
-});
-
-STOP
+ });
+
+ |;
# send output
if ($print) {
@@ -794,4 +846,23 @@ STOP
return $admin->getAdminConsole->render($output, $i18n->get('transactions'));
}
+
+#-------------------------------------------------------------------
+
+=head2 www_viewItem ( )
+
+Displays the configured item.
+
+=cut
+
+sub www_viewItem {
+ my ($class, $session) = @_;
+ my $self = __PACKAGE__->new($session, $session->form->get("transactionId"));
+ my $item = eval { $self->getItem($session->form->get("itemId")) };
+ if (WebGUI::Error->caught()) {
+ return $class->www_view($session);
+ }
+ return $item->getSku->www_view;
+}
+
1;
diff --git a/lib/WebGUI/Shop/TransactionItem.pm b/lib/WebGUI/Shop/TransactionItem.pm
index 033c99dbf..73e0a4117 100644
--- a/lib/WebGUI/Shop/TransactionItem.pm
+++ b/lib/WebGUI/Shop/TransactionItem.pm
@@ -149,7 +149,7 @@ sub issueCredit {
my $credit = WebGUI::Shop::Credit->new($self->transaction->session, $self->transaction->get('userId'));
$credit->adjust($self->get('price'), "Issued credit on sku ".$self->get('assetId')." for transaction item ".$self->getId." on transaction ".$self->transaction->getId);
$self->getSku->onRefund($self);
- $self->update({shippingStatus=>'Cancelled'});
+ $self->update({orderStatus=>'Cancelled'});
}
#-------------------------------------------------------------------
@@ -251,9 +251,9 @@ shippingCode shippingPhoneNumber quantity price vendorId
A tracking number that is used by the shipping method for this transaction.
-=head4 shippingStatus
+=head4 orderStatus
-The status of this item. The default is 'NotShipped'. Other statuses include: Cancelled, BackOrdered, Shipped
+The status of this item. The default is 'NotShipped'. Other statuses include: Cancelled, Backordered, Shipped
=cut
@@ -266,9 +266,8 @@ sub update {
$newProperties->{ options } = $sku->getOptions;
$newProperties->{ assetId } = $sku->getId;
$newProperties->{ price } = $sku->getPrice;
- $newProperties->{ configuredTitle } = $sku->getConfiguredTitle;
- $newProperties->{ isRecurring } = $sku->isRecurring;
- $newProperties->{ recurInterval } = $sku->getRecurInterval if $sku->isRecurring;
+ $newProperties->{ configuredTitle } = $item->get('configuredTitle');
+ $newProperties->{ quantity } = $item->get('quantity');
my $address = $item->getShippingAddress;
$newProperties->{ shippingAddressId } = $address->getId;
$newProperties->{ shippingAddressName } = $address->get('name');
@@ -280,9 +279,11 @@ sub update {
$newProperties->{ shippingCountry } = $address->get('country');
$newProperties->{ shippingCode } = $address->get('code');
$newProperties->{ shippingPhoneNumber } = $address->get('phoneNumber');
- $newProperties->{ quantity } = $item->get('quantity');
+ unless ($sku->isShippingRequired) {
+ $newProperties->{orderStatus} = 'Shipped';
+ }
}
- my @fields = (qw(assetId configuredTitle options shippingAddressId shippingTrackingNumber shippingStatus
+ my @fields = (qw(assetId configuredTitle options shippingAddressId shippingTrackingNumber orderStatus
shippingName shippingAddress1 shippingAddress2 shippingAddress3 shippingCity shippingState
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId));
foreach my $field (@fields) {
@@ -291,9 +292,7 @@ sub update {
if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") {
$properties{$id}{options} = JSON->new->utf8->encode($newProperties->{options});
}
- if (exists $newProperties->{shippingStatus}) {
- $properties{$id}{shippingDate} = WebGUI::DateTime->new($self->transaction->session,time())->toDatabase;
- }
+ $properties{$id}{lastUpdated} = WebGUI::DateTime->new($self->transaction->session,time())->toDatabase;
$self->transaction->session->db->setRow("transactionItem","itemId",$properties{$id});
}
diff --git a/lib/WebGUI/i18n/English/Shop.pm b/lib/WebGUI/i18n/English/Shop.pm
index 3b8b23d2b..c16999d13 100644
--- a/lib/WebGUI/i18n/English/Shop.pm
+++ b/lib/WebGUI/i18n/English/Shop.pm
@@ -45,18 +45,72 @@ our $I18N = {
context => q|field label|
},
+ 'tracking number' => {
+ message => q|Tracking #|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'order status' => {
+ message => q|Order Status|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'Shipped' => {
+ message => q|Shipped|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'NotShipped' => {
+ message => q|Not Shipped|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'Backordered' => {
+ message => q|Backordered|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'Cancelled' => {
+ message => q|Cancelled|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
'vendors' => {
message => q|Vendors|,
lastUpdated => 0,
context => q|admin function label|
},
+ 'update' => {
+ message => q|Update|,
+ lastUpdated => 0,
+ context => q|button label|
+ },
+
+ 'refund' => {
+ message => q|Refund|,
+ lastUpdated => 0,
+ context => q|button label|
+ },
+
'date' => {
message => q|Date|,
lastUpdated => 0,
context => q|field label|
},
+ 'manage' => {
+ message => q|Manage|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
'order number' => {
message => q|Order #|,
lastUpdated => 0,
@@ -81,6 +135,18 @@ our $I18N = {
context => q|field label|
},
+ 'shipping method' => {
+ message => q|Shipping Method|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
+ 'shipping amount' => {
+ message => q|Shipping Amount|,
+ lastUpdated => 0,
+ context => q|field label|
+ },
+
'add shipper' => {
message => q|Add Shipping Method|,
lastUpdated => 0,
@@ -213,6 +279,12 @@ our $I18N = {
context => q|a label in the cart|
},
+ 'in shop credit used' => {
+ message => q|In-Shop Credit Used|,
+ lastUpdated => 0,
+ context => q|a label in the transaction|
+ },
+
'country' => {
message => q|Country|,
lastUpdated => 0,