Single profit sharing.
请求单次分账.

@param string $transactionId 微信支付订单号
@param string $outOrderNo    商户系统内部的分账单号
@param string $receivers     分账接收方列表
428547
public function share(
        string $transactionId,
        string $outOrderNo,
        array $receivers
    ) {
        $params = [
            'appid' => $this->app['config']->app_id,
            'transaction_id' => $transactionId,
            'out_order_no' => $outOrderNo,
            'receivers' => json_encode(
                $receivers, JSON_UNESCAPED_UNICODE
            ),
        ];

        return $this->safeRequest(
            'secapi/pay/profitsharing', $params
        );
    }
617159
public CreateTransactionResult createTransaction(
            final long connectionId,
            final long txnId,
            final long uniqueId,
            final StoredProcedureInvocation invocation,
            final boolean isReadOnly,
            final boolean isSinglePartition,
            final boolean isEveryPartition,
            final int[] partitions,
            final int messageSize,
            long nowNanos,
            final boolean isForReplay)
    {
        assert(!isSinglePartition || (partitions.length == 1));
        final ClientInterfaceHandleManager cihm = m_cihm.get(connectionId);
        if (cihm == null) {
            hostLog.rateLimitedLog(60, Level.WARN, null,
                    "InvocationDispatcher.createTransaction request rejected. "
                    + "This is likely due to VoltDB ceasing client communication as it "
                    + "shuts down.");
            return CreateTransactionResult.NO_CLIENT_HANDLER;
        }

        Long initiatorHSId = null;
        boolean isShortCircuitRead = false;
        /*
         * Send the read to the partition leader only
         * @MigratePartitionLeader always goes to partition leader
         */
        if (isSinglePartition && !isEveryPartition) {
            initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitions[0]);
        } else {
            // Multi-part transactions go to the multi-part coordinator
            initiatorHSId = m_cartographer.getHSIdForMultiPartitionInitiator();

            // Treat all MP reads as short-circuit since they can run out-of-order
            // from their arrival order due to the MP Read-only execution pool
            if (isReadOnly) {
                isShortCircuitRead = true;
            }
        }

        if (initiatorHSId == null) {
            hostLog.rateLimitedLog(60, Level.INFO, null,
                    "InvocationDispatcher.createTransaction request rejected. "
                    + "This is likely due to parition leader being removed during elastic shrink.");
            return CreateTransactionResult.PARTITION_REMOVED;
        }

        long handle = cihm.getHandle(isSinglePartition, isSinglePartition ? partitions[0] : -1, invocation.getClientHandle(),
                messageSize, nowNanos, invocation.getProcName(), initiatorHSId, isShortCircuitRead);

        Iv2InitiateTaskMessage workRequest =
            new Iv2InitiateTaskMessage(m_siteId,
                    initiatorHSId,
                    Iv2InitiateTaskMessage.UNUSED_TRUNC_HANDLE,
                    txnId,
                    uniqueId,
                    isReadOnly,
                    isSinglePartition,
                    (partitions == null) || (partitions.length < 2) ? null : partitions,
                    invocation,
                    handle,
                    connectionId,
                    isForReplay);

        Long finalInitiatorHSId = initiatorHSId;
        final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.CI);
        if (traceLog != null) {
            traceLog.add(() -> VoltTrace.instantAsync("inittxn",
                                                      invocation.getClientHandle(),
                                                      "clientHandle", Long.toString(invocation.getClientHandle()),
                                                      "ciHandle", Long.toString(handle),
                                                      "partitions", partitions.toString(),
                                                      "dest", CoreUtils.hsIdToString(finalInitiatorHSId)));
        }

        Iv2Trace.logCreateTransaction(workRequest);
        m_mailbox.send(initiatorHSId, workRequest);
        return CreateTransactionResult.SUCCESS;
    }
993542
protected static function deleteTransactionByIdAsyncWithHttpInfo($transaction_id) 
    {
        $returnType = '';  
        $request = self::deleteTransactionByIdRequest($transaction_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
808429
public function refundByTransactionId(
        $orderNo,
        $refundNo,
        $totalFee,
        $refundFee = null,
        $opUserId = null,
        $refundAccount = 'REFUND_SOURCE_UNSETTLED_FUNDS'
    ) {
        return $this->refund($orderNo, $refundNo, $totalFee, $refundFee, $opUserId, self::TRANSACTION_ID, $refundAccount);
    }
255815
public function calculateTotalsAdvert(Transaction $transaction, $delivery=null)
    {
        $totals['delivery_expenses'] = 0;
        $totals['amount'] = $transaction->getTotalPrice();
        $totals['amount_clean'] = $transaction->getItems()->first()->getTotalPrice();
        $totals['vat'] = $totals['amount_clean'] * ($transaction->getVat() / 100);
       
        // return total
        return $totals;
    }
599081
private function verifyAndConfirm($transactionId = '')
    {
        if ($this->sandbox) {
            $this->endpoint = $this->sandbox_endpoint;
        }

        // 验证 DOC 3.3
        $url = $this->endpoint . '/TradeQuery?AuthCode=' . $this->auth_code;
        $response = $this->xml2array($this->curl_request($url));
        $output = explode('|', $response['0']);
        if ($output['0'] != 1) {
            throw new Exception($output['1']);
        }

        // 确认交易 DOC 3.4
        // TODO :: 为避免不必要麻烦 所有 CPCustId 均使用 transactionId代替
        $url = $this->endpoint . '/PaymentConfirm?CPCustId=' . $transactionId . '&AuthCode=' . $this->auth_code;
        $response = $this->xml2array($this->curl_request($url));
        $output = explode('|', $response['0']);
        if ($output['0'] != 1) {
            throw new Exception($output['1']);
        }

        return true;
    }
679549
public function beginTransaction($transactionOptions, array $options = [])
    {
        $res = $this->connection->beginTransaction([
            'projectId' => $this->projectId,
            'transactionOptions' => $transactionOptions
        ] + $options);

        return $res['transaction'];
    }
160767
public function startTransaction($transactionId = '')
    {
        $this->logger->debug(__FUNCTION__, 'Input Transaction ID: ' . json_encode($transactionId));
        if (empty($transactionId)) {
            $transactionId = date('YmdHis') . rand(100000, 999999);
        }
        $this->transactionId = $transactionId;
        $this->logger->debug(__FUNCTION__, 'Output Transaction ID: ' . json_encode($this->transactionId));

        return $this;
    }
1348641
public function processTransaction(array $transactionData, string $operation): ProcessInterface
    {
        // When hitting the process endpoint, we only need the transactionId and operation key/value pairs, and
        // optionally the transactionAmount if we are capturing a portion of the total amount.
        $transactionData = array_filter($transactionData + ['operation' => $operation], function ($k) {
            return in_array($k, ['transactionId', 'operation', 'transactionAmount']);
        }, ARRAY_FILTER_USE_KEY);

        $uri = $this->getUri('process', $this->getParameters($transactionData));
        /** @var ProcessInterface $response */
        $response = $this->performRequest((string) $uri);

        Assert::isInstanceOf($response, ProcessInterface::class, 'Invalid response');

        return $response;
    }
377891
public function captureTransaction($location_id, $transaction_id)
    {
        list($response, $statusCode, $httpHeader) = $this->captureTransactionWithHttpInfo ($location_id, $transaction_id);
        return $response; 
    }
374135
public static function fromDict($rsp, $txnType, $filterBy = null, $returnType = 'HpsReportTransactionSummary')
    {
        $transactions = array();

        if ((string)$rsp->Transaction->ReportActivity->Header->TxnCnt == "0") {
            return $transactions;
        }

        if ($filterBy != null && is_string($filterBy)) {
            $filterBy = HpsTransaction::serviceNameToTransactionType($filterBy);
        }

        $summary = null;
        $serviceName = (isset($filterBy) ? HpsTransaction::transactionTypeToServiceName($filterBy) : null);

        foreach ($rsp->Transaction->ReportActivity->Details as $charge) {
            if (isset($serviceName) && $serviceName != (string)$charge->ServiceName) {
                continue;
            }

            $summary = new HpsReportTransactionSummary();

            // Hydrate the header
            $summary->_header = new HpsTransactionHeader();
            $summary->_header->gatewayResponseCode = (string)$charge->GatewayRspCode;
            $summary->_header->gatewayResponseMessage = (string)$charge->GatewayRspMsg;

            $summary->transactionId = (string)$charge->GatewayTxnId;

            $summary->originalTransactionId = (isset($charge->OriginalGatewayTxnId) ? (string)$charge->OriginalGatewayTxnId : null);
            $summary->maskedCardNumber = (isset($charge->MaskedCardNbr) ? (string)$charge->MaskedCardNbr : null);
            $summary->responseCode = (isset($charge->IssuerRspCode) ? (string)$charge->IssuerRspCode : null);
            $summary->responseText = (isset($charge->IssuerRspText) ? (string)$charge->IssuerRspText : null);
            $summary->amount = (isset($charge->Amt) ? (string)$charge->Amt : null);
            $summary->settlementAmount = (isset($charge->SettlementAmt) ? (string)$charge->SettlementAmt : null);
            $summary->transactionType = (isset($charge->ServiceName) ? HpsTransaction::serviceNameToTransactionType((string)$charge->ServiceName) : null);
            $summary->transactionUTCDate = (isset($charge->TxnUtcDT) ? (string)$charge->TxnUtcDT : null);

            $gwResponseCode = (isset($charge->GatewayRspCode) ? (string)$charge->GatewayRspCode : null);
            $issuerResponseCode  = (isset($charge->IssuerRspCode) ? (string)$charge->IssuerRspCode : null);

            if ($gwResponseCode != "0" || $issuerResponseCode != "00") {
                $exceptions = new HpsChargeExceptions();
                if ($gwResponseCode != "0") {
                    $message = (string)$charge->GatewayRspMsg;
                    $exceptions->hpsException = HpsGatewayResponseValidation::getException((string)$charge->GatewayTxnId, $gwResponseCode, $message);
                }
                if ($issuerResponseCode != "00") {
                    $message = (string)$charge->IssuerRspText;
                    $exceptions->cardException = HpsIssuerResponseValidation::getException((string)$charge->GatewayTxnId, $issuerResponseCode, $message, 'credit');
                }
                $summary->exceptions = $exceptions;
            }

            $transactions[] = $summary;
        }
        return $transactions;
    }
824282
public Transaction findByTransactionId(String transactionId) {
        EntityManager entityManager = getEntityManager();
        try {
            return entityManager.createQuery("SELECT t FROM io.motown.operatorapi.viewmodel.persistence.entities.Transaction AS t WHERE t.transactionId = :transactionId", Transaction.class)
                    .setParameter("transactionId", transactionId)
                    .getSingleResult();
        } finally {
            entityManager.close();
        }
    }
62256
public function addTransaction(TPkgShopPaymentTransactionData $transactionData)
    {
        $transactionData->checkRequirements();

        $sTransactionType = $transactionData->getType();
        $amount = $transactionData->getTotalValue();
        $oContext = $transactionData->getContext();
        $iSequenceNumber = $transactionData->getSequenceNumber();

        $oTransactionType = $this->getTransactionTypeObject($sTransactionType);

        if (null === $iSequenceNumber) {
            $iSequenceNumber = $this->getNextTransactionSequenceNumber();
        }
        if (self::TRANSACTION_TYPE_CREDIT == $sTransactionType || self::TRANSACTION_TYPE_PAYMENT_REVERSAL === $sTransactionType) {
            $amount = -1 * $amount;
        }
        $aData = array(
            'shop_order_id' => $this->order->id,
            'data_extranet_user_id' => (null !== $oContext->getExtranetUser()) ? ($oContext->getExtranetUser(
            )->id) : (''),
            'cms_user_id' => (null !== $oContext->getCmsUser()) ? ($oContext->getCmsUser()->id) : (''),
            'datecreated' => date('Y-m-d H:i:s'),
            'ip' => $oContext->getIp(),
            'amount' => $amount,
            'context' => $oContext->getContext(),
            'pkg_shop_payment_transaction_type_id' => $oTransactionType->id,
            'sequence_number' => $iSequenceNumber,
            'confirmed' => '0',
        );

        $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance($aData);

        $oTransaction->AllowEditByAll(true);
        $oTransaction->SaveFieldsFast($aData);
        $oTransaction->AllowEditByAll(false);

        // add items
        $aItems = $transactionData->getItems();
        /** @var TPkgShopPaymentTransactionItemData $oItem */
        $itemAmountMultiplier = 1;
        if (self::TRANSACTION_TYPE_CREDIT == $sTransactionType || self::TRANSACTION_TYPE_PAYMENT_REVERSAL === $sTransactionType) {
            $itemAmountMultiplier = -1;
        }

        foreach ($aItems as $oItem) {
            $aData = array(
                'pkg_shop_payment_transaction_id' => $oTransaction->id,
                'amount' => ($itemAmountMultiplier * $oItem->getAmount()),
                'value' => $oItem->getValue(),
                'shop_order_item_id' => $oItem->getOrderItemId(),
                'type' => $oItem->getType(),
            );
            $oTransactionPosition = TdbPkgShopPaymentTransactionPosition::GetNewInstance($aData);
            $oTransactionPosition->AllowEditByAll(true);
            $oTransactionPosition->SaveFieldsFast($aData);
        }

        if (true === $transactionData->getConfirmed()) {
            $this->confirmTransaction($iSequenceNumber, $transactionData->getConfirmedTimestamp());
        }

        return $oTransaction;
    }
753133
public function sendPayDeliverNotify($openid,$transid,$out_trade_no,$status=1,$msg='ok'){
		if (!$this->access_token && !$this->checkAuth()) return false;
		$postdata = array(
				"appid"=>$this->appid,
				"appkey"=>$this->paysignkey,
				"openid"=>$openid,
				"transid"=>strval($transid),
				"out_trade_no"=>strval($out_trade_no),
				"deliver_timestamp"=>strval(time()),
				"deliver_status"=>strval($status),
				"deliver_msg"=>$msg,
		);
		$postdata['app_signature'] = $this->getSignature($postdata);
		$postdata['sign_method'] = 'sha1';
		unset($postdata['appkey']);
		$result = $this->http_post(self::API_BASE_URL_PREFIX.self::PAY_DELIVERNOTIFY.'access_token='.$this->access_token,self::json_encode($postdata));
		if ($result)
		{
			$json = json_decode($result,true);
			if (!$json || !empty($json['errcode'])) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			return $json;
		}
		return false;
	}
1245844
public WePayOrder queryByOutTradeNo(String outTradeNo){
        checkNotNullAndEmpty(outTradeNo, "outTradeNo");
        Map<String, String> queryParams = new TreeMap<>();
        put(queryParams, WepayField.OUT_TRADE_NO, outTradeNo);
        return doQueryOrder(queryParams);
    }
776546
public function loadByTransactionId($transactionId)
    {
        $result = false;
        $data = $this->getDbGateway()->loadByTransactionId($transactionId);
        if ($data) {
            $this->setData($data);
            $result = true;
        }

        return $result;
    }
562835
public RefundQuery refundQueryByTransactionId(String transactionId) {
        RefundQueryRequestWrapper refundQueryRequestWrapper = new RefundQueryRequestWrapper();
        refundQueryRequestWrapper.setTransactionId(transactionId);
        return refundQuery(refundQueryRequestWrapper);
    }