Remove payment.

@param \Gpupo\CommonSchema\ORM\Entity\Trading\Payment\Payment $payment

@return bool TRUE if this collection contained the specified element, FALSE otherwise
178364
public function removePayment(\Gpupo\CommonSchema\ORM\Entity\Trading\Payment\Payment $payment)
    {
        return $this->payments->removeElement($payment);
    }
1169678
public function removeConciliation(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Conciliation\Conciliation $conciliation)
    {
        return $this->conciliations->removeElement($conciliation);
    }
382476
public function disablePaymentInstrument(
        CustomerInterface $customer,
        PaymentInstrumentInterface $paymentInstrument
    ): bool
    {
        $instrumentClient = new PaymentInstrumentClient($this->getContext(), $this->getOptions());
        $instrumentClient->setCustomer($customer);
        $instrumentClient->setToken($this->getToken());
        $response = $instrumentClient->disable($paymentInstrument);
        $this->setLastResponse($instrumentClient->getLastResponse());

        return $response??false;
    }
112102
public function filterByCurrency($currency) {
        foreach ($this->_paymentMethod as $name => $class) {
            if (!in_array($currency, $class->getSupportedCurrency()) && !in_array('00', $class->getSupportedCurrency()))
                unset($this->paymentMethods[$name]);
        }
        return $this;
    }
1219942
protected function preConfigure(Payment $payment)
	{
		if (!$payment->getTarget()) {
			$target = new Target();
			$target->goid = $this->client->getGoId();
			$target->type = TargetType::ACCOUNT;

			$payment->setTarget($target);
		}
	}
1351569
public function closeOrder($paymentId)
    {
        $params = [
            'appid' => $this->appId,
            'mch_id' => $this->mchId,
            'out_trade_no' => $paymentId,
            'nonce_str' => bin2hex(openssl_random_pseudo_bytes(8)),
        ];
        $params['sign'] = $this->createSign($params);
        $response = $this->api('https://api.mch.weixin.qq.com/pay/closeorder', 'POST', $params);
        if ($response->data['trade_state'] == 'SUCCESS') {
            return true;
        }
        return false;
    }
61513
public function delete($paymentMethod, $forceDelete = false)
    {
        $id = null;
        if ($paymentMethod instanceof HpsPayPlanPaymentMethod) {
            $id = $paymentMethod->paymentMethodKey;
        } else {
            $id = $paymentMethod;
        }

        $data = array(
            'forceDelete' => $forceDelete,
        );
        return $this->doRequest($data, array(
            'verb'     => 'DELETE',
            'endpoint' => 'paymentMethods/'.$id,
        ));
    }
515389
public function removeJournal(\HarvestCloud\CoreBundle\Entity\PaymentJournal $journal)
    {
        $this->journals->removeElement($journal);
    }
1028339
public function setPayment(Payment $payment, Vat $vat)
    {
        $sum = $payment->getSum();
        $this->payment = $payment;
        $this->position = [
            'name' => $this->intent == static::INTENT_SELL
                ? 'Коррекция прихода'
                : 'Коррекция расхода',
            'price' => $sum,
            'quantity' => 1,
            'total' => $sum,
            'vat' => $vat->getRate()
        ];

        return $this;
    }
981049
public function paymentMethod(array $values)
    {
        $existing = array_filter($values, function ($method_id) {
            return (bool) $this->payment->get($method_id);
        });

        if (count($values) != count($existing)) {
            return $this->translation->text('@name is unavailable', array(
                '@name' => $this->translation->text('Payment')));
        }

        return true;
    }
747436
private function checkPaymentMethod($payment)
    {
        $paymentMethod = $payment->getMethod();

        if ($paymentMethod != Payment::METHOD_CODE) {
            throw new LocalizedException(__(
                'Payment method assigned to order is: %1',
                $paymentMethod
            ));
        }
    }
239118
private function checkConciliation($payment, $order)
    {
        if ($order->getStatus() == $this->getStatusFromPaymentKey($payment->getStatus()))
            return true;
        return false;
    }
632780
public function remove($package)
    {
        $output = $this->runCommand(self::REMOVE, $package, self::REMOVE_ARGS);

        if (!$output) {
            return true;
        }

        return false;
    }
1368390
public function resetPaymentMethodFilter(){
        foreach($this->options as $op=>$junk){
            if(preg_match("#PaymentMethod#",$op)){
                unset($this->options[$op]);
            }
        }
    }
1319547
public function delete($paymentId)
    {
        $db = $this->getDb();
        $db->startTransaction();

        $deleteResult = $db->execute('DELETE FROM `oepaypal_orderpayments` WHERE `oepaypal_paymentid` = ' . $db->quote($paymentId));
        $deleteCommentResult = $db->execute('DELETE FROM `oepaypal_orderpaymentcomments` WHERE `oepaypal_paymentid` = ' . $db->quote($paymentId));

        $result = ($deleteResult !== false) || ($deleteCommentResult !== false);

        if ($result) {
            $db->commitTransaction();
        } else {
            $db->rollbackTransaction();
        }

        return $result;
    }
282965
public function registerPayment(IncomingInvoice &$invoice, Payment $payment)
    {
        return $this->connector->registerPayment($invoice, $payment);
    }
1014894
public function payment(Payment $payment, &$paymentParams)
    {
        if (!$this->checkCurrency($payment->currency)) {
            Yii::$app->session->setFlash(Yii::t('payment', 'The gateway does not support the current currency!'));
        } else {
            $params = $this->buildPaymentParameter([
                'body' => !empty($payment->model_id) ? $payment->model_id : '充值',
                'out_trade_no' => $payment->id,
                'total_fee' => round($payment->money * 100),
                'fee_type' => $payment->currency,
                'spbill_create_ip' => $payment->ip,
                'trade_type' => $this->tradeTypeMap[$payment->trade_type],
            ]);
            if ($payment->trade_type == Payment::TYPE_JS_API) {//微信扫码付必须得字段
                $params['openid'] = $payment->user->wechat->openid;
            }
            $params['sign'] = $this->createSign($params);
            /** @var \yii\httpclient\Response $response */
            $response = $this->api('https://api.mch.weixin.qq.com/pay/unifiedorder', 'POST', $params);//统一下单
            if ($response->isOk && $response->data['return_code'] == 'SUCCESS') {
                $payment->updateAttributes(['pay_id' => $response->data['prepay_id']]);
                if ($payment->trade_type == Payment::TYPE_JS_API) {
                    $paymentParams = [
                        'appId' => $this->appId,
                        'timeStamp' => time(),
                        'nonceStr' => md5(uniqid()),
                        'package' => 'prepay_id=' . $response->data['prepay_id'],
                        'signType' => 'MD5',
                    ];
                    $paymentParams['paySign'] = $this->makeSign($paymentParams);
                    return;
                } elseif ($payment->trade_type == Payment::TYPE_NATIVE) {
                    $paymentParams['url'] = $response->data['code_url'];
                    $paymentParams['data'] = (new QrCode())->setText($response->data['code_url'])->setSize(240)->setPadding(10)->getDataUri();
                    return;
                }
            } else {
                $paymentParams = $response->data;
            }
        }
    }