Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change net refunded to total refunded for credit #70

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2621a1f
Change net refunded to total refunded for credit
bazgear Jul 30, 2014
df60d11
Saving responses into extended data
bazgear Aug 1, 2014
271195d
Change from total to gross
bazgear Aug 15, 2014
02aa4c8
Attention required on the appropriate object.
bazgear Aug 15, 2014
773bd35
Avoid PaymentPendingException for authorised payments.
oantonelli Apr 27, 2015
1188e1a
Merge pull request #1 from oantonelli/master
bazgear May 4, 2015
b6722a7
Add conditional to just trow a PaymentPendingException when the reaso…
oantonelli May 14, 2015
a709353
Merge pull request #2 from oantonelli/master
bazgear May 15, 2015
03bf2b0
Set processing amount for reverse approvals
bazgear May 28, 2015
1fb321d
Ensure that the capture id is used to refund (rather than the authori…
bazgear Jun 2, 2015
5d59f20
Change deposit functionality
bazgear Jun 10, 2015
300a907
allow the resolution of keyed credentials using an injected credentia…
Jul 13, 2015
6daefd9
fix broken call on requestDoVoid
Jul 14, 2015
c13098c
Adding in the retry blocks
Sep 2, 2015
c9cdab0
Merge pull request #3 from NeilMasters/feature/1150/updatingProcessIp…
bazgear Sep 2, 2015
f229e49
Changing over to has ipn decision
Sep 2, 2015
f306680
Merge pull request #4 from NeilMasters/bug/1150/updatingProcessingCom…
bazgear Sep 2, 2015
80f4c7e
Add ability to the perform reauthorisations
oantonelli Sep 3, 2015
707bfa8
Adding in the return statements
Sep 14, 2015
fcd16a5
sigh
Sep 14, 2015
13cd8c4
Merge pull request #7 from NeilMasters/feature/1150/addingInMandatory…
bazgear Sep 15, 2015
9848f9e
Change name to method.
oantonelli Sep 17, 2015
a79bc6b
Merge pull request #8 from oantonelli/misc/change_name
calumbrodie Sep 18, 2015
0f891d2
Using latest available tls
Feb 2, 2016
495c452
Merge pull request #9 from usemarkup/sslVersionUpdate
calumbrodie Feb 3, 2016
6f80752
feat: add functionality to recover payment after funding error
oantonelli Jul 19, 2016
edc81c7
Merge pull request #10 from oantonelli/feat/funding_paypal
calumbrodie Jul 21, 2016
151cb5d
refactor: use capture status instead of authorisation status to evalu…
oantonelli Sep 5, 2016
e39938f
change package name as fork makes its own tags which could conflict w…
Nov 28, 2017
2eb1ce5
Merge pull request #13 from usemarkup/change_package_name
shieldo Nov 28, 2017
e658549
add symfony 3/4 support
Nov 28, 2017
ad17335
restore form type alias (payment core bundle expects it)
Nov 28, 2017
8dafc47
feat(reapprove): set transaction status to success when payment statu…
oantonelli Sep 20, 2019
3de4f89
ci: add CI
gsdevme Jan 13, 2020
d06fab1
ci: switch to use sed vs compose resolution
gsdevme Jan 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
language: php
php:
- 5.4
- 5.3
- 7.1
- 7.3

matrix:
include:
- php: '7.1'
env: deps=low

env:
global:
- deps=high

before_script:
- composer install --dev
- if [ "$deps" = "high" ]; then composer install --ignore-platform-reqs; fi;
- if [ "$deps" = "low" ]; then sed -i -e 's/>=3.4 <5.0/^3.4/g' composer.json && composer --ignore-platform-reqs update; fi

script:
- vendor/bin/phpstan analyse -l 1 .
- export SYMFONY_DEPRECATIONS_HELPER=weak && vendor/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace JMS\Payment\PaypalBundle\Client\Authentication;

use JMS\Payment\CoreBundle\BrowserKit\Request;

interface KeyedCredentialsAuthenticationStrategyInterface
{
/**
* @param Request $request
* @param $key
*/
public function authenticateWithKeyedCredentials(Request $request, $key);
}
68 changes: 42 additions & 26 deletions Client/Client.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace JMS\Payment\PaypalBundle\Client;

use JMS\Payment\PaypalBundle\Client\Authentication\KeyedCredentialsAuthenticationStrategyInterface;
use Symfony\Component\BrowserKit\Response as RawResponse;

use JMS\Payment\CoreBundle\BrowserKit\Request;
Expand Down Expand Up @@ -40,76 +41,85 @@ public function __construct(AuthenticationStrategyInterface $authenticationStrat
$this->curlOptions = array();
}

public function requestAddressVerify($email, $street, $postalCode)
public function requestAddressVerify($email, $street, $postalCode, $key = null)
{
return $this->sendApiRequest(array(
'METHOD' => 'AddressVerify',
'EMAIL' => $email,
'STREET' => $street,
'ZIP' => $postalCode,
));
), $key);
}

public function requestBillOutstandingAmount($profileId, array $optionalParameters = array())
public function requestBillOutstandingAmount($profileId, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'BillOutstandingAmount',
'PROFILEID' => $profileId,
)));
)), $key);
}

public function requestCreateRecurringPaymentsProfile($token)
public function requestCreateRecurringPaymentsProfile($token, $key = null)
{
return $this->sendApiRequest(array(
'METHOD' => 'CreateRecurringPaymentsProfile',
'TOKEN' => $token,
));
), $key);
}

public function requestDoAuthorization($transactionId, $amount, array $optionalParameters = array())
public function requestDoAuthorization($transactionId, $amount, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoAuthorization',
'TRANSACTIONID' => $transactionId,
'AMT' => $this->convertAmountToPaypalFormat($amount),
)));
)), $key);
}

public function requestDoCapture($authorizationId, $amount, $completeType, array $optionalParameters = array())
public function requestDoReAuthorization($authorizationId, $amount, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoReAuthorization',
'AUTHORIZATIONID' => $authorizationId,
'AMT' => $this->convertAmountToPaypalFormat($amount),
)), $key);
}

public function requestDoCapture($authorizationId, $amount, $completeType, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoCapture',
'AUTHORIZATIONID' => $authorizationId,
'AMT' => $this->convertAmountToPaypalFormat($amount),
'COMPLETETYPE' => $completeType,
)));
)), $key);
}

public function requestDoDirectPayment($ipAddress, array $optionalParameters = array())
public function requestDoDirectPayment($ipAddress, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoDirectPayment',
'IPADDRESS' => $ipAddress,
)));
)), $key);
}

public function requestDoExpressCheckoutPayment($token, $amount, $paymentAction, $payerId, array $optionalParameters = array())
public function requestDoExpressCheckoutPayment($token, $amount, $paymentAction, $payerId, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoExpressCheckoutPayment',
'TOKEN' => $token,
'PAYMENTREQUEST_0_AMT' => $this->convertAmountToPaypalFormat($amount),
'PAYMENTREQUEST_0_PAYMENTACTION' => $paymentAction,
'PAYERID' => $payerId,
)));
)), $key);
}

public function requestDoVoid($authorizationId, array $optionalParameters = array())
public function requestDoVoid($authorizationId, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'DoVoid',
'AUTHORIZATIONID' => $authorizationId,
)));
)), $key);
}

/**
Expand All @@ -122,43 +132,44 @@ public function requestDoVoid($authorizationId, array $optionalParameters = arra
* @param string $returnUrl
* @param string $cancelUrl
* @param array $optionalParameters
* @param string $key
* @return Response
*/
public function requestSetExpressCheckout($amount, $returnUrl, $cancelUrl, array $optionalParameters = array())
public function requestSetExpressCheckout($amount, $returnUrl, $cancelUrl, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'SetExpressCheckout',
'PAYMENTREQUEST_0_AMT' => $this->convertAmountToPaypalFormat($amount),
'RETURNURL' => $returnUrl,
'CANCELURL' => $cancelUrl,
)));
)), $key);
}

public function requestGetExpressCheckoutDetails($token)
public function requestGetExpressCheckoutDetails($token, $key = null)
{
return $this->sendApiRequest(array(
'METHOD' => 'GetExpressCheckoutDetails',
'TOKEN' => $token,
));
), $key);
}

public function requestGetTransactionDetails($transactionId)
public function requestGetTransactionDetails($transactionId, $key = null)
{
return $this->sendApiRequest(array(
'METHOD' => 'GetTransactionDetails',
'TRANSACTIONID' => $transactionId,
));
), $key);
}

public function requestRefundTransaction($transactionId, array $optionalParameters = array())
public function requestRefundTransaction($transactionId, array $optionalParameters = array(), $key = null)
{
return $this->sendApiRequest(array_merge($optionalParameters, array(
'METHOD' => 'RefundTransaction',
'TRANSACTIONID' => $transactionId
)));
)), $key);
}

public function sendApiRequest(array $parameters)
public function sendApiRequest(array $parameters, $key = null)
{
// include some default parameters
$parameters['VERSION'] = self::API_VERSION;
Expand All @@ -169,7 +180,11 @@ public function sendApiRequest(array $parameters)
'POST',
$parameters
);
$this->authenticationStrategy->authenticate($request);
if (null !== $key && $this->authenticationStrategy instanceof KeyedCredentialsAuthenticationStrategyInterface) {
$this->authenticationStrategy->authenticateWithKeyedCredentials($request, $key);
} else {
$this->authenticationStrategy->authenticate($request);
}

$response = $this->request($request);
if (200 !== $response->getStatus()) {
Expand Down Expand Up @@ -236,6 +251,7 @@ public function request(Request $request)
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); // Latest TLS(1.x)
curl_setopt_array($curl, $this->curlOptions);
curl_setopt($curl, CURLOPT_URL, $request->getUri());
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function getConfigTree()
->scalarNode('cancel_url')->defaultNull()->end()
->scalarNode('notify_url')->defaultNull()->end()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->booleanNode('recover_from_funding_failure')->defaultFalse()->end()
->end()
->end()
->buildTree();
Expand Down
5 changes: 5 additions & 0 deletions DependencyInjection/JMSPaymentPaypalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,10 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('payment.paypal.express_checkout.cancel_url', $config['cancel_url']);
$container->setParameter('payment.paypal.express_checkout.notify_url', $config['notify_url']);
$container->setParameter('payment.paypal.debug', $config['debug']);
if ($config['recover_from_funding_failure']) {
$plugin = $container->getDefinition('payment.plugin.paypal_express_checkout');
$plugin->addMethodCall('setRedirectDueToFundingError', [$config['recover_from_funding_failure']]);
}

}
}
4 changes: 2 additions & 2 deletions Form/ExpressCheckoutType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
}

public function getName()
public function getBlockPrefix()
{
return 'paypal_express_checkout';
}
}
}
Loading