# Partner Service

This provides a service for other components to use to retrieve partner information.

## Requirements

The Partner Service interface:

```typescript
export interface PartnerServiceInterface {
  getPartnerId(): Observable<string>;
}
```

To implement the interface make a new service that implements the interface:

```typescript
…
import {PartnerServiceInterface} from '@vendasta/partner-service';

@Injectable()
export class PartnerService implements PartnerServiceInterface {
  …
  getPartnerId(): Observable<string> {
    // Implement how the project determines which partner id the current context is in
  }
}
```

Next you will need to provide your service as that interface (generally in `app.module.ts`)

```typescript
import { PartnerService } from './partner.service';
import { PartnerServiceInterfaceToken } from '@vendasta/partner-service';
…
@NgModule({
  …
  providers: [
    PartnerService, {provide: PartnerServiceInterfaceToken, useExisting: PartnerService}
  ],
})
```

* Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (`PartnerServiceInterfaceToken` vs `PartnerServiceInterface`).
