| 1 | package plenigo::Offer; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | plenigo::Offer - An offer used during a checkout. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use plenigo::Offer; | ||
| 10 | |||
| 11 | # Create a plenigo offer | ||
| 12 | |||
| 13 | # Initialize a plenigo managed offer. | ||
| 14 | |||
| 15 | my $offer = plenigo::Offer->createPlenigoOffer('CUSTOMER_ID', 'CUSTOMER_IP_ADDRESS', ((plenigoOfferId => 'OFFER_ID1'))); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | plenigo::Product represents a product during the checkout. | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | use Moo; | ||
| 24 | use Carp qw(confess); | ||
| 25 | |||
| 26 | our $VERSION = '3.0002'; | ||
| 27 | |||
| 28 | has customer_id => ( | ||
| 29 | is => 'rw' | ||
| 30 | ); | ||
| 31 | |||
| 32 | has customer_ip_address => ( | ||
| 33 | is => 'rw', | ||
| 34 | required => 1 | ||
| 35 | ); | ||
| 36 | |||
| 37 | has items => ( | ||
| 38 | is => 'rw', | ||
| 39 | required => 1 | ||
| 40 | ); | ||
| 41 | |||
| 42 | =head2 createPlenigoOffer($offer_id) | ||
| 43 | |||
| 44 | Initialize a plenigo managed offer. | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | sub createPlenigoOffer { | ||
| 49 | my ($self, $customer_id, $customer_ip_address, @items) = @_; | ||
| 50 | |||
| 51 | my $new_product = plenigo::Product->new( | ||
| 52 | customerId => $customer_id, | ||
| 53 | customerIpAddress => $customer_ip_address, | ||
| 54 | items => @items | ||
| 55 | ); | ||
| 56 | return $new_product; | ||
| 57 | } | ||
| 58 | |||
| 59 | 1; |