Create a usage charges

@link   https://help.shopify.com/api/reference/usagecharge#create
@param  integer     $recurringApplicationChargeId
@param  UsageCharge $usageCharge
@return void
494380
public function create($recurringApplicationChargeId, UsageCharge $usageCharge)
    {
        $data = $usageCharge->exportData();
        $endpoint = '/admin/recurring_application_charges/'.$recurringApplicationChargeId.'/usage_charges.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'usage_charge' => $data
            )
        );
        $usageCharge->setData($response['usage_charge']);
    }
158705
public function disableRecurringPayments(string $currencyCode, string $paymentProviderId): BalanceInterface
    {
        $response = $this->client->post(
            $this->getBaseEndpointUri()->withPath("{$this->getBaseEndpointUri()->getPath()}/recurring-setup")->withQuery(http_build_query(['supportedCurrencyId' => $currencyCode])),
            (string) json_encode((object) [
                'providerId' => $paymentProviderId,
                'chargePerUsage' => 'true',
            ])
        );

        return $this->entitySerializer->deserialize(
            (string) $response->getBody(),
            $this->getEntityClass(),
            'json'
        );
    }
1156030
public static function create(
        SchedulePaymentEntry $payment,
        Schedule $schedule,
        int $monetaryAccountId = null,
        array $customHeaders = []
    ): BunqResponseInt {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId)]
            ),
            [
                self::FIELD_PAYMENT => $payment,
                self::FIELD_SCHEDULE => $schedule,
            ],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
1207096
public function withRecurringInfo($recurringType, $recurringSequence)
    {
        $this->recurringType = $recurringType;
        $this->recurringSequence = $recurringSequence;
        return $this;
    }
1200351
public Charge create(Charge charge) throws BaseException {

		logger.debug("Enter ChargeService::create");
		
		// prepare API url
		String apiUrl = requestContext.getBaseUrl() + "charges".replaceAll("\\{format\\}", "json");
		logger.info("apiUrl - " + apiUrl);
		
		// assign TypeReference for deserialization
		TypeReference<Charge> typeReference = new TypeReference<Charge>() {
		};

		// prepare service request
		Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(charge)
				.typeReference(typeReference).context(requestContext).build();

		// make API call
		Response response = sendRequest(request);

		// retrieve response
		Charge chargeResponse = (Charge) response.getResponseObject();

		// set additional attributes
		prepareResponse(request, response, chargeResponse);
		return chargeResponse;
	}
577821
func (s *ReservedElasticsearchInstance) SetRecurringCharges(v []*RecurringCharge) *ReservedElasticsearchInstance {
	s.RecurringCharges = v
	return s
}
708840
public function addUse(string $use, string $useAlias = null): void
    {
        $this->generator->addUse($use, $useAlias);
    }
386191
public function update_recurring($subscription_id, Merchant_Billing_CreditCard $creditcard)
  {
      $this->xml = <<<XML
            <subscriptionId>$subscription_id</subscriptionId>
              <subscription>
XML;
      $this->arb_add_creditcard($creditcard);
      $this->xml .= '</subscription>';

      return $this->recurring_commit('update');
  }
155429
func (s *RecurringCharge) SetRecurringChargeAmount(v float64) *RecurringCharge {
	s.RecurringChargeAmount = &v
	return s
}
1355574
public function setAppUsed( string $api_key, string $region, int $timeInterval, int $value )
	{
		$this->limits[$region][$api_key]['app'][$timeInterval]['used'] = $value;
		if ($value == 1)
			$this->limits[$region][$api_key]['app'][$timeInterval]['expires'] = time() + $timeInterval;
	}
866156
public function createForCharge(array $data, array $headers = [])
    {
        $url = $this->url('invoices/charge');

        return $this->post($url, $data, $headers);
    }
508424
private Billing generateDefaultBilling() {
        Billing billing = new Billing();
        billing.setPaymentTiming("Postpaid");
        billing.setBillingMethod("ByBandwidth");
        return billing;
    }
579704
@Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        if (context == null) {
            synchronized (ApplicationContextHolder.class) {
                if (context == null) {
                    ApplicationContextHolder.context = applicationContext;
                }
            }
        }
    }
743905
public function createOperation(
        $amount,
        $originAmount,
        DateTime $cycleDate,
        $paymentVoucher,
        $vendor,
        $adjustedOperationsIds = null
    ) {
        //Set hipay id
        $hipayId = $vendor->getHiPayId();

        //Call implementation function
        $operation = $this->operationManager->create($amount, $cycleDate, $paymentVoucher, $vendor->getMiraklId());

        $operation->setHiPayId($hipayId);

        //Sets mandatory values
        $operation->setMiraklId($vendor->getMiraklId());
        $operation->setStatus(new Status(Status::CREATED));
        $operation->setUpdatedAt(new DateTime());
        $operation->setAmount($amount);
        $operation->setOriginAmount($originAmount);
        $operation->setCycleDate($cycleDate);
        $operation->setPaymentVoucher((string)$paymentVoucher);

        // if adjustments were made, save adjusted operations
        if ($adjustedOperationsIds !== null) {
            $operation->setAdjustmentIds(json_encode($adjustedOperationsIds));
        }

        $this->isOperationValid($operation);

        $this->operationsLogs[] = $this->logOperationsManager->create(
            $vendor->getMiraklId(),
            $hipayId,
            (string)$paymentVoucher,
            $amount,
            $originAmount,
            $this->hipay->getBalance($vendor)
        );
        return $operation;
    }
149383
public function onChargeCreate(StripeChargeCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $localCharge = $event->getLocalCharge();

        $result = $this->getStripeManager()->createCharge($localCharge);

        // Check if something went wrong
        if (false === $result) {
            // Stop progation
            $event->setStopReason($this->getStripeManager()->getError())->stopPropagation();

            // Dispatch a failed event
            $dispatcher->dispatch(StripeChargeCreateEvent::FAILED, $event);

            // exit
            return;
        }

        $dispatcher->dispatch(StripeChargeCreateEvent::CREATED, $event);
    }
463298
protected function _createPaymentMethodFromBA(
        Adyen_Payment_Model_Billing_Agreement $billingAgreement,
        Mage_Core_Model_Store $store
    ) {
        $methodInstance = $billingAgreement->getPaymentMethodInstance();
        if (!$methodInstance || !$methodInstance->getConfigData('active', $store)) {
            return false;
        }

        $methodNewCode = 'adyen_oneclick_' . $billingAgreement->getReferenceId();

        $methodData = array('model' => 'adyen/adyen_oneclick')
            + $billingAgreement->getOneClickData()
            + Mage::getStoreConfig('payment/adyen_oneclick', $store);

        foreach ($methodData as $key => $value) {
            $store->setConfig('payment/' . $methodNewCode . '/' . $key, $value);
        }

        return true;
    }
729596
public function listRecurringContracts($shopperReference, $store = null)
    {

        $recurringContracts = array();
        foreach ($this->_recurringTypes as $recurringType) {
            try {
                // merge ONECLICK and RECURRING into one record with recurringType ONECLICK,RECURRING
                $listRecurringContractByType = $this->listRecurringContractByType(
                    $shopperReference, $store,
                    $recurringType
                );

                foreach ($listRecurringContractByType as $recurringContract) {
                    if (isset($recurringContract['recurringDetailReference'])) {
                        $recurringDetailReference = $recurringContract['recurringDetailReference'];
                        // check if recurring reference is already in array
                        if (isset($recurringContracts[$recurringDetailReference])) {
                            // recurring reference already exists so recurringType is possible for ONECLICK and RECURRING
                            $recurringContracts[$recurringDetailReference]['recurring_type'] = self::RECURRING_TYPE_ONECLICK_RECURRING;
                        } else {
                            $recurringContracts[$recurringDetailReference] = $recurringContract;
                        }
                    }
                }
            } catch (Adyen_Payment_Exception $e) {
                Adyen_Payment_Exception::throwException(
                    Mage::helper('adyen')->__(
                        "Error retrieving the Billing Agreement for shopperReference %s with recurringType #%s Error: %s",
                        $shopperReference, $recurringType, $e->getMessage()
                    )
                );
            }
        }

        return $recurringContracts;
    }