File Coverage

blib/lib/Business/CyberSource/RequestPart/Item.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Business::CyberSource::RequestPart::Item;
2 2     2   1115 use strict;
  2         2  
  2         52  
3 2     2   8 use warnings;
  2         2  
  2         52  
4 2     2   803 use namespace::autoclean;
  2         10534  
  2         8  
5              
6             our $VERSION = '0.010007'; # VERSION
7              
8 2     2   534 use Moose;
  2         201487  
  2         12  
9             extends 'Business::CyberSource::MessagePart';
10             with 'MooseX::RemoteHelper::CompositeSerialization';
11              
12 2     2   10002 use MooseX::Types::Common::Numeric qw( PositiveOrZeroNum PositiveOrZeroInt );
  2         149899  
  2         11  
13 2     2   5366 use MooseX::Types::Common::String qw( NonEmptySimpleStr );
  2         138320  
  2         12  
14              
15             has quantity => (
16             isa => PositiveOrZeroInt,
17             remote_name => 'quantity',
18             is => 'ro',
19             lazy => 1,
20             default => sub { 1 },
21             );
22              
23             has unit_price => (
24             isa => PositiveOrZeroNum,
25             remote_name => 'unitPrice',
26             is => 'ro',
27             required => 1,
28             );
29              
30             has product_code => (
31             isa => NonEmptySimpleStr,
32             remote_name => 'productCode',
33             traits => ['SetOnce'],
34             is => 'rw',
35             );
36              
37             has product_name => (
38             isa => NonEmptySimpleStr,
39             remote_name => 'productName',
40             traits => ['SetOnce'],
41             is => 'rw',
42             );
43              
44             has product_sku => (
45             isa => NonEmptySimpleStr,
46             remote_name => 'productSKU',
47             traits => ['SetOnce'],
48             is => 'rw',
49             );
50              
51             has product_risk => (
52             isa => NonEmptySimpleStr,
53             remote_name => 'productRisk',
54             traits => ['SetOnce'],
55             is => 'rw',
56             );
57              
58             has tax_amount => (
59             isa => PositiveOrZeroNum,
60             remote_name => 'taxAmount',
61             traits => ['SetOnce'],
62             is => 'rw',
63             );
64              
65             has tax_rate => (
66             isa => PositiveOrZeroNum,
67             remote_name => 'taxRate',
68             traits => ['SetOnce'],
69             is => 'rw',
70             );
71              
72             has national_tax => (
73             isa => PositiveOrZeroNum,
74             remote_name => 'nationalTax',
75             traits => ['SetOnce'],
76             is => 'rw',
77             );
78              
79             __PACKAGE__->meta->make_immutable;
80             1;
81              
82             # ABSTRACT: Item Helper Class
83              
84             __END__
85              
86             =pod
87              
88             =encoding UTF-8
89              
90             =head1 NAME
91              
92             Business::CyberSource::RequestPart::Item - Item Helper Class
93              
94             =head1 VERSION
95              
96             version 0.010007
97              
98             =head1 EXTENDS
99              
100             L<Business::CyberSource::MessagePart>
101              
102             =head1 ATTRIBUTES
103              
104             =head2 unit_price
105              
106             Per-item price of the product. You must include either this field or
107             L<total|Business::CyberSource::RequestPart::PurchaseTotals/"total">
108             in your request.
109              
110             =head2 quantity
111              
112             The default is 1. For C<ccAuthService> and C<ccCaptureService>, this field is
113             required if L<product_code|/"product_code> is not default or one of the values related to
114             shipping and/or handling.
115              
116             =head2 product_code
117              
118             Type of product. This value is used to determine the category that the product
119             is in.
120              
121             =head2 product_name
122              
123             For C<ccAuthService> and C<ccCaptureService>, this field is required if
124             L<product_code|/product_code> is not default or one of the values related to shipping
125             and/or handling.
126              
127             =head2 product_sku
128              
129             Identification code for the product. For C<ccAuthService> and
130             C<ccCaptureService>, this field is required if L<product_code|/product_code>
131             is not default or one of the values related to shipping and/or handling.
132              
133             =head2 product_risk
134              
135             =head2 tax_amount
136              
137             Total tax to apply to the product. This value cannot be negative. The tax
138             amount and the offer amount must be in the same currency.
139             The tax amount field is additive. For example (in CyberSource notation):
140              
141             You include the following offer lines in your request:
142              
143             item_0_unitPrice=10.00
144             item_0_quantity=1
145             item_0_taxAmount=0.80
146             item_1_unitPrice=20.00
147             item_1_quantity=1
148             item_1_taxAmount=1.60
149              
150             The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included.
151              
152             =head2 tax_rate
153              
154             =head2 national_tax
155              
156             =head1 BUGS
157              
158             Please report any bugs or feature requests on the bugtracker website
159             https://github.com/xenoterracide/business-cybersource/issues
160              
161             When submitting a bug or request, please include a test-file or a
162             patch to an existing test-file that illustrates the bug or desired
163             feature.
164              
165             =head1 AUTHOR
166              
167             Caleb Cushing <xenoterracide@gmail.com>
168              
169             =head1 COPYRIGHT AND LICENSE
170              
171             This software is Copyright (c) 2016 by Caleb Cushing <xenoterracide@gmail.com>.
172              
173             This is free software, licensed under:
174              
175             The Artistic License 2.0 (GPL Compatible)
176              
177             =cut