| 1 | |||
| 2 | package Net::Simplify; | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | Net::Simplify - Simplify Commerce Payments API | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | use Net::Simplify; | ||
| 11 | |||
| 12 | # Set global API keys | ||
| 13 | $Net::Simplify::public_key = 'YOUR PUBLIC KEY'; | ||
| 14 | $Net::Simplify::private_key = 'YOUR PRIVATE KEY'; | ||
| 15 | |||
| 16 | # Create a payment | ||
| 17 | my $payment = Net::Simplify::Payment->create({ | ||
| 18 | amount => 1200, | ||
| 19 | currency => 'USD', | ||
| 20 | description => 'test payment', | ||
| 21 | card => { | ||
| 22 | number => "5555555555554444", | ||
| 23 | cvc => "123", | ||
| 24 | expMonth => 12, | ||
| 25 | expYear => 19 | ||
| 26 | }, | ||
| 27 | reference => 'P100' | ||
| 28 | }); | ||
| 29 | |||
| 30 | printf "Payment %s %s\n", $payment->{id}, $payment->{paymentStatus}; | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | # Use an Authentication object to hold credentials | ||
| 35 | my $auth = Net::Simplify::Authentication->create({ | ||
| 36 | public_key => 'YOUR PUBLIC KEY', | ||
| 37 | private_key => 'YOUR PRIVATE_KEY' | ||
| 38 | }; | ||
| 39 | |||
| 40 | # Create a payment using the $auth object | ||
| 41 | my $payment2 = Net::Simplify::Payment->create({ | ||
| 42 | amount => 2400, | ||
| 43 | currency => 'USD', | ||
| 44 | description => 'test payment', | ||
| 45 | card => { | ||
| 46 | number => "5555555555554444", | ||
| 47 | cvc => "123", | ||
| 48 | expMonth => 12, | ||
| 49 | expYear => 19 | ||
| 50 | }, | ||
| 51 | reference => 'P101' | ||
| 52 | }, $auth); | ||
| 53 | |||
| 54 | printf "Payment %s %s\n", $payment2->{id}, $payment2->{paymentStatus}; | ||
| 55 | |||
| 56 | =head1 DESCRIPTION | ||
| 57 | |||
| 58 | The Simplify module provides a convenient way of accessing the Simplify API. It allows global | ||
| 59 | authentication keys to be set and imports all of the Simplify packages. | ||
| 60 | |||
| 61 | |||
| 62 | =head2 GLOBAL VARIABLES | ||
| 63 | |||
| 64 | =head3 $Net::Simplify::public_key | ||
| 65 | |||
| 66 | The public key to be used for all API calls where an Authentication object is not passed. | ||
| 67 | |||
| 68 | =head3 $Net::Simplify::private_key | ||
| 69 | |||
| 70 | The private key to be used for all API calls where an Authentication object is not passed. | ||
| 71 | |||
| 72 | =head3 $Net::Simplify::user_agent | ||
| 73 | |||
| 74 | The user agent string to be sent with all requests. | ||
| 75 | |||
| 76 | =head1 SEE ALSO | ||
| 77 | |||
| 78 | L<Net::Simplify::AccessToken>, | ||
| 79 | L<Net::Simplify::ApiException>, | ||
| 80 | L<Net::Simplify::Authentication>, | ||
| 81 | L<Net::Simplify::AuthenticationException>, | ||
| 82 | L<Net::Simplify::Authorization>, | ||
| 83 | L<Net::Simplify::BadRequestException>, | ||
| 84 | L<Net::Simplify::CardToken>, | ||
| 85 | L<Net::Simplify::Constants>, | ||
| 86 | L<Net::Simplify::Coupon>, | ||
| 87 | L<Net::Simplify::Customer>, | ||
| 88 | L<Net::Simplify::Event>, | ||
| 89 | L<Net::Simplify::Event>, | ||
| 90 | L<Net::Simplify::FieldError>, | ||
| 91 | L<Net::Simplify::FraudCheck>, | ||
| 92 | L<Net::Simplify::IllegalArgumentException>, | ||
| 93 | L<Net::Simplify::Invoice>, | ||
| 94 | L<Net::Simplify::InvoiceItem>, | ||
| 95 | L<Net::Simplify::Tax>, | ||
| 96 | L<Net::Simplify::TransactionReview>, | ||
| 97 | L<Net::Simplify::NotAllowedException>, | ||
| 98 | L<Net::Simplify::ObjectNotFoundException>, | ||
| 99 | L<Net::Simplify::Payment>, | ||
| 100 | L<Net::Simplify::Plan>, | ||
| 101 | L<Net::Simplify::Refund>, | ||
| 102 | L<Net::Simplify::Subscription>, | ||
| 103 | L<Net::Simplify::SystemException>, | ||
| 104 | L<Net::Simplify::Webhook>, | ||
| 105 | L<http://www.simplify.com> | ||
| 106 | |||
| 107 | =head1 VERSION | ||
| 108 | |||
| 109 | 1.6.0 | ||
| 110 | |||
| 111 | =head1 LICENSE | ||
| 112 | |||
| 113 | Copyright (c) 2013 - 2022 MasterCard International Incorporated | ||
| 114 | All rights reserved. | ||
| 115 | |||
| 116 | Redistribution and use in source and binary forms, with or without modification, are | ||
| 117 | permitted provided that the following conditions are met: | ||
| 118 | |||
| 119 | Redistributions of source code must retain the above copyright notice, this list of | ||
| 120 | conditions and the following disclaimer. | ||
| 121 | Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| 122 | conditions and the following disclaimer in the documentation and/or other materials | ||
| 123 | provided with the distribution. | ||
| 124 | Neither the name of the MasterCard International Incorporated nor the names of its | ||
| 125 | contributors may be used to endorse or promote products derived from this software | ||
| 126 | without specific prior written permission. | ||
| 127 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
| 128 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 129 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
| 130 | SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 131 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
| 132 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
| 133 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| 134 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 135 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 136 | SUCH DAMAGE. | ||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | use 5.006; | ||
| 141 | use strict; | ||
| 142 | use warnings FATAL => 'all'; | ||
| 143 | |||
| 144 | use Net::Simplify::Constants; | ||
| 145 | |||
| 146 | $Net::Simplify::public_key = undef; | ||
| 147 | $Net::Simplify::private_key = undef; | ||
| 148 | $Net::Simplify::api_base_live_url = $Net::Simplify::Constants::API_BASE_LIVE_URL; | ||
| 149 | $Net::Simplify::api_base_sandbox_url = $Net::Simplify::Constants::API_BASE_SANDBOX_URL; | ||
| 150 | $Net::Simplify::oauth_base_url = $Net::Simplify::Constants::OAUTH_BASE_URL; | ||
| 151 | $Net::Simplify::user_agent = undef; | ||
| 152 | |||
| 153 | use Net::Simplify::Authentication; | ||
| 154 | use Net::Simplify::AccessToken; | ||
| 155 | use Net::Simplify::ApiException; | ||
| 156 | use Net::Simplify::IllegalArgumentException; | ||
| 157 | use Net::Simplify::AuthenticationException; | ||
| 158 | use Net::Simplify::ObjectNotFoundException; | ||
| 159 | use Net::Simplify::NotAllowedException; | ||
| 160 | use Net::Simplify::BadRequestException; | ||
| 161 | use Net::Simplify::SystemException; | ||
| 162 | use Net::Simplify::FieldError; | ||
| 163 | use Net::Simplify::SimplifyApi; | ||
| 164 | use Net::Simplify::Event; | ||
| 165 | |||
| 166 | use Net::Simplify::Authorization; | ||
| 167 | use Net::Simplify::CardToken; | ||
| 168 | use Net::Simplify::Constants; | ||
| 169 | use Net::Simplify::Coupon; | ||
| 170 | use Net::Simplify::Customer; | ||
| 171 | use Net::Simplify::FraudCheck; | ||
| 172 | use Net::Simplify::Invoice; | ||
| 173 | use Net::Simplify::InvoiceItem; | ||
| 174 | use Net::Simplify::Tax; | ||
| 175 | use Net::Simplify::Payment; | ||
| 176 | use Net::Simplify::Plan; | ||
| 177 | use Net::Simplify::Refund; | ||
| 178 | use Net::Simplify::Subscription; | ||
| 179 | use Net::Simplify::TransactionReview; | ||
| 180 | use Net::Simplify::Webhook; | ||
| 181 | |||
| 182 | 1; |