Giter Club home page Giter Club logo

aktive-merchant's Introduction

Aktive Merchant for PHP

This project is a PHP port of Active Merchant library from Ruby.

The aim is to develop a PHP application to includes payment gateways under common interfaces.

Supported Gateways

Requirements

  • PHP 5.3.3+
  • cUrl
  • SimpleXML

Documentations

Contributing

You can fork this project and implement new gateways.

aktive-merchant's People

Contributors

akdeveloper avatar brianewing avatar dimitrisgiannakakis avatar elearnapp avatar falexandrou avatar hossamhossny avatar kierangraham avatar kmavrofridis avatar leek avatar scottgifford avatar sonnygauran avatar tomdmaguire avatar wakeless avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aktive-merchant's Issues

Where to start

Might be helpful to get a list of things that might need a little bit of work. What's standing in the way of getting this to a point where we can start integrating it into projects?

The Wiki could be a reasonable enough place to jot down some notes.

Adding phpunit as composer dependency

How would you feel about adding phpunit as a dev composer dependency?

tomglue@5e3854f

I have found myself doing it a few times when wanting to run unit tests (I don't have phpunit installed globally), but then clear the changes before sending over pull requests.

Invalid Credit Card Errors for AuthorizeNet

This may be unique to me and my build but I received this error when I tried Paypal's test credit card

Visa: 4111111111111111

Fatal error: Access to undeclared static property: Merchant_Billing_AuthorizeNet::$CARD_CODE_ERRORS in /home/isvorg/public_html/app/plugins/cart/vendors/aktive_merchant/lib/merchant/billing/gateways/AuthorizeNet.php on line 265

Unnecessary use of static values

I'm not sure of the reasoning behind the static variables in the Gateway class. In pretty much all instances that one of the variables is referenced you're actually within the scope of a class and thus have to use a late static binding hack to get at the actual value of the variable.

Is there any reason why these cannot be changed to normal member variables?

Paypal Express not working for me

A vanilla flavoured Aktiv-Merchant with just the necessary changes made to support PayPal Express:

$gateway = new Merchant_Billing_PaypalExpress(
array(
'login' => $nopconfig['cart.paymentgateway']['paypal.api.username'],
'password' => $nopconfig['cart.paymentgateway']['paypal.api.password'] ,
'signature' => $nopconfig['cart.paymentgateway']['paypal.api.signature'],
'currency' => 'GBP'
)
);

with a credit card array:

# Create a credit card object if you need it.
$credit_card = new Merchant_Billing_CreditCard( 

    array(
        "first_name"            => $_POST['firstname'],
        "last_name"             => $_POST['lastname'],
        "number"                => $_POST['ccnumber'],
        "month"                 => $_POST['client_cardexpmth'],
        "year"                  => $_POST['client_cardexpyr'],
        "verification_value"    => $_POST['cvv']    
    )
);

generates the following PHP error:

[02-Feb-2012 09:40:24] PHP Fatal error: Cannot use object of type Merchant_Billing_CreditCard as array in D:\Webroot\theleatherworker.com\includes\classes\merchant\merchant\billing\gateways\PaypalExpress.php on line 117

Using print_r to get some feedback on the screen, I get:

Merchant_Billing_CreditCard Object ( [first_name] => Mark [last_name] => Richards [month] => 08 [year] => 2015 [type] => visa [number] => 4295369404352770 [verification_value] => 333 [start_month] => [start_year] => [issue_number] => [errors:Merchant_Billing_CreditCard:private] => Merchant_Error Object ( [errors:Merchant_Error:private] => Array ( ) ) [require_verification_value] => 1 )

If Aktiv Merchant is supposed to be generic what is happening?

PCI compliance

This is more of a question, and a feature request. I would love to use this library you have written on a project soon, but I need to know if it is PCI compliant.

Static properties in Merchant_Billing_Gateway class

In Merchant_Billing_Gateway class there are some properties that must be available without making an instance of class.
These properties are:
$default_currency;
$supported_countries;
$homepage_url;
$display_name;
$supported_cardtypes;
$money_format;

This is useful when we want to display information for each gateway, without make an instance. Also an instance requires some options in constructor that may not be available to someone who wants just to see what each gateway supports.

First thought is to make these properties static and access their values via Reflection class.

But ... $money_format and $supported_cardtypes are used in amount() and supported_cardtypes(), methods. So if we make them static and use self::$money_format or self::$supported_countries this will end up with the default value of Merchant_Billing_Gateway and not the value we have in each Gateway.

Is there any way to resolve this?

Use of build in xml builder.

An xml builder was introduced in 1.1.0 version.
Every gateway that communicate with xml (except Soap), should use this build-in xml builder.

List of gateways that use xml:

  • AuthorizeNet (ARB) Moved to v2.0 #66
  • BridgePay
  • Eurobank (Is deprecated so will not have to convert it)
  • HsbcSecureEpayments
  • Iridium
  • Moneris
  • Payflow
  • WorldPay

CreditCard class should support card tokens.

CreditCard class should manage a token reference of itself.
Some gateways supports the feature of exchanging the sensitive data of a credit card with a token reference.

Merchants can use this token to fulfill payments.
In this case purchase or authorize methods should accept a CreditCard object or a string reference of CreditCard.

Instead of changing the signature of these methods, it is better add support of token in CreditCard class.

So inside these methods should check if $creditcard->token is available to complete the action with token instead of card data.

Realex recurring bug

In Realex.php:200 "public function recurring" - no need for CreditCard instance parameter.

Oh, sorry, it is required by interface

Want to work together?

I'm working on a similar payment library to this: https://github.com/adrianmacneil/tala-payments

It seems our projects have similar goals (both taking inspiration from Active Merchant, similar API etc). I'm using it in a commercial shopping cart so will be adding many gateways in the near future and will continue to develop/support it.

Just wondering if you would be interested in working together rather than duplicating effort? I'd love to hear any feedback on my API, and would be happy to share commit access to the project.

Documentation on Refunds and voids

I've been trying to figure out how to handle refunds and voids and I can't seem to get it to work. for refund I've passed it the authorization code I got back from authorize along with the last 4 of the cc and i get an exception "The referenced transaction does not meet the criteria for issuing a credit. (code 3/54)"

This maybe due to using the sandbox, but I doubt it.

Also at the same time I'm looking to add support for World Pay via integration mode and was wondering if you could give me any advice for this.

-Analog

PayPal gateway is not passing through CC's start date and issue number

To fix this I appended the following lines to Merchant_Billing_Paypal::add_creditcard() method:

if ($this->requires_start_date_or_issue_number($creditcard)) {
    if (!is_null($creditcard->start_month)) {
        $startMonth = $this->cc_format($creditcard->start_month, 'two_digits');
        $startYear = $this->cc_format($creditcard->start_year, 'four_digits');
        $this->post['STARTDATE'] = $startYear . $startMonth;
    }

    if (!is_null($creditcard->issue_number))
        $this->post['ISSUENUMBER'] = $this->cc_format($creditcard->issue_number, 'two_digits');
}

Aktive-Merchant php5.3+

I think it is time to use some php 5.3+ features with Aktive-Merchant library so i ll create a php_5.3 branch.

All existing code should be ported to this branch and will use php5.3 namespaces and php5.3 new features.

This will also help to easy migrate the project to use php5.4 features in future.

First priorities are:

  • All classes should be able to be loaded using SplClassLoader. (see docblock in this class for more info)
  • All gateways should be under the AktiveMerchant\Billing\Gateways namespace.
  • All gateways must implement the appropriate interface(s) ( thanks to @scottgifford for influence and implementation to current Aktive-Merchant branch)
  • Gateways would marked as working when they come with success unit tests. It would be nice to mock gateways with predefined response content so, unit tests could run from users that don 't have login credentials for the gateways. All non working gateways would be moved to a develop branch for further developing.

PayPal gateway may return an unexpected CVV code "E"

Array
(
    [TIMESTAMP] => 2011-09-26T14:22:46Z
    [CORRELATIONID] => a4195d2133dde
    [ACK] => Success
    [VERSION] => 59.0
    [BUILD] => 2133933
    [AMT] => 979.00
    [CURRENCYCODE] => GBP
    [AVSCODE] => F
    [CVV2MATCH] => E
    [TRANSACTIONID] => 7SX79567HF869590M
)

This causes an issue in CvvResult class, because no message corresponds to this code. Quick a dirty fix:

    $this->message = isset($this->code) ? self::$MESSAGES[$this->code] : 'Uknown';

Could use an example of how to use PaypalExpress

Since PaypalExpress needs to be executed in 2 php scripts, it is somewhat confusing what commands to issue and their correct order. It would be helpful if there was a sample script I could look through to walk me through it. What I've got so far:

$setupResponse = $gateway->setup_purchase('20', $options);
header('Location:'. $gateway->url_for_token($setupResponse->token()));

Get sent to paypal to login. Get sent to return_url where...

/// WHAT DO I DO NEXT???
$options['token'] = $setupResponse->token();
$options['payer_id'] = $setupResponse->payer_id();
# Authorize transaction
$response = $gateway->purchase('20', $options);
if ( $response->success() ) {
    echo 'Success Authorize';
} else {
    echo $response->message();
    echo 'Failure';
}

Inaccurate Response Success?

I realize I'm opening a lot of tickets which are usually faults of my own, so I hope I'm not starting to get on anyone's nerves. However I was digging through the response object trying to find a uniform approach to retrieve transaction ID's (for different gateways) and I realized that the response I had is set to success = true; but there are error messages in the response.

This is a dump of the response object for a paypal pro transaction: http://pastebin.com/F1nSJ03i during a test transaction.
This was caused by typing in 'California' instead of just 'CA'. Notice the success value and the error messages. Is it just because this is a warning that the response is still considered successful? Or did the transaction really not succeed?

log/development.log file is being tracked

This means that although it's in gitignore, since it's already in the git repo, any changes to the file will be tracked. What should be done is the file should be deleted and removed from the git repo, then code should be added that checks if the file exists, and if not creates it. Gitignore only works on files that aren't already tracked.

502 bad gateway on PP Express $gateway->purchase

Hi,

Thanks for making Aktive Merchant - it's a great tool.

I'm having one problem - when PayPal returns the customer to my site, I follow your instruction to validate the payment and, if all is well, I call the ->purchase method. All as per your example.

The problem is, $gateway->purchase triggers as 502 bad gateway response on my server. HOWEVER, if I then refresh the page, it goes through normally, although by now PayPal thinks the transaction has already been made, so it returns the error: "A successful transaction has already been completed for this token."

Could you let me know if you have any idea why the initial call to ->purchase might be triggering a 502 bad gateway each time? Anywhere you'd suggest I look?

This is the relevant piece of code:

        $response = $gateway->get_details_for( $_GET['token'], $_GET['PayerID']);

        $response = $gateway->purchase($response->amount());
        if ( $response->success() ) {
          echo 'Success payment!';
        } else {
          echo $response->message();
        }

        Merchant_Logger::print_ar($response);

I'm using the Sandbox at the moment.

Many thanks,

Matt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.