Skip to content

Commit e128bc1

Browse files
authored
Release v3.0.0 (#22)
* update namespace * add upgrading steps * add api docs * add other api docs
1 parent 00a4475 commit e128bc1

34 files changed

+906
-720
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Inorder to communicate with PayPal platform we need to set up a client first :
4040

4141
```php
4242
// import namespace
43-
use PayPal\Checkout\Environment\SandboxEnvironment;
44-
use PayPal\Checkout\Http\PayPalClient;
43+
use PayPal\Http\Environment\SandboxEnvironment;
44+
use PayPal\Http\PayPalClient;
4545

4646
// client id and client secret retrieved from PayPal
4747
$clientId = "<<PAYPAL-CLIENT-ID>>";
@@ -58,8 +58,8 @@ $client = new PayPalClient($environment);
5858

5959
```php
6060
// import namespace
61-
use PayPal\Checkout\Environment\ProductionEnvironment;
62-
use PayPal\Checkout\Http\PayPalClient;
61+
use PayPal\Http\Environment\ProductionEnvironment;
62+
use PayPal\Http\PayPalClient;
6363

6464
// client id and client secret retrieved from PayPal
6565
$clientId = "<<PAYPAL-CLIENT-ID>>";
@@ -80,7 +80,7 @@ $client = new PayPalClient($environment);
8080

8181
```php
8282
// Import namespace
83-
use PayPal\Checkout\Http\OrderCreateRequest;
83+
use PayPal\Checkout\Requests\OrderCreateRequest;
8484
use PayPal\Checkout\Orders\AmountBreakdown;
8585
use PayPal\Checkout\Orders\Item;
8686
use PayPal\Checkout\Orders\Order;
@@ -117,7 +117,7 @@ echo $result->status; // CREATED
117117

118118
```php
119119
// Import namespace
120-
use PayPal\Checkout\Http\OrderCaptureRequest;
120+
use PayPal\Checkout\Requests\OrderCaptureRequest;
121121

122122
// Create an order capture http request
123123
$request = new OrderCaptureRequest($order_id);

composer.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
"require": {
2020
"php": "^7.4|^8.0",
2121
"ext-json": "*",
22-
"guzzlehttp/psr7": "^1.6|^2.0",
23-
"guzzlehttp/guzzle": "^7.0",
24-
"brick/money": "^0.5.2"
22+
"brick/money": "^0.5.2",
23+
"phpjuice/paypal-http-client": "^1.0"
2524
},
2625
"require-dev": {
27-
"phpunit/phpunit": "^9.0",
2826
"squizlabs/php_codesniffer": "^3.4",
2927
"phpstan/phpstan": "^0.12",
3028
"pestphp/pest": "^1.18"

composer.lock

+93-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/amount-breakdown.md

+90-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,93 @@
11
# Amount Breakdown
22

3-
coming soon.
3+
See https://developer.paypal.com/docs/api/orders/v2/#definition-Amount_breakdown.
44

5+
## Methods
6+
7+
### AmountBreakdown::__construct()
8+
9+
Creates an amount breakdown object using constructor.
10+
11+
#### Signature
12+
13+
```php
14+
public function __construct(string $value, string $currency_code = 'USD');
15+
```
16+
17+
#### Example
18+
19+
```php
20+
$amount = new AmountBreakdown('100.00', 'USD');
21+
```
22+
23+
### AmountBreakdown::of()
24+
25+
Creates an amount from a value and an optional currency code.
26+
27+
#### Signature
28+
29+
```php
30+
public static function of(string $value, string $currency_code = 'USD'): AmountBreakdown;
31+
```
32+
33+
#### Example
34+
35+
```php
36+
$amount = AmountBreakdown::of('100.00', 'USD');
37+
```
38+
39+
### AmountBreakdown::getCurrencyCode()
40+
41+
Gets an amount currency code.
42+
43+
#### Signature
44+
45+
```php
46+
public function getCurrencyCode(): string;
47+
```
48+
49+
#### Example
50+
51+
```php
52+
$amount = AmountBreakdown::of('100.00', 'USD');
53+
$currency = $amount->getCurrencyCode(); // USD
54+
```
55+
56+
### AmountBreakdown::getValue()
57+
58+
Gets an amount value.
59+
60+
#### Signature
61+
62+
```php
63+
public function getValue(): string;
64+
```
65+
66+
#### Example
67+
68+
```php
69+
$amount = AmountBreakdown::of('100.00', 'USD');
70+
$value = $amount->getValue(); // '100.00'
71+
```
72+
73+
### AmountBreakdown::toArray()
74+
75+
Casts the AmountBreakdown an array representation, used when serializing an amount into http request.
76+
77+
#### Signature
78+
79+
```php
80+
public function toArray(): array;
81+
```
82+
83+
#### Example
84+
85+
```php
86+
$amount = AmountBreakdown::of('100.00', 'USD');
87+
$array = $amount->toArray();
88+
// result
89+
[
90+
'value' => '100.00',
91+
'currency_code' => 'USD'
92+
];
93+
```

docs/api/amount.md

+90-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,93 @@
11
# Amount
22

3-
coming soon.
3+
See https://developer.paypal.com/docs/api/orders/v2/#definition-Amount_breakdown.
44

5+
## Methods
6+
7+
### Amount::__construct()
8+
9+
Creates an amount object using constructor.
10+
11+
#### Signature
12+
13+
```php
14+
public function __construct(string $value, string $currency_code = 'USD');
15+
```
16+
17+
#### Example
18+
19+
```php
20+
$amount = new Amount('100.00', 'USD');
21+
```
22+
23+
### Amount::of()
24+
25+
Creates an amount from a value and an optional currency code.
26+
27+
#### Signature
28+
29+
```php
30+
public static function of(string $value, string $currency_code = 'USD'): Amount;
31+
```
32+
33+
#### Example
34+
35+
```php
36+
$amount = Amount::of('100.00', 'USD');
37+
```
38+
39+
### Amount::getCurrencyCode()
40+
41+
Gets an amount currency code.
42+
43+
#### Signature
44+
45+
```php
46+
public function getCurrencyCode(): string;
47+
```
48+
49+
#### Example
50+
51+
```php
52+
$amount = Amount::of('100.00', 'USD');
53+
$currency = $amount->getCurrencyCode(); // USD
54+
```
55+
56+
### Amount::getValue()
57+
58+
Gets an amount value.
59+
60+
#### Signature
61+
62+
```php
63+
public function getValue(): string;
64+
```
65+
66+
#### Example
67+
68+
```php
69+
$amount = Amount::of('100.00', 'USD');
70+
$value = $amount->getValue(); // '100.00'
71+
```
72+
73+
### Amount::toArray()
74+
75+
Casts the Amount an array representation, used when serializing an amount into http request.
76+
77+
#### Signature
78+
79+
```php
80+
public function toArray(): array;
81+
```
82+
83+
#### Example
84+
85+
```php
86+
$amount = Amount::of('100.00', 'USD');
87+
$array = $amount->toArray();
88+
// result
89+
[
90+
'value' => '100.00',
91+
'currency_code' => 'USD'
92+
];
93+
```

0 commit comments

Comments
 (0)