NAME

Stancer::Card - Card representation

VERSION

version 1.0.2

ATTRIBUTES

brand

Read-only string.

Card brand name

brandname

Read-only string.

Card real brand name.

Whereas brand returns brand as a simple normalized string like "amex", brandname will return a complete and real brand name, like "American Express".

country

Read-only string.

Card country

cvc

Read/Write 3 characters string.

Card verification code

expiration

Read-only DateTime.

Expiration date as a DateTime object.

exp_month

Read/Write integer.

Expiration month

exp_year

Read/Write integer.

Expiration year

funding

Read-only string or undefined.

Type of funding

Should be one of "credit", "debit", "prepaid", "universal", "charge", "deferred". May be undefined when the type could not be determined.

last4

Read-only 4 characters string.

Last four card number

name

Read/Write 4 to 64 characters string.

Card holder's name

nature

Read-only string or undefined.

Nature of the card

Should be "personnal" or "corporate". May be undefined when the nature could not be determined.

network

Read-only string or undefined.

Nature of the card

Should be "mastercard", "national" or "visa". May be undefined when the network could not be determined.

number

Read/Write 16 to 19 characters string.

Card number

tokenize

Read/Write boolean.

Save card for later use

METHODS

Stancer::Card->new() : self

Stancer::Card->new($token) : self

Stancer::Card->new(%args) : self

Stancer::Card->new(\%args) : self

This method accept an optional string, it will be used as an entity ID for API calls.

# Get an empty new card
my $new = Stancer::Card->new();

# Get an existing card
my $exist = Stancer::Card->new($token);

USAGE

Logging

We use the Log::Any framework for logging events. You may tell where it should log using any available Log::Any::Adapter module.

For example, to log everything to a file you just have to add a line to your script, like this: #! /usr/bin/env perl use Log::Any::Adapter (File => '/var/log/payment.log'); use Stancer::Card;

You must import Log::Any::Adapter before our libraries, to initialize the logger instance before use.

You can choose your log level on import directly: use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info');

Read the Log::Any documentation to know what other options you have.

SECURITY

  • Never, never, NEVER register a card or a bank account number in your database.

  • Always uses HTTPS in card/SEPA in communication.

  • Our API will never give you a complete card/SEPA number, only the last four digits. If you need to keep track, use these last four digit.

BUGS

Please report any bugs or feature requests on the bugtracker website https://gitlab.com/wearestancer/library/lib-perl/-/issues or by email to bug-stancer@rt.cpan.org.

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Joel Da Silva <jdasilva@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018-2024 by Stancer / Iliad78.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)