Giter VIP home page Giter VIP logo

payumbundlesandbox's Introduction

Payum Bundle Sandbox

Welcome to the Payum Bundle Sandbox - a fully-functional Symfony2 application that you can use as the skeleton for your new applications.

This document contains information on how to download, install, and start using Payum Bundle.

For a more detailed explanation, see:

  1. Installation

First of all clone this repository on your local machine:

git clone [email protected]:makasim/PayumBundleSandbox.git folder-name

As Symfony and PayumBundle uses Composer to manage its dependencies, now it's time to install them.

If you don't have Composer yet, download it following the instructions on http://getcomposer.org/ or just run the following command:

curl -s http://getcomposer.org/installer | php

Then go to the folder where you downloaded the repository and symply run

composer install
  1. Checking your System Configuration

Before starting coding, make sure that your local system is properly configured for Symfony.

Execute the check.php script from the command line:

php app/check.php

Warning:

Don't forget to configure a payment gateway options in app/config/parameters.yml.

  1. Configure the application

To make the images, css files and other files needed to display the web pages, you need to install them.

Run:

app/console assets:install

In the folder web/bundles will be copied all the required files that are used to render the web pages.

Then create the database and its schema

app/console doctrine:database:create && app/console doctrine:schema:update --force
  1. Run the web server

To use the app, you have to run the php built-in webserver using the Symfony's command

app/console server:start
  1. Browsing the Demo Application

Congratulations! You're now using Symfony! :)

Go to http://127.0.0.1 and you will see the Symfony's Welcome Page that tells you

Your application is now ready. You can start working on it at

Now you can start navigating the app.

Go to http://127.0.0.1:8000/demo/ and you will se a list of available demos created by Symfony itself.

To see the list of demos of payment gateways, instead, go to http://127.0.0.1:8000/payment.

payumbundlesandbox's People

Contributors

66ton99 avatar aerendir avatar makasim avatar pamil avatar pborreli avatar skadabr avatar thiphamyp 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

payumbundlesandbox's Issues

Need to add check for Resources folder in check.php

I got "Your configuration looks good to run Symfony." but after I went to /app_dev.php/payment and tried to execute payment I received:

Warning: file_put_contents(/app/Resources/payments/payum-model-51430c65d5f1e): failed to open stream: Permission denied in /vendor/payum/payum/src/Payum/Storage/FilesystemStorage.php line 63

Bug: Stripe > Create Subscription

After filling in the Stripe form (in the JS box provided by Stripe, after clicking on the "pay" button in the previous page - is this the expected behavior?), an error is returned:

The either card token or customer id has to be set.

The error is caused by Payum\Stripe\Action\Api\CreateChargeAction.

The code that causes the error is this:

if (false == ($model['card'] || $model['customer'])) {
    throw new LogicException('The either card token or customer id has to be set.');
}

While this is the dump of the $model object passed:

storage: array:4 [▼
    "amount" => 100
    "currency" => "USD"
    "local" => array:2 [▼
      "save_card" => true
      "customer" => array:3 [▼
        "plan" => "gold"
        "card" => "tok_18uLfdJeKiEdErWDeAiUlbel"
        "error" => array:3 [▶]
      ]
    ]
    "status" => "failed"
  ]

So, the things are only two:

Or is the Action that is wrong, or is the $model.

But I've done another test, configuring the Acme\StripeBundle\Controller\prepareSubscriptionAction in this way:

    if ($form->isSubmitted() && $form->isValid()) {
        /** @var $payment PaymentDetails */
        $payment = $storage->create();
        $payment["amount"] = 100;
        $payment["currency"] = 'USD';
        $payment['customer'] = ['plan' => 'test_plan'];
        $payment["local"] = ['save_card' => true];
        $storage->update($payment);

        $captureToken = $this->getPayum()->getTokenFactory()->createCaptureToken(
            $gatewayName,
            $payment,
            'acme_payment_done'
        );

        return $this->redirect($captureToken->getTargetUrl());
    }

This time, the entire procedure completes, but an error from Stripe is returned (test_plan exists on my Stripe account as I created it for this test):

{
    "amount": 100,
    "currency": "USD",
    "customer": {
        "plan": "test_plan"
    },
    "local": {
        "save_card": true
    },
    "error": {
        "type": "invalid_request_error",
        "message": "Invalid string id: {\"plan\"=>\"test_plan\"}",
        "param": "customer"
    }
}

Now, as I don't know what is exactly the expected behavior, I cannot fix it, and, as I don't know the Stripe library very well nor the StripeBundle itself, I'm not able to identify the exact point where the fix has to be applied.

@makasim , can you help me, please?

Fix Stripe > Create subscription

When testing the subscription example the following error is returned:

The either card token or customer id has to be set.

    in vendor/payum/payum/src/Payum/Stripe/Action/Api/CreateChargeAction.php at line 46   -

    $model = ArrayObject::ensureArrayObject($request->getModel());
    if (false == ($model['card'] || $model['customer'])) {
        throw new LogicException('The either card token or customer id has to be set.');
    }
    if (is_array($model['card'])) {

Composer requirements

Hi,

The current composer requirements make it annoying to install:

$ composer create-project payum/payum-bundle-sandbox payum-sandbox
Installing payum/payum-bundle-sandbox (0.10.0)
  - Installing payum/payum-bundle-sandbox (0.10.0): Downloading (100%)
Created project in payum-sandbox
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for authorizenet/authorizenet 1.8.3.3 -> satisfiable by authorizenet/authorizenet[1.8.3.3].
    - authorizenet/authorizenet 1.8.3.3 requires php ~5.3 -> your PHP version (7.0.0) does not satisfy that requirement.
  Problem 2
    - Installation request for doctrine/mongodb 1.3.0 -> satisfiable by doctrine/mongodb[1.3.0].
    - doctrine/mongodb 1.3.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
  Problem 3
    - doctrine/mongodb 1.3.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb-odm 1.1.1 requires doctrine/mongodb ~1.3 -> satisfiable by doctrine/mongodb[1.3.0].
    - Installation request for doctrine/mongodb-odm 1.1.1 -> satisfiable by doctrine/mongodb-odm[1.1.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\wamp\bin\php\php7.0.0\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Is MongoDB mandatory to use the sandbox?

Thanks!

Custom gateway example not working

Hi.

I'm implementing my custom factory/actions for Liqpay and used Sandbox code as an example, but without success.

Having same error that I have on web version of Sandbox...

When I trying custom gateway example - it redirects to http://sandbox.payum.forma-dev.com/payment/capture/Kb-T1F3fxaZqAmsDRNfHTxuBSH1OJ09xEH8sQ4aPhcI with exception Request Capture{model: Identity} is not supported.

That would be great if this example become working, so I can do my factory/actions based on this example.

Thanks.

PS Also looks like method createPayment never called, because there is no code that call this method. Maybe it should be just create (if I understand right)?

Create a new Payment class for Stripe

As Stripe gateway support the base Payment class, to be more clear a new Payment class should be created that extends from Payum\Core\Model\Payment.

All examples should be updated consequently.

Update app to Symfony 2.8.11

The current version of the app is really really old and it doesn't work.

Update the version of the sandbox to Symfony 2.8.11 that is the latest available version of Symfony.

ManageRecurringPaymentsProfileStatusRequest support

trying to execute ManageRecurringPaymentsProfileStatusRequest throws Request Payum\Paypal\ExpressCheckout\Nvp\Request\Api\ManageRecurringPaymentsProfileStatusRequest is not supported.

It's just me or it's there but not supported?

undefined method __set_state()

I have an error:

Fatal error: Call to undefined method Symfony\Component\DependencyInjection\Parameter::__set_state() in app\cache\dev\appDevDebugProjectContainer.php on line 4279

Line 4279:
'payum.context.simple_purchase_paypal_express_checkout_doctrine.payment.class' => Symfony\Component\DependencyInjection\Parameter::__set_state(array(
'id' => 'payum.payment.class',
)),

Why there are both Payment and PaymentDetails?

I'm looking into the bundle and seen that there are two different entities: Acme\PaymentBundle\Entity\PaymentDetails and Acme\PaymentBundle\Entity\Payment.

Is there a reason for this or is only something to fix?

I think this is linked to the issue on PayumBundle #388.

Can you give me some advice about this so I can fix and make them omogeneous? It is now very confusing!

Paypal Express Checkout

I am using Paypal Express Checkout with doctrine as storage but when I go to sandbox paypal page no order details products in it.

This is my test code:

$paymentName = 'paypal_express_checkout_plus_doctrine';

$eBook = array(
    'author' => 'Jules Verne', 
    'name' => 'The Mysterious Island',
    'description' => 'The Mysterious Island is a novel by Jules Verne, published in 1874.',
    'price' => 2.64,
    'currency_symbol' => '$',
    'currency' => 'USD',
    'quantity' => 2
);        

if ('POST' === $request->getMethod()) {
  $storage = $this->getPayum()->getStorageForClass(
      'Acme\PaypalExpressCheckoutBundle\Entity\PaymentDetails',
      $paymentName
  );

  $paymentDetails = $storage->createModel();
  $paymentDetails->setPaymentrequestCurrencycode(0, $eBook['currency']);
  $paymentDetails->setPaymentrequestAmt(0,  $eBook['price'] * $eBook['quantity']);

  $paymentDetails->setNoshipping(Api::NOSHIPPING_NOT_DISPLAY_ADDRESS);
  $paymentDetails->setReqconfirmshipping(Api::REQCONFIRMSHIPPING_NOT_REQUIRED);
  $paymentDetails->setLPaymentrequestItemcategory(0, 0, Api::PAYMENTREQUEST_ITERMCATEGORY_DIGITAL);
  $paymentDetails->setLPaymentrequestAmt(0, 0, $eBook['price']);
  $paymentDetails->setLPaymentrequestQty(0, 0, $eBook['quantity']);
  $paymentDetails->setLPaymentrequestName(0, 0, $eBook['author'].'. '.$eBook['name']);
  $paymentDetails->setLPaymentrequestDesc(0, 0, $eBook['description']);

  $storage->updateModel($paymentDetails);

  $captureToken = $this->getTokenManager()->createTokenForCaptureRoute(
      $paymentName,
      $paymentDetails,
      'acme_payment_details_view'
  );

  $paymentDetails->setReturnurl($captureToken->getTargetUrl());
  $paymentDetails->setCancelurl($captureToken->getTargetUrl());
  $paymentDetails->setInvnum($paymentDetails->getId());
  $storage->updateModel($paymentDetails);

  return $this->redirect($captureToken->getTargetUrl());
} 

Can someone help me ?

Sorry by my English.

RecurringPayment invalid token error 11502

Hey guys,

i followed this tutorial https://github.com/Payum/PaypalExpressCheckoutNvp/blob/master/Resources/docs/recurring-payments-basics.md

and tried to use the "RecurringPaymentExamplesController" of this bundle. Both gave me this Response:

[2014-11-05 19:22:58] doctrine.DEBUG: UPDATE RecurringPaymentDetails SET details = ? WHERE id = ? [{"TOKEN":"EC-7F052032G63804811","DESC":"Subscribe to weather forecast for a week. It is 0.05$ per day.","EMAIL":"[email protected]","AMT":0.05,"CURRENCYCODE":"EUR","BILLINGFREQUENCY":7,"PROFILESTARTDATE":"2014-11-05T19:22:56+01:00","BILLINGPERIOD":"Day","TIMESTAMP":"2014-11-05T18:22:57Z","CORRELATIONID":"c693bcdbc9b2","ACK":"Failure","VERSION":"65.1","BUILD":"13630372","L_ERRORCODE0":"11502","L_SHORTMESSAGE0":"Invalid Token","L_LONGMESSAGE0":"The token is invalid","L_SEVERITYCODE0":"Error","PAYMENTREQUEST_0_PAYMENTACTION":"Sale"},11] 

I googled that invalid token error and got something about an redirect/token issue. But i'm still failing. Do you know how to solve this?

    public function createAgreementAction(Request $request)
    {
        $paymentName = 'paypal';

        $subscription = $this->getWeatherForecastSubscriptionDetails();

        if ($request->isMethod('POST')) {
            $storage = $this->getPayum()->getStorage('Comp\Bundle\MyBundle\Entity\AgreementDetails');

            /** @var $agreement AgreementDetails */
            $agreement = $storage->createModel();
            $agreement['PAYMENTREQUEST_0_AMT'] = 0;
            $agreement['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
            $agreement['L_BILLINGAGREEMENTDESCRIPTION0'] = $subscription['description'];
            $agreement['NOSHIPPING'] = 1;
            $storage->updateModel($agreement);

            $captureToken = $this->getTokenFactory()->createCaptureToken(
                $paymentName,
                $agreement,
                'acme_paypal_express_checkout_create_recurring_payment'
            );

            $agreement['RETURNURL'] = $captureToken->getTargetUrl();
            $agreement['CANCELURL'] = $captureToken->getTargetUrl();
            $agreement['INVNUM'] = $agreement->getId();
            $storage->updateModel($agreement);

            return $this->redirect($captureToken->getTargetUrl());
        }

        return array(
            'subscription' => $subscription,
            'paymentName' => $paymentName
        );
    }

Best regards
Tobi

Problems with payments and recurring payments entities database generation

Given:
I use symfony 2.1.11
I want recurrent payments entities to store in DB not file system (on file system it already works, so code should be fine)
Declarations of entities is 1:1 with sandbox bundle, no differences, config files are exact match.

Only difference i see is sandbox bundle uses symfony 2.2.*, so maybe there is some problems.

The environment is not set correctly: why?

@makasim , In my previous PR #75 , I updated all the sandbox to Symfony 2.8.11 and once the server were started with a simple app/console server:start all worked well.

Now, if do the same thing, I receive an error:

Internal error. The environment is not configured correctly. Please set SYMFONY_ENV and SYMFONY_DEBUG.

Why? It is really necessary to make the developer choose in which environment he wants to run the app?

I've also edited the README.md file telling that a simple app/console server:start is sufficient to run the app, but it is not correct now.

So, I think a decision is required: make the developer necessary choose in which environment start the app (and editing the README.md accordingly) or, make the app run again in the default dev environment (leaving the READDME.md as now is).

Unrecognized options when installing your bundle

Hello,

I want to use PayumBundle, I tried to configured it as the documentation said but I had some problems.
So I decided to try the sandbox, but I've the same errors:

Unrecognized options "factory, username, password, signature, sandbox" under "payum.gateways.paypal_express_checkout_and_doctrine_orm"

Any idea?

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.