Skip to content

Commit

Permalink
Update PullPayments client, payout_usage.php (#61)
Browse files Browse the repository at this point in the history
Add new autoApproveClaims parameter. Fix example function names on payout_usage.php.
  • Loading branch information
leonardooleg authored Jul 28, 2022
1 parent a251499 commit 6bfa9de
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
27 changes: 23 additions & 4 deletions examples/payout_usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function createPullPayment()
$paymentCurrency = 'BTC';
$paymentPeriod = null;
$boltExpiration = 1;
$autoApproveClaims = false;
$startsAt = null;
$expiresAt = null;
$paymentMethods = ['BTC'];
Expand All @@ -54,6 +55,7 @@ public function createPullPayment()
$paymentCurrency,
$paymentPeriod,
$boltExpiration,
$autoApproveClaims,
$startsAt,
$expiresAt,
$paymentMethods
Expand Down Expand Up @@ -108,14 +110,30 @@ public function markPayoutAsPaid()
echo "Error: " . $e->getMessage();
}
}

public function approvePayout()
{
$payoutId ='';
try {
$client = new PullPayment($this->host, $this->apiKey);
var_dump($client->approvePayout(
$this->storeId,
$payoutId,
0,
null
));
} catch (\Throwable $e) {
echo "Error: " . $e->getMessage();
}
}

public function getPullPayment()
{
$pullPaymentId = '';

try {
$client = new PullPayment($this->host, $this->apiKey);
var_dump($client->markPayoutAsPaid(
var_dump($client->getPullPayment(
$this->storeId,
$pullPaymentId
));
Expand All @@ -131,7 +149,7 @@ public function getPayouts()

try {
$client = new PullPayment($this->host, $this->apiKey);
var_dump($client->markPayoutAsPaid(
var_dump($client->getPayouts(
$pullPaymentId,
$includeCancelled
));
Expand All @@ -149,7 +167,7 @@ public function createPayout()

try {
$client = new PullPayment($this->host, $this->apiKey);
var_dump($client->markPayoutAsPaid(
var_dump($client->createPayout(
$pullPaymentId,
$destination,
$amount,
Expand All @@ -167,7 +185,7 @@ public function getPayout()

try {
$client = new PullPayment($this->host, $this->apiKey);
var_dump($client->markPayoutAsPaid(
var_dump($client->getPayout(
$pullPaymentId,
$payoutId
));
Expand All @@ -183,6 +201,7 @@ public function getPayout()
//$pp->archivePullPayment();
//$pp->cancelPayout();
//$pp->markPayoutAsPaid();
//$pp->approvePayout();
//$pp->getPullPayment();
//$pp->getPayouts();
//$pp->createPayout();
Expand Down
2 changes: 2 additions & 0 deletions src/Client/PullPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function createPullPayment(
string $currency,
?int $period,
?int $BOLT11Expiration,
bool $autoApproveClaims,
?int $startsAt,
?int $expiresAt,
array $paymentMethods
Expand All @@ -60,6 +61,7 @@ public function createPullPayment(
'currency' => $currency,
'period' => $period,
'BOLT11Expiration' => $BOLT11Expiration,
'autoApproveClaims' => $autoApproveClaims,
'startsAt' => $startsAt,
'expiresAt' => $expiresAt,
'paymentMethods' => $paymentMethods
Expand Down

0 comments on commit 6bfa9de

Please sign in to comment.