Skip to content

Commit

Permalink
updated affiliate
Browse files Browse the repository at this point in the history
  • Loading branch information
azzarip committed Jul 12, 2024
1 parent e9d0eaa commit ba8bd03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Services/V2/Affiliate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ public function find(int $affiliate_id)
return $this->get("/$affiliate_id");
}

public function create(array $data)
public function create(string $code, int $contact_id, bool $active = true, string $name = '')
{
return $this->post('/', $data);
return $this->post('/', [
'code' => $code,
'contact_id' => $contact_id,
'status' => $active ? 'active' : 'inactive',
'name' => $name,
]);
}

public function update(int $affiliate_id, array $data)
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Services/V2/AffiliateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
});

test('create makes a POST request', function () {
Keap::affiliate('v2')->create([]);
Keap::affiliate('v2')->create('::code::', 1);

Http::assertSent(function ($request) {
return $request->url() === 'https://api.infusionsoft.com/crm/rest/v2/affiliates' &&
Expand Down

0 comments on commit ba8bd03

Please sign in to comment.