Skip to content

Commit

Permalink
Merge pull request #2 from dojo-engineering/task/pppp-413-update-php-sdk
Browse files Browse the repository at this point in the history
Update SDK with latest changes
  • Loading branch information
Monica authored Dec 6, 2023
2 parents e03f4cb + bb4d2ca commit 246ac62
Show file tree
Hide file tree
Showing 114 changed files with 10,395 additions and 691 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dojo-php
# Dojo PHP SDK

The official [Dojo][dojo] PHP library, supporting Remote Payments API.
The official [Dojo][dojo] PHP library, supporting [Payments API][api-docs].

## Installation

Expand All @@ -21,18 +21,17 @@ Do the following:
composer install
```

2. Run from the root of the repository:
2. Run from the root of the repository (with `execute` permission):

```sh
/build/generate-openapi.sh
./build/generate-openapi.sh
```

3. Copy all files from `/generated/src` into `/src`

## Documentation

For a comprehensive list of examples, check out the [API
documentation][api-docs].
For a comprehensive list of examples, check out the [API documentation][api-docs].

## Usage

Expand All @@ -54,9 +53,10 @@ $req->setAmount($money);
$pi = $apiPaymentIntent->paymentIntentsCreatePaymentIntent(\Dojo_PHP\API_VERSION, $req);
```

For any requests, bugs, or comments, please [open an issue][issues] or [submit a pull request][pulls].
For any requests, bugs, or comments, please [open an issue][issues] or [submit a pull request][pulls]. You can also reach out to us on our [Discord server][discord].

[api-docs]: https://docs.dojo.tech
[api-docs]: https://docs.dojo.tech/payments/api
[issues]: https://github.com/dojo-engineering/Dojo.PHP/issues
[pulls]: https://github.com/dojo-engineering/Dojo.PHP/pulls
[dojo]: https://dojo.tech
[dojo]: https://dojo.tech
[discord]: https://discord.gg/tTG98EWVdB
29 changes: 29 additions & 0 deletions TestScript/setupIntentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace SetupIntent;
require_once "vendor/autoload.php";

use Dojo_PHP\ApiFactory;
use Dojo_PHP\Model\CreateSetupIntentRequest;
use Dojo_PHP\Model\Money;

$apiKey = "sk_sandbox_c8oLGaI__msxsXbpBDpdtwJEz_eIhfQoKHmedqgZPCdBx59zpKZLSk8OPLT0cZolbeuYJSBvzDVVsYvtpo5RkQ";
$apiSetupIntent = ApiFactory::createSetupIntentsApi($apiKey);

$req = new CreateSetupIntentRequest();

$money = new Money();
$money->setValue(100);
$money->setCurrencyCode("GBP");

$req->setIntendedAmount($money);
$req->setMerchantInitiatedTransactionType("NoShow");
$req->setTerms("Example terms");
$req->setReference("test");

$si = $apiSetupIntent->setupIntentsCreate(\Dojo_PHP\API_VERSION, $req);

echo $si;


?>
1 change: 0 additions & 1 deletion build/generate-openapi.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-g php \
-o /local/generated \
-c /local/build/open-api-config.json \
--global-property models,apis \
--additional-properties invokerPackage=Dojo_PHP \


Expand Down
Loading

0 comments on commit 246ac62

Please sign in to comment.