Exemplo n.º 1
0
 /**
  * Cancel a recurring profile
  * @param	array	An array of payment params, sent from your controller / library
  * @return	object	A response from the payment gateway
  */
 public function amazon_simplepay_cancel_recurring_profile($params)
 {
     $this->_api_method = 'CancelSubscriptionAndRefund';
     $this->_params = array('Action' => $this->_api_method, 'AWSAccessKeyId' => $this->_api_settings['accessKey'], 'CurrencyCode' => 'USD', 'SubscriptionId' => $params['identifier'], 'Timestamp' => date('Y-m-d'), 'Version' => $this->_fps_version, 'SignatureVersion' => $this->_api_settings['signatureVersion'], 'SignatureMethod' => $this->_api_settings['signatureMethod']);
     if (!empty($params['note'])) {
         $this->_params['CancelReason'] = $params['note'];
     }
     $this->_params['Signature'] = SignatureUtils::signParameters($this->_params, $this->_secret_key, $this->_http_method, $this->_fps_endpoint_parsed['host'], '/', $this->_algorithm);
     $call = $this->_api_call();
     return $call;
 }
Exemplo n.º 2
0
 /**
  * Function Generates the html form 
  * @param accessKey - Put your Access Key here  
  * @param secretKey - Put your secret Key here
  * @param amount - Enter the amount you want to collect for the ite
  * @param description - description - Enter a description of the item
  * @param referenceId - Optionally enter an ID that uniquely identifies this transaction for your records
  * @param abandonUrl - Optionally, enter the URL where senders should be redirected if they cancel their transaction
  * @param returnUrl - Optionally enter the URL where buyers should be redirected after they complete the transaction
  * @param immediateReturn - Optionally, enter "1" if you want to skip the final status page in Amazon Payments, 
  * @param processImmediate - Optionally, enter "1" if you want to settle the transaction immediately else "0". Default value is "1"
  * @param ipnUrl - Optionally, type the URL of your host page to which Amazon Payments should send the IPN transaction information.
  * @param collectShippingAddress - Optionally, enter "1" if you want Amazon Payments to return the buyer's shipping address as part of the transaction information
  * @param signatureMethod - Valid values are  HmacSHA256 and HmacSHA1
  * @param environment - Sets the environment where your form will point to can be "sandbox" or "prod" 
  * @return - A map of key of key-value pair for all non null parameters
  * @throws Exception
  */
 public static function GenerateForm($accessKey, $secretKey, $amount, $description, $referenceId, $immediateReturn, $returnUrl, $abandonUrl, $processImmediate, $ipnUrl, $collectShippingAddress, $signatureMethod, $environment)
 {
     if ($environment == "prod") {
         $endPoint = self::$PROD_END_POINT;
         $imageLocation = self::$PROD_IMAGE_LOCATION;
     } else {
         $endPoint = self::$SANDBOX_END_POINT;
         $imageLocation = self::$SANDBOX_IMAGE_LOCATION;
     }
     $params = self::getSimplePayStandardParams($accessKey, $amount, $description, $referenceId, $immediateReturn, $returnUrl, $abandonUrl, $processImmediate, $ipnUrl, $collectShippingAddress, $signatureMethod);
     $serviceEndPoint = parse_url($endPoint);
     $signature = SignatureUtils::signParameters($params, $secretKey, self::$httpMethod, $serviceEndPoint['host'], $serviceEndPoint['path'], $signatureMethod);
     $params[self::SIGNATURE_KEYNAME] = $signature;
     $simplePayForm = self::getSimplePayStandardForm($params, $endPoint, $imageLocation);
     print $simplePayForm . "\n";
 }
Exemplo n.º 3
0
 /**
  * Show User Friendship.
  *
  * @param string $userId
  *
  * @return array
  *   Friendship relationship data
  */
 public function userFriendship($userId)
 {
     $data = json_encode(['_uuid' => $this->uuid, '_uid' => $this->username_id, 'user_id' => $userId, '_csrftoken' => $this->token]);
     return $this->http->request("friendships/show/{$userId}/", SignatureUtils::generateSignature($data))[1];
 }