Index: openacs-4/packages/ecommerce/www/admin/orders/fulfill-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/fulfill-3.tcl,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/ecommerce/www/admin/orders/fulfill-3.tcl 25 Jan 2005 09:03:17 -0000 1.9.2.2 +++ openacs-4/packages/ecommerce/www/admin/orders/fulfill-3.tcl 28 Jan 2005 10:45:28 -0000 1.9.2.3 @@ -57,10 +57,15 @@ } set shipping_method [db_string shipping_method_select " - select shipping_method + select shipping_method from ec_orders where order_id=:order_id"] +set creditcard_id [db_string creditcard_id_select " + select creditcard_id + from ec_orders + where order_id=:order_id"] + set shippable_p [ec_decode [db_string shippable_p_select " select shipping_method from ec_orders @@ -191,19 +196,20 @@ # amount and can thus not differentiate between the amount # authorized and the amount to capture. - if {[string equal $shipment_cost [db_string authorized_amount_select " + if { $shipment_cost == [db_string authorized_amount_select " select transaction_amount from ec_financial_transactions where order_id = :order_id and to_be_captured_p is null and authorized_date is not null - and transaction_type = 'charge'" -default ""]]} { + and transaction_type = 'charge'" -default ""]} { set transaction_id [db_string transaction_id_select " select transaction_id from ec_financial_transactions where order_id = :order_id and to_be_captured_p is null + and creditcard_id = :creditcard_id and transaction_type = 'charge'" -default ""] if { ![empty_string_p $transaction_id] } { @@ -218,7 +224,7 @@ set mark_result $response(response_code) set pgw_transaction_id $response(transaction_id) if { [string equal $mark_result "invalid_input"]} { - set problem_details "When trying to mark shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $mark_result" + set problem_details "(ref:fulfill-3,227) When trying to mark shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $mark_result" db_dml problems_log_insert " insert into ec_problems_log (problem_id, problem_date, problem_details, order_id) @@ -285,7 +291,7 @@ set result $response(response_code) set pgw_transaction_id $response(transaction_id) if {[string equal $result "failed_authorization"] || [string equal $result "invalid_input"]} { - set problem_details "When trying to authorize shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $result" + set problem_details "(ref:fulfill-3,216) When trying to authorize shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $result" db_dml problems_insert " insert into ec_problems_log (problem_id, problem_date, problem_details, order_id) @@ -320,7 +326,7 @@ set mark_result $response(response_code) set pgw_transaction_id $response(transaction_id) if {[string equal $mark_result "invalid_input"]} { - set problem_details "When trying to mark shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $mark_result" + set problem_details "(ref:fulfill-3,329) When trying to mark shipment $shipment_id (transaction $transaction_id) at [ad_conn url], the following result occurred: $mark_result" db_dml problems_insert " insert into ec_problems_log (problem_id, problem_date, problem_details, order_id)