Example #1
0
 /**
  * Mount the structure of order.
  *
  * @param \stdClass $response
  *
  * @return Orders Response order.
  */
 protected function populate(stdClass $response)
 {
     $this->orders = clone $this;
     $this->orders->data->id = $response->id;
     $this->orders->data->amount->total = $response->amount->total;
     $this->orders->data->amount->fees = $response->amount->fees;
     $this->orders->data->amount->refunds = $response->amount->refunds;
     $this->orders->data->amount->liquid = $response->amount->liquid;
     $this->orders->data->amount->otherReceivers = $response->amount->otherReceivers;
     $this->orders->data->amount->subtotals = $response->amount->subtotals;
     $customer = new Customer($this->moip);
     $customer->populate($response->customer);
     $this->orders->data->payments = $this->structure($response, Payment::PATH, Payment::class);
     $this->orders->data->refunds = $this->structure($response, Refund::PATH, Refund::class);
     $this->orders->data->entries = $this->structure($response, Entry::PATH, Entry::class);
     $this->orders->data->events = $this->structure($response, Event::PATH, Event::class);
     $this->orders->data->items = $response->items;
     $this->orders->data->receivers = $response->receivers;
     $this->orders->data->createdAt = $response->createdAt;
     $this->orders->data->status = $response->status;
     $this->orders->data->_links = $response->_links;
     return $this->orders;
 }
Example #2
0
 /**
  * Bank account is the bank address of a particular vendor or a customer.
  * 
  * @param string                  $type               Kind of refund. possible values: FULL, PARTIAL.
  * @param string                  $bankNumber         Bank number. possible values: 001, 237, 341, 041.
  * @param int                     $agencyNumber       Branch number.
  * @param int                     $agencyCheckNumber  Checksum of the agency.
  * @param int                     $accountNumber      Account number.
  * @param int                     $accountCheckNumber Digit account checker.
  * @param \Moip\Resource\Customer $holder
  *
  * @return \stdClass
  */
 private function bankAccount($type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder)
 {
     $data = new stdClass();
     $data->refundingInstrument = 'BANK_ACCOUNT';
     $data->bankAccount = new stdClass();
     $data->bankAccount->type = $type;
     $data->bankAccount->bankNumber = $bankNumber;
     $data->bankAccount->agencyNumber = $agencyNumber;
     $data->bankAccount->agencyCheckNumber = $agencyCheckNumber;
     $data->bankAccount->accountNumber = $accountNumber;
     $data->bankAccount->accountCheckNumber = $accountCheckNumber;
     $data->bankAccount->holder = new stdClass();
     $data->bankAccount->holder->fullname = $holder->getFullname();
     $data->bankAccount->holder->taxDocument = new stdClass();
     $data->bankAccount->holder->taxDocument->type = $holder->getTaxDocumentType();
     $data->bankAccount->holder->taxDocument->number = $holder->getTaxDocumentNumber();
     return $data;
 }
 /**
  * Set credit card holder.
  * 
  * @param \Moip\Resource\Customer $holder
  */
 private function setCreditCardHolder(Customer $holder)
 {
     $this->data->fundingInstrument->creditCard->holder = new stdClass();
     $this->data->fundingInstrument->creditCard->holder->fullname = $holder->getFullname();
     $this->data->fundingInstrument->creditCard->holder->birthdate = $holder->getBirthDate();
     $this->data->fundingInstrument->creditCard->holder->taxDocument = new stdClass();
     $this->data->fundingInstrument->creditCard->holder->taxDocument->type = $holder->getTaxDocumentType();
     $this->data->fundingInstrument->creditCard->holder->taxDocument->number = $holder->getTaxDocumentNumber();
     $this->data->fundingInstrument->creditCard->holder->phone = new stdClass();
     $this->data->fundingInstrument->creditCard->holder->phone->countryCode = $holder->getPhoneCountryCode();
     $this->data->fundingInstrument->creditCard->holder->phone->areaCode = $holder->getPhoneAreaCode();
     $this->data->fundingInstrument->creditCard->holder->phone->number = $holder->getPhoneNumber();
 }