Giter Site home page Giter Site logo

mod-drupalcommerce's Introduction

mod-drupalcommerce

Payfast module v1.4.0 for for Drupal Commerce 2.x

This is the Payfast module for Drupal Commerce 2.x. Please feel free to contact the Payfast support team should you require any assistance.

Installation

You will need Drupal 9 or 10 with the latest version of Drupal Commerce 2 installed.

Option 1 - Manual install

  1. Unzip and copy the payfast folder to the /modules/contrib/commerce/modules directory.
  2. Log into the admin dashboard and install Commerce Payfast on the Extend page.
  3. Navigate to Commerce -> Configuration -> Payment gateways and click on Add payment gateway.
  4. Select Payfast and configure as required.
  5. Click Save.

Option 2 - Automatic install

  1. In your composer.json add the following under "repositories": [
{ "type": "package", "package": { "name": "payfast", "version": "1.4.0", "type": "drupal-module", "source": { "
   url": "https://github.com/Payfast/mod-drupalcommerce.git", "type": "git", "reference": "master" } } },
  1. In your composer.json add the following under "extra": { "installer-paths": {
"modules/commerce/modules": [ "payfast" ]
  1. Require the module using composer.

composer require 'payfast:^1.4.0'

Please click here for more information concerning this module.

Collaboration

Please submit pull requests with any tweaks, features or fixes you would like to share.

mod-drupalcommerce's People

Contributors

appinlet avatar isgak-salie avatar brendon-p avatar

Stargazers

Mark Eason avatar Stew West avatar

Watchers

James Cloos avatar Jonathan Smit avatar Stew West avatar  avatar  avatar Thinus Barnard avatar  avatar

Forkers

stewest appinlet

mod-drupalcommerce's Issues

PayFast is Drupal 10 ready

I tested PayFast using Drupal 10 install and it works

Simply add drupal 10 to commerce_payfast.info.yml

core_version_requirement: ^8 || ^9 || ^10

Payment status is not set to complete

After payment has been made successfully the payment status is set to "new" instead of "completed"
According to drupal
https://docs.drupalcommerce.org/v2/developer-guide/payments/creating-payment-gateway/#capturing-payments-authorizations

$payment->setState('completed');

Should be set after a payment was made successfully.
Instead payfast sets the payment state to "new".

I tried adding
$payment->setState('completed');

to

`//// Check status and update order
if (!$pfError) {

        pflog('Check status and update order');

        if ($pfData['payment_status'] == 'COMPLETE') {

          $payment_storage = $this->entityTypeManager->getStorage('commerce_payment');
          $payment = $payment_storage->create([
            'state' => 'completed',
            'amount' => $pfData['amount_gross'],
            'payment_gateway' => $this->parentEntity->id(),
            'order_id' => $pfData['custom_int1'],
            'remote_id' => $pfData['pf_payment_id'],
            'remote_state' =>  $pfData['payment_status'],
          ]);
		  $payment->setState('completed');
          $payment->setRefundedAmount(new Price(0.00, 'ZAR'));
          $payment->setAmount(new Price($pfData['amount_gross'], 'ZAR'));
          $payment->save();
        }
    }

    if ($pfError) {
        pflog('Error: ' . $pfErrMsg);
    }
}

}`

But this did not work.
All payments received are set to "new" and a "payment complete" date does not show under the order payment details.

Update the module structure to work with Drupal 8 Composer requirement

Hi. Thanks to the original drupal devs and Payfast devs for making this module available for Drupal 8.

With Drupal 8 we begin to see recommendations for using Composer for installing contrib modules and their dependencies
https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies

I've forked and updated your repo here, and tested it
https://github.com/stewest/commerce_payfast

Perhaps you'd want to make a Composer branch option on this repo?

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.