provider.'.png'; } public function isGateway($gatewayId) { return $this->id == $gatewayId; } public static function getPaymentTypeName($type) { return Utils::toCamelCase(strtolower(str_replace('PAYMENT_TYPE_', '', $type))); } public static function hasStandardGateway($gatewayIds) { $diff = array_diff($gatewayIds, static::$alternate); return count($diff); } public function scopePrimary($query, $accountGatewaysIds) { $query->where('payment_library_id', '=', 1) ->where('id', '!=', GATEWAY_WEPAY) ->whereIn('id', Gateway::$preferred) ->whereNotIn('id', $accountGatewaysIds); // if the user has a credit card gateway only show alternate options if (static::hasStandardGateway($accountGatewaysIds)) { $query->whereNotIn('id', array_diff(static::$preferred, static::$alternate)); } } public function scopeSecondary($query, $accountGatewaysIds) { // if the user has a credit card don't show an secondary options if (static::hasStandardGateway($accountGatewaysIds)) { $query->where('id', '=', 0); } else { $query->where('payment_library_id', '=', 1) ->where('id', '!=', GATEWAY_WEPAY) ->whereNotIn('id', static::$preferred); } } public function getHelp() { $link = ''; if ($this->id == GATEWAY_AUTHORIZE_NET) { $link = 'http://reseller.authorize.net/application/?id=5560364'; } elseif ($this->id == GATEWAY_PAYPAL_EXPRESS) { $link = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run'; } elseif ($this->id == GATEWAY_TWO_CHECKOUT) { $link = 'https://www.2checkout.com/referral?r=2c37ac2298'; } elseif ($this->id == GATEWAY_BITPAY) { $link = 'https://bitpay.com/dashboard/signup'; } elseif ($this->id == GATEWAY_DWOLLA) { $link = 'https://www.dwolla.com/register'; } elseif ($this->id == GATEWAY_SAGE_PAY_DIRECT || $this->id == GATEWAY_SAGE_PAY_SERVER) { $link = 'https://applications.sagepay.com/apply/2C02C252-0F8A-1B84-E10D-CF933EFCAA99'; } $key = 'texts.gateway_help_'.$this->id; $str = trans($key, ['link' => "Click here"]); return $key != $str ? $str : ''; } public function getFields() { return Omnipay::create($this->provider)->getDefaultParameters(); } }