Example #1
0
 /**
  * Creates a customer with bank account information
  * @param parameters The parameters to be sent to the server
  * @param string $lang language of request see SupportedLanguages class
  * @return The response to the request sent
  * @throws PayUException
  * @throws InvalidArgumentException
  */
 public static function createCustomerWithBankAccount($parameters, $lang = null)
 {
     PayUSubscriptionsRequestUtil::validateCustomer($parameters);
     $customer = PayUSubscriptionsRequestUtil::buildCustomer($parameters);
     $bankAccount = RequestPaymentsUtil::buildBankAccountRequest($parameters);
     $customer->bankAccounts = array($bankAccount);
     $urlSegment = PayUSubscriptionsUrlResolver::getInstance()->getUrlSegment(PayUSubscriptionsUrlResolver::CUSTOMER_ENTITY, PayUSubscriptionsUrlResolver::ADD_OPERATION);
     $payUHttpRequestInfo = PayUSubscriptionsRequestUtil::buildHttpRequestInfo($urlSegment, $lang, RequestMethod::POST);
     return PayUApiServiceUtil::sendRequest($customer, $payUHttpRequestInfo);
 }
Example #2
0
 /**
  * Return a bank account with the given id
  *
  * @param parameters The parameters to be sent to the server
  * @return the find bank account
  * @throws PayUException
  * @throws InvalidArgumentException
  */
 public static function find($parameters, $lang = null)
 {
     $required = array(PayUParameters::BANK_ACCOUNT_ID);
     CommonRequestUtil::validateParameters($parameters, $required);
     $bankAccountRequest = RequestPaymentsUtil::buildBankAccountRequest($parameters);
     $urlSegment = PayUSubscriptionsUrlResolver::getInstance()->getUrlSegment(PayUSubscriptionsUrlResolver::BANK_ACCOUNT_ENTITY, PayUSubscriptionsUrlResolver::GET_OPERATION, array($bankAccountRequest->id));
     $payUHttpRequestInfo = PayUSubscriptionsRequestUtil::buildHttpRequestInfo($urlSegment, $lang, RequestMethod::GET);
     return PayUApiServiceUtil::sendRequest($bankAccountRequest, $payUHttpRequestInfo);
 }
 /**
  * Build the Credit card object for subscription
  * @param array $parameters
  */
 protected static function buildBankAccountForSubscription($parameters)
 {
     $bankAccountId = CommonRequestUtil::getParameter($parameters, PayUParameters::BANK_ACCOUNT_ID);
     if (!isset($bankAccountId)) {
         $bankAccount = RequestPaymentsUtil::buildBankAccountRequest($parameters);
         $bankAccount->customerId = NULL;
     } else {
         $bankAccount = new \stdClass();
         $bankAccount->id = $bankAccountId;
     }
     return $bankAccount;
 }