I'm currently in the process of developing a heavily Recurly integrated platform that Users constantly have the option of adding/editing/removing features that will immediately be reflected in their subscription pricing.
The environment for this project is Laravel 5.1 and attempting to use Recurly's PHP Client to simplify the API integration. In order to get a lot of the Recurly stuff to work, I had to add namespacing to the Recurly PHP Files in order to have them successfully referenced and reference one another inside Laravels Framework. i.e.
<?php
namespace App\Libraries\Recurly;
use DateTime;
use DOMDocument;
abstract class Recurly_Base
{
to all 44 or so class files involved in the 2.5.* version of the Recurly PHP library.
I can successfully use the library to generate subscriptions, but any time I try to update those subscriptions, I get this FatalErrorException thrown by PHP, and thrown by the same class I exampled above.
Call to private method Recurly_Base::addLink() from context 'App\Libraries\Recurly\Recurly_Base'
This error is thrown during this block of code
$user = $request->user();
$subscription = Recurly_Subscription::get($user->recurly_subscription_code);
$subscription->plan_code = '<plan_code>';
$user->subscription_pricing = $user->subscription_pricing + $newItemPrice;
$user->updated_at = $user->freshTimestamp();
$subscription->unit_amount_in_cents = $user->subscription_pricing;
$subscription->updateImmediately(); // <- The offending line
$user->save();
It seems that for some reason, the Recurly_Base class cannot access it's own private method addLink.
I attempted to resolve the issue by weakening the Visibility of all Recurly_Base methods and values so that the 'private'-ness of addLink wouldn't matter, but the FatalErrorException was still thrown.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire