updated deployer code
This commit is contained in:
@@ -11,7 +11,11 @@ use RuntimeException;
|
||||
|
||||
final class PurchaseProvisioner
|
||||
{
|
||||
public function __construct(private LicenseIssuer $issuer, private PaddleClient $paddle) {}
|
||||
public function __construct(
|
||||
private LicenseIssuer $issuer,
|
||||
private PaddleClient $paddle,
|
||||
private CustomerAccountProvisioner $accounts,
|
||||
) {}
|
||||
|
||||
public function provision(string $provider, array $event): void
|
||||
{
|
||||
@@ -128,6 +132,7 @@ final class PurchaseProvisioner
|
||||
}
|
||||
|
||||
$license->save();
|
||||
$this->accounts->ensure($license->customer_email, $license->customer_name);
|
||||
}
|
||||
|
||||
private function syncPaddleTransaction(array $data): void
|
||||
@@ -155,7 +160,7 @@ final class PurchaseProvisioner
|
||||
$custom = is_array($data['custom_data'] ?? null) ? $data['custom_data'] : [];
|
||||
$customer = $this->paddle->customer($this->nullableString($data['customer_id'] ?? null)) ?? [];
|
||||
|
||||
$this->issuer->issue(
|
||||
[$license] = $this->issuer->issue(
|
||||
$product,
|
||||
$this->nullableString($custom['customer_name'] ?? $custom['name'] ?? $customer['name'] ?? null),
|
||||
$this->nullableString($custom['customer_email'] ?? $custom['email'] ?? $customer['email'] ?? null),
|
||||
@@ -164,6 +169,7 @@ final class PurchaseProvisioner
|
||||
$this->nullableString($data['customer_id'] ?? null),
|
||||
true,
|
||||
);
|
||||
$this->accounts->ensure($license->customer_email, $license->customer_name);
|
||||
}
|
||||
|
||||
private function provisionLemonSqueezy(array $event): void
|
||||
@@ -191,7 +197,7 @@ final class PurchaseProvisioner
|
||||
(string) ($attributes['product_id'] ?? ''),
|
||||
);
|
||||
|
||||
$this->issuer->issue(
|
||||
[$license] = $this->issuer->issue(
|
||||
$product,
|
||||
$this->nullableString($attributes['user_name'] ?? null),
|
||||
$this->nullableString($attributes['user_email'] ?? null),
|
||||
@@ -200,6 +206,7 @@ final class PurchaseProvisioner
|
||||
$this->nullableString($attributes['customer_id'] ?? null),
|
||||
true,
|
||||
);
|
||||
$this->accounts->ensure($license->customer_email, $license->customer_name);
|
||||
}
|
||||
|
||||
private function backfillPaddleCustomer(License $license, array $data): void
|
||||
|
||||
Reference in New Issue
Block a user