/** * Builds a PushNotification object from the given JSON object * @param type $vo_json the JSON representation of the PushNotification * @return PushNotification a push notification object * @author Rob Kurst <*****@*****.**> */ public static function buildFromJSON($vo_json) { $o_return = new PushNotification(); if (array_key_exists("push_notification_type", $vo_json) && $vo_json["push_notification_type"] == "PING") { $o_return->setPING(); } if (array_key_exists("push_notification_settlement_batch", $vo_json)) { $o_return->setSettlementBatch(SettlementBatch::buildFromJSON($vo_json["push_notification_settlement_batch"])); } if (array_key_exists("push_notification_bank_account_transaction", $vo_json)) { $o_return->setBankAccountTransaction(BankAccountTransaction::buildFromJSON($vo_json["push_notification_bank_account_transaction"])); } return $o_return; }
/** * * Processes the transaction using the specified BankAccountTransaction. * Returns an updated BankAccountTransaction containing the response information. * * @param vo_bct the bank account transaction * @return the updated bank account transaction * @throws BaseCommerceClientException if invalid credentials were given or if there was an internal server error. Please contact tech support if there is an internal server error. * @author Rob Kurst <*****@*****.**> */ public function processBankAccountTransaction(BankAccountTransaction $vo_bat) { $triple_des = new TripleDESService($this->is_key); $o_query = array(); $o_query['gateway_username'] = $this->is_gateway_username; $o_query['gateway_password'] = $this->is_gateway_password; $o_query['payload'] = $triple_des->encrypt($vo_bat->getJSON()); $s_query = json_encode($o_query); $response = $this->do_post_request('/pcms/?f=API_processBankAccountTransactionV4', $s_query, $triple_des, 0); $vo_bat = BankAccountTransaction::buildFromJSON($response["bank_account_transaction"]); if (array_key_exists("exception", $response) && !is_null($response['exception'])) { foreach ($response['exception'] as $s_key => $s_error) { $vo_bat->addMessage($s_error); } } return $vo_bat; }
/** * Builds a PushNotification object from the given JSON object * @param type $vo_json the JSON representation of the PushNotification * @return PushNotification a push notification object * @author Rob Kurst <*****@*****.**> */ public static function buildFromJSON($vo_json) { $o_return = new PushNotification(); if (array_key_exists("push_notification_type", $vo_json) && $vo_json["push_notification_type"] == "PING") { $o_return->setPING(); } if (array_key_exists("push_notification_type", $vo_json) && $vo_json["push_notification_type"] == "INCOMING CHARGEBACK") { if (array_key_exists("push_notification_chargeback", $vo_json)) { $o_return->setIncomingChargeback(Chargeback::buildFromJSON($vo_json["push_notification_chargeback"])); } } if (array_key_exists("push_notification_settlement_batch", $vo_json)) { $o_return->setSettlementBatch(SettlementBatch::buildFromJSON($vo_json["push_notification_settlement_batch"])); } if (array_key_exists("push_notification_bank_account_transaction", $vo_json)) { $o_return->setBankAccountTransaction(BankAccountTransaction::buildFromJSON($vo_json["push_notification_bank_account_transaction"])); } if (array_key_exists("push_notification_id", $vo_json)) { $o_return->setID($vo_json["push_notification_id"]); } return $o_return; }