catalog/model/extension/payment/pp_braintree.php

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class ModelExtensionPaymentPPBraintree extends Model {
	public function generateToken($gateway, $data) {
		try {
			if ($gateway != null) {
				$client_token = $gateway->clientToken()->generate($data);
			} else {
				$client_token = Braintree\ClientToken::generate($data);
			}

			return $client_token;
		} catch (Exception $e) {
			$this->log($e->getMessage());

			return false;
		}
	}

	public function addTransaction($gateway, $data) {
		try {
			if ($gateway != null) {
				$transaction = $gateway->transaction()->sale($data);
			} else {
				$transaction = Braintree\Transaction::sale($data);
			}

			return $transaction;
		} catch (Exception $e) {
			$this->log($e->getMessage());

			return false;
		}
	}

	public function getCustomer($gateway, $customer_id, $log = true) {
		try {
			if ($gateway != null) {
				$customer = $gateway->customer()->find($customer_id);
			} else {
				$customer = Braintree\Customer::find($customer_id);
			}

			return $customer;
		} catch (Exception $e) {
			if ($log) {
				$this->log($e->getMessage());
			}

			return false;
		}
	}

	public function getPaymentMethod($gateway, $token) {
		try {
			if ($gateway != null) {
				$payment_method = $gateway->paymentMethod()->find($token);
			} else {
				$payment_method = Braintree\PaymentMethod::find($token);
			}

后面还有 131 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。