Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions src/Resource/Transfers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ class Transfers extends MoipResource
/**
* @const string
*/
const TYPE = 'CHECKING';
const TYPE_DEFAULT = self::TYPE_BANK_ACOUNT_CHECKING;

/**
* @const string
*/
const TYPE_BANK_ACOUNT_CHECKING = 'CHECKING';

/**
* @const string
*/
const TYPE_BANK_ACOUNT_SAVING = 'SAVING';

/**
* @const string
Expand All @@ -40,6 +50,7 @@ protected function initialize()
$this->data = new stdClass();
$this->data->transferInstrument = new stdClass();
$this->data->transferInstrument->bankAccount = new stdClass();
$this->data->transferInstrument->bankAccount->type = self::TYPE_DEFAULT;
$this->data->transferInstrument->bankAccount->holder = new stdClass();
$this->data->transferInstrument->bankAccount->holder->taxDocument = new stdClass();
}
Expand Down Expand Up @@ -83,6 +94,26 @@ protected function populate(stdClass $response)
return $transfers;
}

/**
* set type account SAVING
* @return $this
*/
public function setTypeBankAccountSaving() {
$this->data->transferInstrument->bankAccount->type = self::TYPE_BANK_ACOUNT_SAVING;

return $this;
}

/**
* set type account CHECKING
* @return $this
*/
public function setTypeBankAccountChecking() {
$this->data->transferInstrument->bankAccount->type = self::TYPE_BANK_ACOUNT_CHECKING;

return $this;
}

/**
* Set info of transfers.
*
Expand All @@ -105,7 +136,6 @@ public function setTransfers(
) {
$this->data->amount = $amount;
$this->data->transferInstrument->method = self::METHOD;
$this->data->transferInstrument->bankAccount->type = self::TYPE;
$this->data->transferInstrument->bankAccount->bankNumber = $bankNumber;
$this->data->transferInstrument->bankAccount->agencyNumber = $agencyNumber;
$this->data->transferInstrument->bankAccount->agencyCheckNumber = $agencyCheckNumber;
Expand Down