承接 pixelpillow/lunar-api-mollie-adapter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pixelpillow/lunar-api-mollie-adapter

Composer 安装命令:

composer require pixelpillow/lunar-api-mollie-adapter

包简介

This addon enables Mollie payments on your Lunar storefront when using the Lunar API package.

README 文档

README

lunar-api-mollie-adapter

Table of Contents

Description

This package is designed to seamlessly integrate Mollie payments into your Lunar storefront. By leveraging the Lunar API, this adapter makes it easy to accept and manage payments through Mollie, a popular payment service provider.

Whether you're running an e-commerce platform or a subscription service, this adapter will help you handle payments efficiently and securely. With easy installation and configuration, you can have Mollie payments up and running on your Lunar storefront in no time.

Please follow the installation and configuration instructions in the Installation section to get started.

Dependencies

This package depends on the following packages:

Features

  • Multiple payment methods, including iDEAL, credit card, PayPal, Apple Pay, and more
  • Expose Payment methods in the API
  • Expose Payment issuers for ideal payments in the API

Installation

  1. Install this package via composer:
composer require pixelpillow/lunar-api-mollie-adapter
  1. Publish the config file:
php artisan vendor:publish --tag="lunar-api-mollie-adapter-config"
  1. Add your Mollie API key (You can obtain your API key by signing up on the Mollie website.) to the .env file:
MOLLIE_API_KEY=your-api-key
  1. Add the Mollie payment type to the config/lunar/payments.php file:
<?php

return [
    'default' => env('PAYMENTS_TYPE', 'cash-in-hand'),
    'types' => [
        'cash-in-hand' => [
            'driver' => 'offline',
            'authorized' => 'payment-offline',
        ],
        // Add the Mollie payment type here:
        'mollie' => [
            'driver' => 'mollie',
            'authorized' => 'payment-received',
        ],
    ],
];
  1. Manage the redirect on success in your own RedirectOnSuccessUrlGenerator by defining your own generator in the config/lunar-api-mollie-adapter.php file:
<?php

namespace App\Mollie\Generators;

use Dystcz\LunarApi\Domain\Carts\Models\Cart;
use Pixelpillow\LunarApiMollieAdapter\Generators\RedirectOnSuccessUrlGenerator;

class CustomRedirectOnSuccessUrlGenerator extends RedirectOnSuccessUrlGenerator
{
    /**
     * @var Cart
     */
    protected $cart;

    public function __construct(Cart $cart)
    {
        $this->cart = $cart;
    }

    /**
     * Generate the webhook URL.
     */
    public function generate(): string
    {
        $order = $this->cart->orders()->first();

        if (! $order) {
            throw new \Exception('Order not found');
        }

        // Return your own redirect URL here
        return 'https://example.com/checkout/success?order_id=' . $order->id;
    }
}
  1. Manage the redirect on failure in your the RedirectOnFailureUrlGenerator by defining your own generator in the config/lunar-api-mollie-adapter.php file:
<?php

namespace App\Mollie\Generators;

use Dystcz\LunarApi\Domain\Carts\Models\Cart;
use Lunar\Models\Order;
use Pixelpillow\LunarApiMollieAdapter\Generators\RedirectOnSuccessUrlGenerator;

class CustomRedirectOnFailureUrlGenerator extends RedirectOnSuccessUrlGenerator
{
    /**
     * @var Cart
     */
    protected $cart;

    /**
     * @var Order
     */
    protected $order;

    public function __construct(Cart $cart)
    {
        $this->cart = $cart;
    }

    /**
     * Generate the webhook URL.
     */
    public function generate(): string
    {

        $order = $this->cart->orders()->first();

        if (! $order) {
            throw new \Exception('Order not found');
        }

        // Return your own redirect URL here
        return 'https://example.com/checkout/failure?order_id=' . $order->id;
    }
}

Example JSON:API request for creating a Mollie IDEAL paymentIntent

The create-payment-intent url is a signed url can be found in the response of the POST /api/v1/carts/{cart}/-actions/checkout request.

POST api/v1/orders/{order}/-actions/create-payment-intent

{
  "data": {
    "type": "orders",
    "id": 1,
    "attributes": {
      "payment_method": "mollie",
      "meta": {
        "payment_method_type": "ideal"
      }
    }
  }
}

Example JSON:API request for creating a Mollie Bancontact paymentIntent

The create-payment-intent url is a signed url can be found in the response of the POST /api/v1/carts/{cart}/-actions/checkout request.

POST api/v1/orders/{order}/-actions/create-payment-intent

{
  "data": {
    "type": "orders",
    "id": 1,
    "attributes": {
      "payment_method": "mollie",
      "meta": {
        "payment_method_type": "bancontact"
      }
    }
  }
}

Endpoints

This package extends the Lunar API with the following endpoints:

GET /api/v1/payment-methods

Returns a list of enabled payment methods in the Mollie dashboard. The results are not paginated. See the Mollie API documentation for more information.

Example response:

{
  "jsonapi": {
    "version": "1.0"
  },
  "data": [
    {
      "type": "payment-methods",
      "id": "ideal",
      "attributes": {
        "name": "iDEAL",
        "method_id": "ideal",
        "image": [
          "https://www.mollie.com/external/icons/payment-methods/ideal.png",
          "https://www.mollie.com/external/icons/payment-methods/ideal%402x.png",
          "https://www.mollie.com/external/icons/payment-methods/ideal.svg"
        ]
      },
      "links": {
        "self": "https://api.monoz.test/api/v1/payment-methods/ideal"
      }
    }
  ]
}

Security

If you discover any security related issues, please email security[at]pixelpillow.nl instead of using the issue tracker.

Acknowledgements

License

The MIT License (MIT). Please see License File for more information.

pixelpillow/lunar-api-mollie-adapter 适用场景与选型建议

pixelpillow/lunar-api-mollie-adapter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payments」 「mollie」 「lunar」 「lunar-api」 「pixelpillow」 「lunar-api-mollie-adapter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pixelpillow/lunar-api-mollie-adapter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pixelpillow/lunar-api-mollie-adapter 我们能提供哪些服务?
定制开发 / 二次开发

基于 pixelpillow/lunar-api-mollie-adapter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-02