Create new payment

@param string $appUserId
@param Payment $Payment
@return \Picoss\SMoney\Entity\Payment
492397
public function create($appUserId, Payment $Payment)
    {
        $url = sprintf('users/%s/payments', $appUserId);
        return $this->createObject($url, $Payment);
    }
886705
public function CreateKycPageFromFile($userId, $kycDocumentId, $filePath, $idempotencyKey = null)
    {
        if (empty($filePath)) {
            throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
        }

        if (!file_exists($filePath)) {
            throw new \MangoPay\Libraries\Exception('File not exist');
        }

        $kycPage = new \MangoPay\KycPage();
        $kycPage->File = base64_encode(file_get_contents($filePath));

        if (empty($kycPage->File)) {
            throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
        }

        return $this->CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey);
    }
1062288
public function create($appUserId, BankAccount $bankAccount)
    {
        $url = sprintf('users/%s/bankaccounts/', $appUserId);
        return $this->createObject($url, $bankAccount);
    }
851592
public function create($appUserId, SubAccount $subAccount)
    {
        $url = sprintf('users/%s/subaccounts/', $appUserId);
        return $this->createObject($url, $subAccount);
    }
1144921
public function charge(InvoicePayment $payment)
    {
        // Make a charge through Stripe
        try {
            $charge = Charge::create([
                // Multiply by 100 as Stripe charges in pence.
                'amount' => $payment->amount * 100,
                'currency' => 'gbp',
                'description' => 'Invoice payment',
                'metadata' => [
                    'invoice_id' => $payment->invoice->id
                ],
                'source' => $payment->getPreCommitMetadataArray()['STRIPE_TOKEN'],
            ]);

            // Add Stripe payment ID to invoice payment
            $payment->payment_id = $charge->id;

            $responseMeta = new InvoicePaymentMetadata();
            $responseMeta->key = 'GATEWAY_RESPONSE';
            $responseMeta->value = $charge->status;
            $payment->metadata()->save($responseMeta);

            $payment->save();

            return true;

        } catch(Card $cardError) {

            $payment->payment_id = $cardError->getJsonBody()['error']['charge'];
            $responseMeta = new InvoicePaymentMetadata();
            $responseMeta->key = 'GATEWAY_RESPONSE';
            $responseMeta->value = $cardError->getMessage();
            $payment->metadata()->save($responseMeta);
            $payment->save();

            return false;
        }
    }
935061
protected function createPayment($response)
    {
        $payment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
        $payment->setDate($this->getDate());
        $payment->setTransactionId($response->getTransactionId());
        $payment->setCorrelationId($response->getCorrelationId());
        $payment->setAction('capture');
        $payment->setStatus($response->getPaymentStatus());
        $payment->setAmount($response->getCapturedAmount());
        $payment->setCurrency($response->getCurrency());

        return $payment;
    }
7837
public function CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey = null)
    {
        $uploaded = false;
        try {
            $response = $this->CreateObject('kyc_page_create', $kycPage, null, $userId, $kycDocumentId, $idempotencyKey);
            $uploaded = true;
        } catch (\MangoPay\Libraries\ResponseException $exc) {
            if ($exc->getCode() != 204) {
                throw $exc;
            } else {
                $uploaded = true;
            }
        }
        return $uploaded;
    }
907976
public static function create(
        int $paymentId,
        int $monetaryAccountId = null,
        string $content = null,
        array $customHeaders = []
    ): BunqResponseInt {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId), $paymentId]
            ),
            [self::FIELD_CONTENT => $content],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
1179757
public function create($amount, $payment, $options = [])
    {
        $params = [];

        $params = $this->addPaymentMethod($params, $payment, $options);
        $params = $this->addOrder($params, $amount, $options);
        $params = $this->addCustomer($params, $options);

        return $this->gateway->commit('post', $this->gateway->buildUrlFromString('charges'), $params);
    }
654955
public function CreateKycDocument($userId, $kycDocument, $idempotencyKey = null)
    {
        return $this->CreateObject('kyc_documents_create', $kycDocument, '\MangoPay\KycDocument', $userId, null, $idempotencyKey);
    }
393791
public function create_preapproval_payment($preapproval_payment) {
        $request = array(
            "uri" => "/preapproval",
            "params" => array(
                "access_token" => $this->get_access_token()
            ),
            "data" => $preapproval_payment
        );

        $preapproval_payment_result = MPRestClient::post($request);
        return $preapproval_payment_result;
    }
1339571
public function registerPayment(Invoice &$invoice, Payment $payment)
    {
        return $this->connector->registerPayment($invoice, $payment);
    }
1059950
public function create($appId, $fileName, $filePath, array $queryParams = [])
    {
        $response = $this->api->applications()->uploads()->create($appId, $fileName, $filePath, $queryParams);

        return new UploadResponse($response);
    }
827595
private function placeOrder($payment, $method)
    {
        $this->changeOrderHistory('pagseguro_aguardando_pagamento');
        return $this->whenSuccess($payment->createPaymentRequest(), $method);
    }
220067
function createPayment(data, callback) {
    var client = new this.clients.Payments();
    client.create(data, callback);
  }
78410
public function createKYC($appUserId, KYC $kyc)
    {
        $url = sprintf('users/%s/kyc/', $appUserId);

        $headers = [
            'Accept' => sprintf('application/vnd.s-money.v%s+%s', $this->getApiVersion(), $this->getOutputFormat()),
            'Content-Type' => 'multipart/form-data',
        ];

        $body = [];
        $count = 0;
        foreach ($kyc->getFiles() as $file) {
            $postFile = new PostFile('file' . $count, fopen($file->getRealPath(), 'r'), $file->getFilename());
            $body['file' . $count] = $postFile;
            $count++;
        }

        try {
            $response = $this->root->getHttpClient()->post($url, $body, $headers);

            return $this->castResponseToEntity($response->json(['object' => true]), get_class($kyc));
        } catch (ClientException $e) {
            $this->addError($e->getRequest(), $e->getResponse());

            return false;
        }
    }
158468
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity)
    {
        $paymentMethodContainer = new DirectDebitContainer();

        $paymentMethodContainer->setBankCountry($paymentEntity->getSpyPaymentPayoneDetail()->getBankCountry());
        $paymentMethodContainer->setBankAccount($paymentEntity->getSpyPaymentPayoneDetail()->getBankAccount());
        $paymentMethodContainer->setBankCode($paymentEntity->getSpyPaymentPayoneDetail()->getBankCode());
        $paymentMethodContainer->setIban($paymentEntity->getSpyPaymentPayoneDetail()->getIban());
        $paymentMethodContainer->setBic($paymentEntity->getSpyPaymentPayoneDetail()->getBic());

        return $paymentMethodContainer;
    }