Integration Packages
Integration packages provide abstractions and implementations for connecting with external services.
integrations-core
Section titled “integrations-core”Core abstractions and base classes for all integration implementations.
Key Features
Section titled “Key Features”- Sync pattern for CRUD operations
- Integration mapping for linking vendor data
- Structured exception hierarchy
- File-based logging with vendor context
Architecture
Section titled “Architecture”abstract class Integrator { abstract function syncAll(): array; abstract function sync(IntegrationMapping $mapping): array;}
abstract class Sync { abstract function execute(): void;}Exception Hierarchy
Section titled “Exception Hierarchy”IntegrationExceptionInterface├── ConnectException├── UnauthorizedException├── ForbiddenException├── NotFoundException├── UnexpectedValueException├── TimeoutException├── ServiceUnavailableException├── TooManyRequestException├── FileOutdatedException├── FileDeliveryException└── FileNotFoundExceptionResult Structure
Section titled “Result Structure”// Sync result format[ $advisor_id => [ $household_id => [ 'accounts' => [$account_id => [$position_ids]], 'insurances' => [$insurance_id => []], 'persons' => [$person_id], ] ]]Dependencies
Section titled “Dependencies”core-models,laravel-sentryilluminate-http-problem-response
integrations-file-based
Section titled “integrations-file-based”File-based integrations for custodians and vendors.
Supported Vendors
Section titled “Supported Vendors”| Vendor | File Type | Data Types |
|---|---|---|
| Allianz | Custom | Life insurance, investments |
| Jackson | Custom | Life insurance, investments |
| Apex | CSV | Investment accounts |
| Altruist | CSV | Portfolio data |
| Betterment | CSV | Investment accounts |
| InteractiveBrokers | Fixed-width | Accounts, positions |
| FirstClearing | Fixed-width (NSCC) | Accounts, securities |
| Fidelity | CSV | Investment accounts |
| Schwab | CSV | Investment accounts |
| Pershing | CSV | Investment accounts |
| RBC | CSV | Investment accounts |
| RaymondJames | CSV | Investment accounts |
| Flourish | CSV | Bank accounts |
File Parsing Patterns
Section titled “File Parsing Patterns”// CSV-basedinterface CsvFileTypeInterface extends FileTypeInterface { public function getHeaders(): array; public function getFieldMappings(): array;}
// Fixed-width (NSCC)class NsccFileType { public function getColumnDefinitions(): array;}Integration Flow
Section titled “Integration Flow”- Advisor uploads file via REST API
- File stored in S3/SFTP
- Background job parses file
- Holdings/accounts stored in database
- Data available for mapping to households
laravel-stripe
Section titled “laravel-stripe”Stripe payment processing and subscription management.
Key Features
Section titled “Key Features”- Customer and subscription management
- Payment method handling
- Tax calculation
- Coupon/discount processing
- Webhook event handling
Facades
Section titled “Facades”use RightCapital\LaravelStripe\Stripe;use RightCapital\LaravelStripe\StripeConnect;// Customer managementStripe::createCustomer('user@example.com', [ 'name' => 'John Doe', 'metadata' => ['user_id' => 123],]);
// Subscription managementStripe::createSubscription($customer_id, $price_id);Stripe::cancelSubscription($subscription_id);
// Coupon handling$coupon = Stripe::getCoupon('DISCOUNT20');
// Tax calculationStripe::applyTaxToLocation('94105');
// Webhook processing$event = Stripe::constructWebhookEvent($payload, $signature);Configuration
Section titled “Configuration”'stripe' => [ 'secret' => env('STRIPE_SECRET'), 'webhook' => [ 'secret' => env('STRIPE_WEBHOOK_SECRET'), ], 'max_network_retries' => 3,],Exception Classes
Section titled “Exception Classes”CouponNotFoundCustomerNotFoundSubscriptionNotFoundPaymentMethodNotFoundInvalidTaxLocation
laravel-salesforce
Section titled “laravel-salesforce”Salesforce CRM integration for enterprise features.
SObject Types
Section titled “SObject Types”| SObject | Purpose |
|---|---|
AccountSobject | CRM Accounts |
ContactSobject | Contacts |
LeadSobject | Sales leads |
OpportunitySobject | Opportunities |
UserSobject | Salesforce users |
TaskSobject | Task activities |
EventSobject | Event activities |
CampaignMemberSobject | Campaign memberships |
AdvisorInvitationSobject | Custom: advisor invitations |
use RightCapital\LaravelSalesforce\Salesforce;
// Create accountSalesforce::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%'");
// UpdateSalesforce::task()->update($id, ['Status' => 'Completed']);
// DeleteSalesforce::lead()->delete($id);Configuration
Section titled “Configuration”'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'), ],],Custom SObjects
Section titled “Custom SObjects”class CustomSobject extends AbstractCustomSobject { protected string $sobject_name = 'CustomObject__c';
public function customMethod(): array { }}
// RegisterClient::registerSobjectMap('customObject', CustomSobject::class);Salesforce::customObject()->create([...]);laravel-azure-ad
Section titled “laravel-azure-ad”Azure Active Directory authentication and authorization.
Key Features
Section titled “Key Features”- JWT token validation
- Claims extraction
- Role-based access control
- Driver pattern (production/local)
Service Provider
Section titled “Service Provider”AzureAdServiceProvider registers the Azure AD manager.
Authentication Flow
Section titled “Authentication Flow”1. Browser → Azure AD login2. User authenticates (MFA)3. Redirect back with auth code4. Server exchanges for tokens5. JWT validated and claims extracted6. User object createduse 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', []);}Configuration
Section titled “Configuration”'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'],],Exceptions
Section titled “Exceptions”InvalidTokenExceptionTokenExpiredExceptionInvalidSignatureExceptionWrongAppIdTokenException
SAML 2.0 Single Sign-On implementation.
Key Features
Section titled “Key Features”- SP (Service Provider) configuration
- AuthN request generation
- Response assertion parsing
- Multi-certificate support for key rotation
SAML Flow
Section titled “SAML Flow”1. SP initiates AuthN Request2. Request signed with SP certificate3. User redirected to IdP4. IdP authenticates user5. IdP returns signed Response6. SP validates signature7. SP extracts user attributes8. Session createdKey Classes
Section titled “Key Classes”// Enhanced key descriptor with multi-certificate supportclass KeyDescriptor { // Supports key rotation: add new cert before revoking old}
// XML signature creationclass SignatureWrite { // Creates XML-DSig signatures for SAML documents}Endpoints
Section titled “Endpoints”| Endpoint | Purpose |
|---|---|
/saml/metadata | SP metadata XML |
/saml/login | Initiate login |
/saml/acs | Assertion Consumer Service |
/saml/logout | Initiate logout |
Security Features
Section titled “Security Features”- Signed requests prevent tampering
- Encrypted assertions protect data
- Certificate validation prevents MITM
- Timestamp validation prevents replay
Dependencies
Section titled “Dependencies”litesaml/lightsamlv4.5+
Dependency Graph
Section titled “Dependency Graph”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/lightsamlSummary
Section titled “Summary”| Package | Integration Type | External Service |
|---|---|---|
| integrations-core | Base abstractions | N/A |
| integrations-file-based | File processing | 15+ custodians |
| laravel-stripe | Payment | Stripe |
| laravel-salesforce | CRM | Salesforce |
| laravel-azure-ad | Authentication | Azure AD |
| saml | SSO | Any SAML 2.0 IdP |