NAME

Business::CPI::Role::Cart - Shopping cart or an order

VERSION

version 0.916

DESCRIPTION

Cart class for holding products to be purchased. Don't instantiate this directly, use "new_cart" in Business::CPI::Gateway::Base to build it.

ATTRIBUTES

id

The id of the cart, if your application has one set for it.

gateway_id

The id your gateway has set for this cart, if there is one.

buyer

The person paying for the shopping cart. See Business::CPI::Role::Buyer or Business::CPI::Role::Account. (This is a bit confusing because the interface isn't stable yet, and we are planning a transition from the Buyer role to the Account role. But most CPI gateways still use the Buyer role.)

discount

Discount to be subtracted from the total amount. Positive number.

tax

Tax to be added to the total amount. Positive number.

handling

Handling to be added to the total amount. Positive number.

shipping

Price of the shipping to be added to the total amount. Positive number.

METHODS

get_total_shipping

Traverse all items from this cart and returns the sum of each shipping cost, plus the value of the shipping attribute.

get_total_amount

Calculates the total amount of the cart.

add_item

Create a new Item object with the given hashref, and add it to cart.

add_receiver

Create a new Receiver object with the given hashref, and add it to cart.

get_item

Get item with the given id.

get_form_to_pay

Takes a payment_id as the only argument, and returns an HTML::Element form, to submit to the gateway.

get_checkout_code

Very similar to get_form_to_pay, $cart->get_checkout_code will send to the gateway this cart, and return a token for it, so that the payment will be made referring to this token. It receives the same arguments as get_form_to_pay.

AUTHOR

André Walker <andre@andrewalker.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by André Walker.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.