Skip to content

DRAFT: Potentially new SDK version #7

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 14 additions & 4 deletions TestScript/test.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
<?php
// The sandbox API key used in this example is public.
// Don't submit any personally identifiable information in any requests made with this key.
// Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
// for secure testing.

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

use Dojo_PHP\ApiFactory;
use Dojo_PHP\Model\CreatePaymentIntentRequest;
use Dojo_PHP\Model\Money;
use Dojo_PHP\Model\CaptureMode;
use Dojo_PHP\Model\AutoExpireAction;

$apiKey = "sk_sandbox_c8oLGaI__msxsXbpBDpdtwJEz_eIhfQoKHmedqgZPCdBx59zpKZLSk8OPLT0cZolbeuYJSBvzDVVsYvtpo5RkQ";
$apiPaymentIntent = ApiFactory::createPaymentIntentApi($apiKey);

$req = new CreatePaymentIntentRequest();
$req->setReference("test");
$req->setDescription("Demo payment intent");
$req->setReference("Order - 234");

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

$req->setAmount($money);

$pi = $apiPaymentIntent->paymentIntentsCreatePaymentIntent(\Dojo_PHP\API_VERSION, $req);
echo $pi;
$req->setCaptureMode(CaptureMode::MANUAL);
$req->setAutoExpireAction(AutoExpireAction::RELEASE);
$req->setAutoExpireIn("00:00:59");

$pi = $apiPaymentIntent->paymentIntentsCreatePaymentIntent(\Dojo_PHP\API_VERSION, $req);
36 changes: 36 additions & 0 deletions TestScript/test2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

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

use Dojo_PHP\ApiFactory;
use Dojo_PHP\Model\CreatePaymentIntentRequest;
use Dojo_PHP\Model\Customer;
use Dojo_PHP\Model\Money;
use Dojo_PHP\Model\PaymentMethod;
use Dojo_PHP\Model\SupportedPaymentMethods;
use Dojo_PHP\Model\Wallet;

$apiKey = "sk_sandbox_c8oLGaI__msxsXbpBDpdtwJEz_eIhfQoKHmedqgZPCdBx59zpKZLSk8OPLT0cZolbeuYJSBvzDVVsYvtpo5RkQ";
$client = ApiFactory::createPaymentIntentApi($apiKey);

$req = new CreatePaymentIntentRequest();
$req->setReference("test");
$req->setPaymentMethods(["Wallet"]);

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

$req->setAmount($money);

$customer = new Customer();
$customer->setId(123);
$customer->setEmailAddress("test@gmail.com");
$customer->setPhoneNumber(344332323);


$req->setCustomer($customer);

$pi = $client->paymentIntentsCreatePaymentIntent(\Dojo_PHP\API_VERSION, $req);
echo $pi;
2 changes: 1 addition & 1 deletion build/generate-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Generate the PHP client
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/openapi/2022-04-07.yaml \
-i /local/openapi/2024-02-05.yaml \
-g php \
-o /local/generated \
-c /local/build/open-api-config.json \
Expand Down
Loading