Skip to content

Integration Packages

Integration packages provide abstractions and implementations for connecting with external services.

Core abstractions and base classes for all integration implementations.

  • Sync pattern for CRUD operations
  • Integration mapping for linking vendor data
  • Structured exception hierarchy
  • File-based logging with vendor context
abstract class Integrator {
abstract function syncAll(): array;
abstract function sync(IntegrationMapping $mapping): array;
}
abstract class Sync {
abstract function execute(): void;
}
IntegrationExceptionInterface
├── ConnectException
├── UnauthorizedException
├── ForbiddenException
├── NotFoundException
├── UnexpectedValueException
├── TimeoutException
├── ServiceUnavailableException
├── TooManyRequestException
├── FileOutdatedException
├── FileDeliveryException
└── FileNotFoundException
// Sync result format
[
$advisor_id => [
$household_id => [
'accounts' => [$account_id => [$position_ids]],
'insurances' => [$insurance_id => []],
'persons' => [$person_id],
]
]
]
  • core-models, laravel-sentry
  • illuminate-http-problem-response

File-based integrations for custodians and vendors.

VendorFile TypeData Types
AllianzCustomLife insurance, investments
JacksonCustomLife insurance, investments
ApexCSVInvestment accounts
AltruistCSVPortfolio data
BettermentCSVInvestment accounts
InteractiveBrokersFixed-widthAccounts, positions
FirstClearingFixed-width (NSCC)Accounts, securities
FidelityCSVInvestment accounts
SchwabCSVInvestment accounts
PershingCSVInvestment accounts
RBCCSVInvestment accounts
RaymondJamesCSVInvestment accounts
FlourishCSVBank accounts
// CSV-based
interface CsvFileTypeInterface extends FileTypeInterface {
public function getHeaders(): array;
public function getFieldMappings(): array;
}
// Fixed-width (NSCC)
class NsccFileType {
public function getColumnDefinitions(): array;
}
  1. Advisor uploads file via REST API
  2. File stored in S3/SFTP
  3. Background job parses file
  4. Holdings/accounts stored in database
  5. Data available for mapping to households

Stripe payment processing and subscription management.

  • Customer and subscription management
  • Payment method handling
  • Tax calculation
  • Coupon/discount processing
  • Webhook event handling
use RightCapital\LaravelStripe\Stripe;
use RightCapital\LaravelStripe\StripeConnect;
// Customer management
Stripe::createCustomer('user@example.com', [
'name' => 'John Doe',
'metadata' => ['user_id' => 123],
]);
// Subscription management
Stripe::createSubscription($customer_id, $price_id);
Stripe::cancelSubscription($subscription_id);
// Coupon handling
$coupon = Stripe::getCoupon('DISCOUNT20');
// Tax calculation
Stripe::applyTaxToLocation('94105');
// Webhook processing
$event = Stripe::constructWebhookEvent($payload, $signature);
config/services.php
'stripe' => [
'secret' => env('STRIPE_SECRET'),
'webhook' => [
'secret' => env('STRIPE_WEBHOOK_SECRET'),
],
'max_network_retries' => 3,
],
  • CouponNotFound
  • CustomerNotFound
  • SubscriptionNotFound
  • PaymentMethodNotFound
  • InvalidTaxLocation

Salesforce CRM integration for enterprise features.

SObjectPurpose
AccountSobjectCRM Accounts
ContactSobjectContacts
LeadSobjectSales leads
OpportunitySobjectOpportunities
UserSobjectSalesforce users
TaskSobjectTask activities
EventSobjectEvent activities
CampaignMemberSobjectCampaign memberships
AdvisorInvitationSobjectCustom: advisor invitations
use RightCapital\LaravelSalesforce\Salesforce;
// Create account
Salesforce::account()->create(['Name' => 'Acme Corp']);
// Find by ID
$contact = Salesforce::contact()->find($salesforce_id);
// Find by external ID
$opp = Salesforce::opportunity()->findByExternalId('ext-123', 'External_ID__c');
// Query
$results = Salesforce::account()->query(
"SELECT Id, Name FROM Account WHERE Name LIKE '%Pattern%'"
);
// Update
Salesforce::task()->update($id, ['Status' => 'Completed']);
// Delete
Salesforce::lead()->delete($id);
config/services.php
'salesforce' => [
'credentials' => [
'client_id' => env('SALESFORCE_CLIENT_ID'),
'client_secret' => env('SALESFORCE_CLIENT_SECRET'),
'username' => env('SALESFORCE_USERNAME'),
'password' => env('SALESFORCE_PASSWORD'),
'instance_url' => env('SALESFORCE_INSTANCE_URL'),
],
],
class CustomSobject extends AbstractCustomSobject {
protected string $sobject_name = 'CustomObject__c';
public function customMethod(): array { }
}
// Register
Client::registerSobjectMap('customObject', CustomSobject::class);
Salesforce::customObject()->create([...]);

Azure Active Directory authentication and authorization.

  • JWT token validation
  • Claims extraction
  • Role-based access control
  • Driver pattern (production/local)

AzureAdServiceProvider registers the Azure AD manager.

1. Browser → Azure AD login
2. User authenticates (MFA)
3. Redirect back with auth code
4. Server exchanges for tokens
5. JWT validated and claims extracted
6. User object created
use RightCapital\LaravelAzureAd\AzureAd;
$service = AzureAd::driver('azure_ad');
$service->setAccessToken($token_string);
if ($service->check()) {
$user = $service->getUser();
$claims = $service->getClaims();
$roles = $service->getClaim('roles', []);
}
config/services.php
'azure_ad' => [
'driver' => env('AZURE_AD_DRIVER', 'azure_ad'),
'tenant_id' => env('AZURE_AD_TENANT_ID'),
'client_id' => env('AZURE_AD_CLIENT_ID'),
'client_secret' => env('AZURE_AD_CLIENT_SECRET'),
'redirect_uri' => env('AZURE_AD_REDIRECT_URI'),
'scopes' => ['openid', 'profile', 'email'],
],
  • InvalidTokenException
  • TokenExpiredException
  • InvalidSignatureException
  • WrongAppIdTokenException

SAML 2.0 Single Sign-On implementation.

  • SP (Service Provider) configuration
  • AuthN request generation
  • Response assertion parsing
  • Multi-certificate support for key rotation
1. SP initiates AuthN Request
2. Request signed with SP certificate
3. User redirected to IdP
4. IdP authenticates user
5. IdP returns signed Response
6. SP validates signature
7. SP extracts user attributes
8. Session created
// Enhanced key descriptor with multi-certificate support
class KeyDescriptor {
// Supports key rotation: add new cert before revoking old
}
// XML signature creation
class SignatureWrite {
// Creates XML-DSig signatures for SAML documents
}
EndpointPurpose
/saml/metadataSP metadata XML
/saml/loginInitiate login
/saml/acsAssertion Consumer Service
/saml/logoutInitiate logout
  • Signed requests prevent tampering
  • Encrypted assertions protect data
  • Certificate validation prevents MITM
  • Timestamp validation prevents replay
  • litesaml/lightsaml v4.5+

integrations-core
integrations-file-based
├── Uses: integrations-core
└── Uses: laravel-apm, laravel-aop
laravel-stripe (standalone)
laravel-salesforce
└── Uses: omniphx/forrest
laravel-azure-ad
└── Uses: lcobucci/jwt
saml
└── Uses: litesaml/lightsaml
PackageIntegration TypeExternal Service
integrations-coreBase abstractionsN/A
integrations-file-basedFile processing15+ custodians
laravel-stripePaymentStripe
laravel-salesforceCRMSalesforce
laravel-azure-adAuthenticationAzure AD
samlSSOAny SAML 2.0 IdP