Module: Spree::Admin::OrdersHelper
- Defined in:
- app/helpers/spree/admin/orders_helper.rb
Defined Under Namespace
Classes: TaxLine
Instance Method Summary collapse
- #avs_response_code ⇒ Object
- #cvv_response_code ⇒ Object
- #line_item_shipment_price(line_item, quantity) ⇒ Object
- #order_payment_state(order, options = {}) ⇒ Object
- #order_shipment_state(order, options = {}) ⇒ Object
- #order_summary_tax_lines_additional(order) ⇒ Object
- #payment_state_badge(state) ⇒ Object
- #ready_to_ship_orders_count ⇒ Object
- #shipment_state(shipment_state, options = {}) ⇒ Object
Instance Method Details
#avs_response_code ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 102 def avs_response_code { 'A' => 'Street address matches, but 5-digit and 9-digit postal code do not match.', 'B' => 'Street address matches, but postal code not verified.', 'C' => 'Street address and postal code do not match.', 'D' => 'Street address and postal code match. ', 'E' => 'AVS data is invalid or AVS is not allowed for this card type.', 'F' => "Card member's name does not match, but billing postal code matches.", 'G' => 'Non-U.S. issuing bank does not support AVS.', 'H' => "Card member's name does not match. Street address and postal code match.", 'I' => 'Address not verified.', 'J' => "Card member's name, billing address, and postal code match.", 'K' => "Card member's name matches but billing address and billing postal code do not match.", 'L' => "Card member's name and billing postal code match, but billing address does not match.", 'M' => 'Street address and postal code match. ', 'N' => 'Street address and postal code do not match.', 'O' => "Card member's name and billing address match, but billing postal code does not match.", 'P' => 'Postal code matches, but street address not verified.', 'Q' => "Card member's name, billing address, and postal code match.", 'R' => 'System unavailable.', 'S' => 'Bank does not support AVS.', 'T' => "Card member's name does not match, but street address matches.", 'U' => 'Address information unavailable. Returned if the U.S. bank does not support non-U.S. AVS or if the AVS in a U.S. bank is not functioning properly.', 'V' => "Card member's name, billing address, and billing postal code match.", 'W' => 'Street address does not match, but 9-digit postal code matches.', 'X' => 'Street address and 9-digit postal code match.', 'Y' => 'Street address and 5-digit postal code match.', 'Z' => 'Street address does not match, but 5-digit postal code matches.' } end |
#cvv_response_code ⇒ Object
133 134 135 136 137 138 139 140 141 142 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 133 def cvv_response_code { 'M' => 'CVV2 Match', 'N' => 'CVV2 No Match', 'P' => 'Not Processed', 'S' => 'Issuer indicates that CVV2 data should be present on the card, but the merchant has indicated data is not present on the card', 'U' => 'Issuer has not certified for CVV2 or Issuer has not provided Visa with the CVV2 encryption keys', '' => 'Transaction failed because wrong CVV2 number was entered or no CVV2 number was entered' } end |
#line_item_shipment_price(line_item, quantity) ⇒ Object
84 85 86 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 84 def line_item_shipment_price(line_item, quantity) Spree::Money.new(line_item.price * quantity, currency: line_item.currency) end |
#order_payment_state(order, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 22 def order_payment_state(order, = {}) return if order.payment_state.blank? badge_class = if order.order_refunded? 'badge-danger' elsif order.partially_refunded? 'badge-warning' else "badge-#{order.payment_state}" end content_tag :span, class: "badge #{[:class]} #{badge_class}" do if order.order_refunded? icon('credit-card-refund') + Spree.t('payment_states.refunded') elsif order.partially_refunded? icon('credit-card-refund') + Spree.t('payment_states.partially_refunded') elsif order.payment_state == 'failed' icon('cancel') + Spree.t('payment_states.failed') elsif order.payment_state == 'void' icon('cancel') + Spree.t('payment_states.void') elsif order.payment_state == 'paid' icon('check') + Spree.t('payment_states.paid') else icon('progress') + Spree.t("payment_states.#{order.payment_state}") end end end |
#order_shipment_state(order, options = {}) ⇒ Object
50 51 52 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 50 def order_shipment_state(order, = {}) shipment_state(order.shipment_state, ) end |
#order_summary_tax_lines_additional(order) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 14 def order_summary_tax_lines_additional(order) Spree::Deprecation.warn("order_summary_tax_lines_additional is deprecated and will be removed in Spree 5.5") line_item_taxes = order.line_item_adjustments.tax.map { |tax_adjustment| map_to_tax_line(tax_adjustment) } shipment_taxes = order.shipment_adjustments.tax.map { |tax_adjustment| map_to_tax_line(tax_adjustment, for_shipment: true) } line_item_taxes + shipment_taxes end |
#payment_state_badge(state) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 70 def payment_state_badge(state) content_tag :span, class: "badge badge-#{state}" do if state == 'completed' icon('check') + Spree.t('payment_states.completed') elsif state == 'failed' icon('cancel') + Spree.t('payment_states.failed') elsif state == 'processing' icon('progress') + Spree.t('payment_states.processing') else Spree.t("payment_states.#{state}") end end end |
#ready_to_ship_orders_count ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 88 def ready_to_ship_orders_count @ready_to_ship_orders_count ||= begin if defined?(current_vendor) if current_vendor.present? current_vendor.orders.complete.ready_to_ship.count else current_store.orders.without_vendor.complete.ready_to_ship.count end else current_store.orders.complete.ready_to_ship.count end end end |
#shipment_state(shipment_state, options = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/helpers/spree/admin/orders_helper.rb', line 54 def shipment_state(shipment_state, = {}) return if shipment_state.blank? content_tag :span, class: "badge #{[:class]} badge-#{shipment_state}" do if shipment_state == 'shipped' icon('check') + Spree.t('shipment_states.shipped') elsif shipment_state == 'partial' icon('progress-check') + Spree.t('shipment_states.partial') elsif shipment_state == 'canceled' icon('cancel') + Spree.t('shipment_states.canceled') else icon('progress') + Spree.t("shipment_states.#{shipment_state}") end end end |