Ejemplo n.º 1
0
	public static function convertToPagarMeObject($response) {
		$types = array(
			'transaction' => 'PagarMe_Transaction',
			'plan' => 'PagarMe_Plan',
			'customer' => "PagarMe_Customer",
			'address' => "PagarMe_Address",
			'phone' => "PagarMe_Phone",
			'subscription' => 'PagarMe_Subscription',
		);

		if(self::isList($response)) {
			$output = array();
			foreach($response as $j) {
				array_push($output, self::convertToPagarMeObject($j));
			}
			return $output;
		} else if(is_array($response)) {
			if(isset($response['object']) && is_string($response['object']) && isset($types[$response['object']])) {
				$class = $types[$response['object']];	
			} else {
				$class = 'PagarMe_Object';
			}

			return PagarMe_Object::build($response, $class);
		} else {
			return $response;
		}
	}	
Ejemplo n.º 2
0
 public function __construct($response = array())
 {
     parent::__construct($response);
 }
Ejemplo n.º 3
0
 protected static function createPagarMeObject()
 {
     $response = array("status" => "paid", "object" => 'transaction', "refuse_reason" => null, "date_created" => "2013-09-26T03:19:36.000Z", "amount" => 1590, "installments" => 1, "id" => 1379, "card_holder_name" => "Jose da Silva", "card_last_digits" => "4448", "card_brand" => "visa", "postback_url" => null, "payment_method" => "credit_card", "customer" => array('object' => 'customer', "document_number" => "51472745531", 'address' => array('object' => "address", 'street' => 'asdas')));
     return PagarMe_Object::build($response, 'PagarMe_Transaction');
 }