rebilly / rebilly-php Goto Github PK
View Code? Open in Web Editor NEWSDK for PHP
Home Page: https://www.rebilly.com
License: MIT License
SDK for PHP
Home Page: https://www.rebilly.com
License: MIT License
Hello guys!
Please, describe here and add to the README info about the thread-safety of the Rebilly\Client
class. Is it depend on the value of "httpHandler" option of the class? Particularly when the Rebilly\Http\GuzzleAdapter
used?
We propose adding an "expand" parameter to the refund method. This improvement, would allow users to specify additional resources to include in the response, reducing the number of requests needed to update information after a transaction refund.
Example Usage
$newTransaction = $coreService->transactions()->refund(id: 1, expand: 'invoices,parentTransaction');
Hi there, not really an issue but if you can add the "getType()" method from the "/Entities/Invoice.php" to return the invoice "type" attribute so we can get the invoice type when querying a particular invoice. We're using it for some reporting and we'd like to have that option and doesn't break our code when updating to the new SDK in the future.
Invoice Types: Renewal
, Initial
, One Time
, etc...
Please see attached file for the invoice types. Appreciate it!
Creating an payment with:
client->payments()->create($paymentForm)
fails, cause the Location Header is missing in the Response. It cant be parsed.
In entities/coupons/coupon.php function createRestriction. $data is beeing mapped there, but it contains objects, not arrays
Hey guys. For now UnprocessableEntityException
is marked as deprecated.
But it still used in @throws
PHPDocs instead of the new DataValidationException
.
Was it intentional or a mistake? Could we continue the deprecation of UnprocessableEntityException
by the use of DataValidationException
in PHPDocs?
Originally posted by @nevmerzhitsky in #333 (comment)
currently using: SDK v2.12.0
PHP Fatal error: Uncaught DomainException: Unexpected type. Only discounts-per-redemption,redemptions-per-customer,restrict-to-invoices,restrict-to-plans,restrict-to-subscriptions,total-redemptions,minimum-order-amount types support in /rebilly/client-php/src/Entities/Coupons/Restriction.php:99
Solution:
RestrictToProducts.php
inside /rebilly/client-php/src/Entities/Coupons/Restrictions/
/rebilly/client-php/src/Entities/Coupons/Restriction.php
to accept type: restrict-to-products
Hoping in the next release this will be added. thanks!
SDK version: 3.0.0
It will be great for introspection to have a specified template parameter of the class Paginator
in all Api-class methods whose return the Paginator
instance: CustomersApi::getAllPaginator()
, CustomersApi::getAllEddSearchResultsPaginator()
and so on like *Api::getAll*Paginator()
.
I mean we need just smth like this:
/**
* @return Paginator<EddSearchResult>
*/
public function getAllEddSearchResultsPaginator(
string $id,
?int $limit = null,
?int $offset = null,
): Paginator {
...
}
SDK Version: 3.0.0
Some model fields are arrays of other objects. And when $model->jsonSerialize()
is called, these arrays of objects aren't converted to JSON arrays, but remain objects.
// ...
if (array_key_exists('tags', $this->fields)) {
$data['tags'] = $this->fields['tags'];
}
ContactObject::jsonSerialize():
if (array_key_exists('phoneNumbers', $this->fields)) {
$data['phoneNumbers'] = $this->fields['phoneNumbers'];
}
if (array_key_exists('emails', $this->fields)) {
$data['emails'] = $this->fields['emails'];
}
Therefore a call $customer->jsonSerialize()
returns (partially):
array:23 [
"id" => "085e96b4-7f64-411b-9307-4b627f2b3007"
"websiteId" => "example.com"
"createdTime" => "2020-09-13T20:05:08+00:00"
"updatedTime" => "2021-12-03T11:20:38+00:00"
"customFields" => []
"primaryAddress" => array:14 [
"city" => "City 1"
"region" => "State"
"country" => "AF"
"postalCode" => "111222"
"phoneNumbers" => array:1 [
0 => Rebilly\Sdk\Model\ContactPhoneNumbers^ {#2667
-fields: array:3 [
"label" => "Main"
"value" => "+1234567890"
"primary" => true
]
}
]
"emails" => array:1 [
0 => Rebilly\Sdk\Model\ContactEmails^ {#2663
-fields: array:3 [
"label" => "Main"
"value" => "[email protected]"
"primary" => true
]
}
]
]
"tags" => array:1 [
0 => Rebilly\Sdk\Model\Tag^ {#2658
-fields: array:5 [
"id" => "3759a810-f836-436c-ae8c-40f5e0ff4efe"
"name" => "notes"
"type" => "customer"
"createdTime" => DateTimeImmutable @1623769937 {#2643
date: 2021-06-15 15:12:17.0 +00:00
}
"updatedTime" => DateTimeImmutable @1623769937 {#2657
date: 2021-06-15 15:12:17.0 +00:00
}
]
}
]
But all these objects in the subarrays must also be plain arrays.
I suggest fixing your PHP code generators to produce code like this:
$data['phoneNumbers'] = array_map(fn ($v) => $v->jsonSerialize(), $this->fields['phoneNumbers']);
Currently, WebsitesApi
is absent in CoreService,
whereas similar functionalities, such as PaymentInstrumentsApi
, are available in both CoreService
and UsersService
. We propose considering the inclusion of WebsitesApi
in CoreService
, given that the models PaymentInstrument
and Websites
inherently constitute part of a shared functionality.
This update aims to better organize access to the functionality.
Hello there
I'm currently work with Subscriptions, and when making a call to getAllPaginator with the 'expand' parameter set to 'website', I encounter the following error:
**Rebilly\Sdk\Model\SubscriptionOrderEmbedded::setWebsite(): Argument #1 ($website) must be of type ?object, array given, called in /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php on line 34**
Stacktrace:
[2024-02-02 10:29:47] local.ERROR: Rebilly\Sdk\Model\SubscriptionOrderEmbedded::setWebsite(): Argument #1 ($website) must be of type ?object, array given, called in /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php on line 34 {"userId":1,"exception":"[object] (TypeError(code: 0): Rebilly\\Sdk\\Model\\SubscriptionOrderEmbedded::setWebsite(): Argument #1 ($website) must be of type ?object, array given, called in /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php on line 34 at /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php:96)
[stacktrace]
#0 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php(34): Rebilly\\Sdk\\Model\\SubscriptionOrderEmbedded->setWebsite()
#1 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrderEmbedded.php(52): Rebilly\\Sdk\\Model\\SubscriptionOrderEmbedded->__construct()
#2 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrder.php(730): Rebilly\\Sdk\\Model\\SubscriptionOrderEmbedded::from()
#3 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrder.php(240): Rebilly\\Sdk\\Model\\SubscriptionOrder->setEmbedded()
#4 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionOrder.php(246): Rebilly\\Sdk\\Model\\SubscriptionOrder->__construct()
#5 /www/backend/vendor/rebilly/client-php/src/Model/SubscriptionFactory.php(24): Rebilly\\Sdk\\Model\\SubscriptionOrder::from()
#6 /www/backend/vendor/rebilly/client-php/src/Api/SubscriptionsApi.php(193): Rebilly\\Sdk\\Model\\SubscriptionFactory::from()
#7 [internal function]: Rebilly\\Sdk\\Api\\SubscriptionsApi->Rebilly\\Sdk\\Api\\{closure}()
#8 /www/backend/vendor/rebilly/client-php/src/Api/SubscriptionsApi.php(193): array_map()
#9 /www/backend/vendor/rebilly/client-php/src/Api/SubscriptionsApi.php(208): Rebilly\\Sdk\\Api\\SubscriptionsApi->getAll()
#10 /www/backend/vendor/rebilly/client-php/src/Paginator.php(122): Rebilly\\Sdk\\Api\\SubscriptionsApi->Rebilly\\Sdk\\Api\\{closure}()
#11 /www/backend/vendor/rebilly/client-php/src/Paginator.php(59): Rebilly\\Sdk\\Paginator->load()
#12 /www/backend/app/Repositories/SubscriptionRepository.php(77): Rebilly\\Sdk\\Paginator->current()
#13 /www/backend/app/Http/Controllers/CustomerController.php(55): App\\Repositories\\SubscriptionRepository->findByCustomerId()
Snippet:
$subscriptionsPaginator = $this->coreService->subscriptions()->getAllPaginator(
filter: Rebilly::buildFilterString(['customerId' => $ids]),
expand: 'website'
);
It seems that the SDK is unable to parse the object as expected. The issue might be related to the structure of the returned data. Could you please investigate this issue and provide guidance on how to resolve it?
This issue is not limited to the Subscription model; similar problems are observed with other models like Transactions.
SDK Version: 3.0.0
ENV: PHP 8.2
The response header "Location" does not contain the path, so the method parseJsonResponseBody fails.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.