-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored to use the API rather than Screenscraping
- Loading branch information
1 parent
28aa9bd
commit 01f8f4f
Showing
27 changed files
with
671 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Fire\Business\Api; | ||
|
||
use Fire\Business\Api; | ||
use Fire\Business\InstanceResource; | ||
|
||
class BankTransferDetails extends InstanceResource { | ||
|
||
public function __construct(Api $api, $batchUuid, $batchItemUuid) { | ||
parent::__construct($api); | ||
|
||
$this->solution = array( | ||
'batchUuid' => $batchUuid, | ||
'batchItemUuid' => $batchItemUuid | ||
); | ||
$this->uri = "v1/batches/$batchUuid/banktransfers/$batchItemUuid"; | ||
} | ||
|
||
public function delete() { | ||
return $this->api->fetch("DELETE", $this->uri); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Fire\Business\Api; | ||
|
||
use Fire\Business\Api; | ||
use Fire\Business\ListResource; | ||
|
||
class BankTransferList extends ListResource { | ||
|
||
public function __construct(Api $api, $batchId) { | ||
parent::__construct($api); | ||
|
||
$this->solution = array( | ||
'batchId' => $batchId, | ||
); | ||
$this->uri = "v1/batches/$batchId/banktransfers"; | ||
} | ||
|
||
public function read() { | ||
return $this->api->fetch("GET", $this->uri); | ||
} | ||
|
||
public function add($transfer) { | ||
return $this->api->fetch("POST", $this->uri, null, $transfer); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace Fire\Business\Api; | ||
|
||
use Fire\Business\Api; | ||
use Fire\Business\InstanceResource; | ||
|
||
class BatchDetails extends InstanceResource { | ||
|
||
public function __construct(Api $api, $batchId) { | ||
parent::__construct($api); | ||
|
||
$this->solution = array( | ||
'batchId' => $batchId, | ||
); | ||
$this->uri = "v1/batches/$batchId"; | ||
} | ||
|
||
public function read() { | ||
return $this->api->fetch("GET", $this->uri); | ||
} | ||
|
||
public function cancel() { | ||
return $this->api->fetch("DELETE", $this->uri); | ||
} | ||
|
||
public function submit() { | ||
return $this->api->fetch("PUT", $this->uri); | ||
} | ||
|
||
public function addInternalTransfer($transfer) { | ||
$internalTransfer = new InternalTransferList($this->api, $this->solution['batchId']); | ||
return $internalTransfer->add($transfer); | ||
} | ||
|
||
protected function getInternalTransfers() { | ||
return new InternalTransferList($this->api, $this->solution['batchId']); | ||
} | ||
|
||
protected function contextInternalTransfer($batchItemUuid) { | ||
return new InternalTransferDetails($this->api, $this->solution['batchId'], $batchItemUuid); | ||
} | ||
|
||
public function addBankTransfer($transfer) { | ||
$bankTransfer = new BankTransferList($this->api, $this->solution['batchId']); | ||
return $bankTransfer->add($transfer); | ||
} | ||
|
||
protected function getBankTransfers() { | ||
return new BankTransferList($this->api, $this->solution['batchId']); | ||
} | ||
|
||
protected function contextBankTransfer($batchItemUuid) { | ||
return new BankTransferDetails($this->api, $this->solution['batchId'], $batchItemUuid); | ||
} | ||
|
||
/** | ||
* Magic getter to lazy load domains | ||
* | ||
* @param string $name Domain to return | ||
* @return \Twilio\Domain The requested domain | ||
* @throws TwilioException For unknown domains | ||
*/ | ||
public function __get($name) { | ||
$method = 'get' . ucfirst($name); | ||
if (method_exists($this, $method)) { | ||
return $this->$method(); | ||
} | ||
throw new FireException('Unknown domain ' . $name); | ||
} | ||
/** | ||
* Magic call to lazy load contexts | ||
* | ||
* @param string $name Context to return | ||
* @param mixed[] $arguments Context to return | ||
* @return \Twilio\InstanceContext The requested context | ||
* @throws TwilioException For unknown contexts | ||
*/ | ||
public function __call($name, $arguments) { | ||
$method = 'context' . ucfirst($name); | ||
if (method_exists($this, $method)) { | ||
return call_user_func_array(array($this, $method), $arguments); | ||
} | ||
throw new FireException('Unknown context ' . $name); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Fire\Business\Api; | ||
|
||
use Fire\Business\Api; | ||
use Fire\Business\ListResource; | ||
|
||
class BatchList extends ListResource { | ||
|
||
public function __construct(Api $api) { | ||
parent::__construct($api); | ||
|
||
$this->solution = array(); | ||
$this->uri = "v1/batches"; | ||
} | ||
|
||
public function read() { | ||
return $this->api->fetch("GET", $this->uri); | ||
} | ||
|
||
public function create(array $batchDetails) { | ||
return $this->api->fetch("POST", $this->uri, null, $batchDetails); | ||
} | ||
} |
Oops, something went wrong.