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.

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
// 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.

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 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
}
Endpoint Purpose
/saml/metadata SP metadata XML
/saml/login Initiate login
/saml/acs Assertion Consumer Service
/saml/logout Initiate 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
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