Method: ActiveMerchant::Billing::CyberSourceGateway#calculate_tax
- Defined in:
- lib/active_merchant/billing/gateways/cyber_source.rb
#calculate_tax(creditcard, options) ⇒ Object
CyberSource requires that you provide line item information for tax calculations. If you do not have prices for each item or want to simplify the situation then pass in one fake line item that costs the subtotal of the order
The line_item hash goes in the options hash and should look like
:line_items => [
{
:declared_value => '1',
:quantity => '2',
:code => 'default',
:description => 'Giant Walrus',
:sku => 'WA323232323232323'
},
{
:declared_value => '6',
:quantity => '1',
:code => 'default',
:description => 'Marble Snowcone',
:sku => 'FAKE1232132113123'
}
]
This functionality is only supported by this particular gateway may be changed at any time
309 310 311 312 313 |
# File 'lib/active_merchant/billing/gateways/cyber_source.rb', line 309 def calculate_tax(creditcard, ) requires!(, :line_items) setup_address_hash() commit(build_tax_calculation_request(creditcard, ), :calculate_tax, nil, ) end |