/** * Fund an address with faucet. * The faucet endpoint is only available on BlockCypher’s Test Blockchain and Bitcoin Testnet3 * * @deprecated since version 1.2. Use FaucetClient. * @param string $address Address to fund * @param int $amount * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return FaucetResponse */ public static function fundAddress($address, $amount, $apiContext = null, $restCall = null) { ArgumentValidator::validate($address, 'address'); NumericValidator::validate($amount, 'amount'); $faucet = new self(); $faucet->setAddress($address); $faucet->setAmount($amount); return $faucet->turnOn($apiContext, $restCall); }
public static function createFromArray(array $data) { $movement = new self(); $movement->setId(isset($data['id']) ? $data['id'] : null); $movement->setDate(new \DateTime($data['date'])); $movement->setAmount(new \InFog\SimpleFinance\Types\Money($data['amount'])); $movement->setName(new \InFog\SimpleFinance\Types\SmallString($data['name'])); $movement->setDescription(new \InFog\SimpleFinance\Types\Text($data['description'])); return $movement; }
/** * Build a payment entity based on a json-decoded payment stdClass * * @param stdClass $response The payment data * @return Syspay_Merchant_Entity_Payment The payment object */ public static function buildFromResponse(stdClass $response) { $chargeback = new self(); $chargeback->setId(isset($response->id) ? $response->id : null); $chargeback->setStatus(isset($response->status) ? $response->status : null); $chargeback->setAmount(isset($response->amount) ? $response->amount : null); $chargeback->setCurrency(isset($response->currency) ? $response->currency : null); $chargeback->setReasonCode(isset($response->reason_code) ? $response->reason_code : null); if (isset($response->processing_time) && !is_null($response->processing_time)) { $chargeback->setProcessingTime(Syspay_Merchant_Utils::tsToDateTime($response->processing_time)); } if (isset($response->payment)) { $chargeback->setPayment(Syspay_Merchant_Entity_Payment::buildFromResponse($response->payment)); } return $chargeback; }
/** * Build a payment entity based on a json-decoded payment stdClass * * @param stdClass $response The payment data * @return Syspay_Merchant_Entity_Payment The payment object */ public static function buildFromResponse(stdClass $response) { $refund = new self(); $refund->setId(isset($response->id) ? $response->id : null); $refund->setReference(isset($response->reference) ? $response->reference : null); $refund->setAmount(isset($response->amount) ? $response->amount : null); $refund->setCurrency(isset($response->currency) ? $response->currency : null); $refund->setStatus(isset($response->status) ? $response->status : null); $refund->setExtra(isset($response->extra) ? $response->extra : null); $refund->setDescription(isset($response->description) ? $response->description : null); if (isset($response->processing_time) && !is_null($response->processing_time)) { $refund->setProcessingTime(Syspay_Merchant_Utils::tsToDateTime($response->processing_time)); } if (isset($response->payment)) { $refund->setPayment(Syspay_Merchant_Entity_Payment::buildFromResponse($response->payment)); } return $refund; }
/** * Build a payment entity based on a json-decoded payment stdClass * * @param stdClass $response The payment data * @return Syspay_Merchant_Entity_Payment The payment object */ public static function buildFromResponse(stdClass $response) { $payment = new self(); $payment->setId(isset($response->id) ? $response->id : null); $payment->setReference(isset($response->reference) ? $response->reference : null); $payment->setAmount(isset($response->amount) ? $response->amount : null); $payment->setCurrency(isset($response->currency) ? $response->currency : null); $payment->setStatus(isset($response->status) ? $response->status : null); $payment->setExtra(isset($response->extra) ? $response->extra : null); $payment->setDescription(isset($response->description) ? $response->description : null); $payment->setWebsite(isset($response->website) ? $response->website : null); $payment->setFailureCategory(isset($response->failure_category) ? $response->failure_category : null); $payment->setChipAndPinStatus(isset($response->chip_and_pin_status) ? $response->chip_and_pin_status : null); $payment->setPaymentType(isset($response->payment_type) ? $response->payment_type : null); $payment->setWebsiteUrl(isset($response->website_url) ? $response->website_url : null); $payment->setContract(isset($response->contract) ? $response->contract : null); $payment->setDescriptor(isset($response->descriptor) ? $response->descriptor : null); $payment->setAccountId(isset($response->account_id) ? $response->account_id : null); $payment->setMerchantLogin(isset($response->merchant_login) ? $response->merchant_login : null); $payment->setMerchantId(isset($response->merchant_id) ? $response->merchant_id : null); if (isset($response->settlement_date) && !is_null($response->settlement_date)) { $payment->setSettlementDate(Syspay_Merchant_Utils::tsToDateTime($response->settlement_date)); } if (isset($response->processing_time) && !is_null($response->processing_time)) { $payment->setProcessingTime(Syspay_Merchant_Utils::tsToDateTime($response->processing_time)); } if (isset($response->billing_agreement) && $response->billing_agreement instanceof stdClass) { $billingAgreement = Syspay_Merchant_Entity_BillingAgreement::buildFromResponse($response->billing_agreement); $payment->setBillingAgreement($billingAgreement); } if (isset($response->subscription) && $response->subscription instanceof stdClass) { $subscription = Syspay_Merchant_Entity_Subscription::buildFromResponse($response->subscription); $payment->setSubscription($subscription); } if (isset($response->payment_method) && $response->payment_method instanceof stdClass) { $paymentMethod = Syspay_Merchant_Entity_PaymentMethod::buildFromResponse($response->payment_method); $payment->setPaymentMethod($paymentMethod); } $payment->raw = $response; return $payment; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['name' => null, 'amount' => null], $values); $message->setName($values['name']); $message->setAmount($values['amount']); return $message; }
/** * Build a payment entity based on a json-decoded payment stdClass * * @param stdClass $response The payment data * @return Syspay_Merchant_Entity_Payment The payment object */ public static function buildFromResponse(stdClass $response) { $payment = new self(); $payment->setId(isset($response->id) ? $response->id : null); $payment->setReference(isset($response->reference) ? $response->reference : null); $payment->setAmount(isset($response->amount) ? $response->amount : null); $payment->setCurrency(isset($response->currency) ? $response->currency : null); $payment->setStatus(isset($response->status) ? $response->status : null); $payment->setExtra(isset($response->extra) ? $response->extra : null); $payment->setDescription(isset($response->description) ? $response->description : null); $payment->setWebsite(isset($response->website) ? $response->website : null); $payment->setFailureCategory(isset($response->failure_category) ? $response->failure_category : null); $payment->setChipAndPinStatus(isset($response->chip_and_pin_status) ? $response->chip_and_pin_status : null); if (isset($response->processing_time) && !is_null($response->processing_time)) { $payment->setProcessingTime(Syspay_Merchant_Utils::tsToDateTime($response->processing_time)); } if (isset($response->billing_agreement) && $response->billing_agreement instanceof stdClass) { $billingAgreement = Syspay_Merchant_Entity_BillingAgreement::buildFromResponse($response->billing_agreement); $payment->setBillingAgreement($billingAgreement); } if (isset($response->subscription) && $response->subscription instanceof stdClass) { $subscription = Syspay_Merchant_Entity_Subscription::buildFromResponse($response->subscription); $payment->setSubscription($subscription); } return $payment; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['result' => null, 'pokemon_id' => null, 'amount' => null], $values); $message->setResult($values['result']); $message->setPokemonId($values['pokemon_id']); $message->setAmount($values['amount']); return $message; }