Skip to content

Commit

Permalink
Release 1.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
sbossert committed Nov 27, 2019
1 parent 30a5de1 commit 6de98cf
Show file tree
Hide file tree
Showing 437 changed files with 139,435 additions and 80,502 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ This repository contains the PrestaShop wallee payment module that enables the s

## Documentation

* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.1.8/docs/en/documentation.html)
* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.1.9/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/wallee-payment/prestashop-1.6/blob/1.1.8/LICENSE) for more information.
Please see the [license file](https://github.com/wallee-payment/prestashop-1.6/blob/1.1.9/LICENSE) for more information.

## Other PrestaShop Versions

Expand Down
4 changes: 2 additions & 2 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/prestashop-1.6/releases/tag/1.1.8/">
<a href="https://github.com/wallee-payment/prestashop-1.6/releases/tag/1.1.9/">
Source
</a>
</li>
Expand Down Expand Up @@ -50,7 +50,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/wallee-payment/prestashop-1.6/releases/tag/1.1.8/">Download</a> the module.</p>
<p><a href="https://github.com/wallee-payment/prestashop-1.6/releases/tag/1.1.9/">Download</a> the module.</p>
</li>
<li>
<p>Login to the backend of your PrestsShop store.</p>
Expand Down
48 changes: 46 additions & 2 deletions inc/Service/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ class WalleeServiceTransaction extends WalleeServiceAbstract
* @var \Wallee\Sdk\Service\TransactionService
*/
private $transactionService;

/**
* The transaction iframe API service to retrieve js url.
*
* @var \Wallee\Sdk\Service\TransactionIframeService
*/
private $transactionIframeService;

/**
* The transaction payment page API service to retrieve redirection url.
*
* @var \Wallee\Sdk\Service\TransactionPaymentPageService
*/
private $transactionPaymentPageService;

/**
* The charge attempt API service.
Expand All @@ -57,6 +71,36 @@ protected function getTransactionService()
}
return $this->transactionService;
}

/**
* Returns the transaction iframe API service.
*
* @return \Wallee\Sdk\Service\TransactionIframeService
*/
protected function getTransactionIframeService()
{
if ($this->transactionIframeService === null) {
$this->transactionIframeService = new \Wallee\Sdk\Service\TransactionIframeService(
WalleeHelper::getApiClient()
);
}
return $this->transactionIframeService;
}

/**
* Returns the transaction API payment page service.
*
* @return \Wallee\Sdk\Service\TransactionPaymentPageService
*/
protected function getTransactionPaymentPageService()
{
if ($this->transactionPaymentPageService === null) {
$this->transactionPaymentPageService = new \Wallee\Sdk\Service\TransactionPaymentPageService(
WalleeHelper::getApiClient()
);
}
return $this->transactionPaymentPageService;
}

/**
* Returns the charge attempt API service.
Expand Down Expand Up @@ -106,7 +150,7 @@ public function waitForTransactionState(Order $order, array $states, $maxWaitTim
public function getJavascriptUrl(Cart $cart)
{
$transaction = $this->getTransactionFromCart($cart);
return $this->getTransactionService()->buildJavaScriptUrl(
return $this->getTransactionIframeService()->javascriptUrl(
$transaction->getLinkedSpaceId(),
$transaction->getId()
);
Expand All @@ -120,7 +164,7 @@ public function getJavascriptUrl(Cart $cart)
*/
public function getPaymentPageUrl($spaceId, $transactionId)
{
return $this->getTransactionService()->buildPaymentPageUrl($spaceId, $transactionId);
return $this->getTransactionPaymentPageService()->paymentPageUrl($spaceId, $transactionId);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion views/templates/admin/admin_help_buttons.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<div class="alert alert-info">
<img src="../modules/wallee/logo.png" style="float:left; margin-right:15px;" height="50">
<p><strong>{l s='This module requires an %s account.' sprintf='wallee' mod='wallee'}</strong></p>
<p><a class="btn btn-default" href="https://app-wallee.com/user/signup" target="_blank">{l s='Sign Up' mod='wallee'}</a> <a class="btn btn-default" href="https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.1.8/docs/en/documentation.html" target="_blank">{l s='Documentation' mod='wallee'}</a></p>
<p><a class="btn btn-default" href="https://app-wallee.com/user/signup" target="_blank">{l s='Sign Up' mod='wallee'}</a> <a class="btn btn-default" href="https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.1.9/docs/en/documentation.html" target="_blank">{l s='Documentation' mod='wallee'}</a></p>
</div>
23 changes: 23 additions & 0 deletions wallee-sdk/.php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('test')
->exclude('tests')
->in(__DIR__)
);
5 changes: 1 addition & 4 deletions wallee-sdk/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
language: php
sudo: false
php:
- 5.4
- 5.6
- 7.0
- 7.1
before_install: "composer install"
script: "phpunit --bootstrap autoload.php test/"
script: "phpunit --bootstrap autoload.php test/"
4 changes: 2 additions & 2 deletions wallee-sdk/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2019 customweb GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
70 changes: 58 additions & 12 deletions wallee-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[![Build Status](https://travis-ci.org/wallee-payment/php-sdk.svg?branch=master)](https://travis-ci.org/wallee-payment/php-sdk)

# wallee SDK for PHP
# wallee PHP Library

This repository contains the open source PHP SDK that allows you to access wallee from your PHP app.
The wallee PHP library wraps around the wallee API. This library facilitates your interaction with various services such as transactions, accounts, and subscriptions.

## Requirements

* [PHP 5.6.0 and later](http://www.php.net/)

## Documentation

https://app-wallee.com/doc/api/web-service
[wallee Web Service API](https://app-wallee.com/doc/api/web-service)

## Requirements

- PHP 5.6.0 and above

## Installation

Expand Down Expand Up @@ -39,24 +40,44 @@ require_once '/path/to/php-sdk/autoload.php';
```

## Usage
The library needs to be configured with your account's space id, user id, and secret key which are available in your [wallee
account dashboard](https://app-wallee.com/account/select). Set `space_id`, `user_id`, and `api_secret` to their values.

### Basic Example
### Configuring a Service

```php
<?php
require_once(__DIR__ . '/autoload.php');

// Configuration
$spaceId = 405;
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\ApiClient($userId, $secret);

// Create API service instance
$transactionService = new \Wallee\Sdk\Service\TransactionService($client);
$transactionPaymentPageService = new \Wallee\Sdk\Service\TransactionPaymentPageService($client);

```

To get started with sending transactions, please review the example below:

```php
require_once(__DIR__ . '/autoload.php');

// Configuration
$spaceId = 405;
$userId = 512;
$secret = "FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=";
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\ApiClient($userId, $secret);

// Create API service instance
$transactionService = new \Wallee\Sdk\Service\TransactionService($client);
$transactionPaymentPageService = new \Wallee\Sdk\Service\TransactionPaymentPageService($client);

// Create transaction
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
Expand All @@ -69,19 +90,44 @@ $lineItem->setType(\Wallee\Sdk\Model\LineItemType::PRODUCT);


$transaction = new \Wallee\Sdk\Model\TransactionCreate();
$transaction->setCurrency("EUR");
$transaction->setCurrency('EUR');
$transaction->setLineItems(array($lineItem));
$transaction->setAutoConfirmationEnabled(true);

$createdTransaction = $transactionService->create($spaceId, $transaction);

// Create Payment Page URL:
$redirectionUrl = $transactionService->buildPaymentPageUrl($spaceId, $createdTransaction->getId());
$redirectionUrl = $transactionPaymentPageService->paymentPageUrl($spaceId, $createdTransaction->getId());

header('Location: ' . $redirectionUrl);

```
### HTTP Client
You can either use `php curl` or `php socket` extentions. It is recommend you install the necessary extentions and enable them on your system.

You have to ways two specify which HTTP client you prefer.

```php
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\Sdk\ApiClient($userId, $secret);

$httpClientType = \Wallee\Sdk\Sdk\Http\HttpClientFactory::TYPE_CURL; // or \Wallee\Sdk\Sdk\Http\HttpClientFactory::TYPE_SOCKET

$client->setHttpClientType($httpClientType);
```

You can also specify the HTTP client via the `WLE_HTTP_CLIENT` environment variable. The possible string values are `curl` or `socket`.


```php
<?php
putenv('WLE_HTTP_CLIENT=curl');
?>
```

## License

Please see the [license file](LICENSE) for more information.
Please see the [license file](https://github.com/wallee-payment/php-sdk/blob/master/LICENSE) for more information.
9 changes: 5 additions & 4 deletions wallee-sdk/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "wallee/sdk",
"name": "wallee/sdk",
"version": "2.0.5",
"description": "wallee SDK for PHP",
"keywords": [
"wallee",
Expand All @@ -8,7 +9,7 @@
"sdk",
"api"
],
"homepage": "https://www.wallee.com",
"homepage": "http://github.com/wallee-payment/php-sdk",
"license": "Apache-2.0",
"authors": [
{
Expand All @@ -17,7 +18,7 @@
}
],
"require": {
"php": ">=5.4",
"php": ">=5.6",
"ext-json": "*",
"ext-mbstring": "*"
},
Expand All @@ -30,4 +31,4 @@
"autoload-dev": {
"psr-4": { "Wallee\\Sdk\\" : "test/" }
}
}
}
Loading

0 comments on commit 6de98cf

Please sign in to comment.