Skip to content

Latest commit

 

History

History
278 lines (227 loc) · 10.3 KB

README.md

File metadata and controls

278 lines (227 loc) · 10.3 KB

Integration Project

License: MIT

Synchronize Your Code Universe

Enhance your integration workflows with the Integration Library, specifically tailored for eCommerce marketplaces and payment gateways.

Build Status

  status nuget
Integration.Hub GitHub Workflow Status (with event) Nuget Nuget
Integration.Marketplaces.Trendyol GitHub Workflow Status (with event) Nuget Nuget
Integration.Marketplaces.Hepsiburada GitHub Workflow Status (with event) Nuget Nuget
Integration.PaymentGateways.Paynet GitHub Workflow Status (with event) Nuget Nuget
Integration.PaymentGateways.Sipay GitHub Workflow Status (with event) Nuget Nuget

Table of contents

Introduction

Enhance your integration workflows with the Integration Library, specifically tailored for eCommerce marketplaces and payment gateways. This library is designed to streamline and facilitate the integration process, providing seamless connectivity to a wide range of eCommerce platforms and payment services. Whether you're managing online stores, processing transactions, or integrating various eCommerce solutions, the Integration Library is a valuable resource for efficient and effective integration of these key systems and services.

How to use

Trendyol

dotnet add package Integration.Marketplaces.Trendyol --version 1.0.1
using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration;
using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Helpers;

var trendyolProductIntegration = new TrendyolProductIntegration(
        supplierId: "supplierId",
        apiKey: "apiKey",
        apiSecret: "apiSecret",
        isInProduction: false,
        entegratorFirm: "entegratorFirm");

//Get All Categories
var categories = await trendyolProductIntegration.GetCategoryTreeAsync();

//Get All Brands
var brands = await trendyolProductIntegration.GetBrandsAsync();

//Filter products
var productFilter = new ProductFilterBuilder()
    .AddApprovalStatus(true)
    .AddBarcode("barcode")
    .AddStartDate(0)
    .AddEndDate(0)
    .AddPage(1)
    .AddSize(10)
    .AddSupplierId(0)
    .Build();

var products = await trendyolProductIntegration.FilterProductsAsync(productFilter);

Hepsiburada

dotnet add package Integration.Marketplaces.Hepsiburada --version 1.0.1
using Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration;

var hepsiburadaProductIntegration = new HepsiburadaProductIntegration(
        username: "username",
        password: "password",
        isInProduction: false);

//Get All Categories
var categories = await hepsiburadaProductIntegration.GetCategoriesAsync();

//Get Category Attributes
var categoryAttributes = await hepsiburadaProductIntegration.GetCategoryAttributesAsync(categoryId: 80844002);

// Get Category Attribute Values
var categoryAttributeValues = await hepsiburadaProductIntegration.GetCategoryAttributeValuesAsync(categoryId: 80844002, attributeId: "gram");

Paynet

dotnet add package Integration.PaymentGateways.Paynet --version 1.0.0
using Integration.PaymentGateways.Paynet.Infrastructure.PaymentIntegration.Models.Request;

var paynetPaymentIntegration = new PaynetPaymentIntegration(
    secretKey: "secretKey",
    isInProduction: false);

// Get installments
var installments = await paynetPaymentIntegration.CheckInstallmentAsync(new CheckInstallmentRequestModel(bin: "bin", amount: 100));

// Non secure payment
var nonSecurePaymentResponse = await paynetPaymentIntegration.NonSecurePaymentAsync(new NonSecurePaymentRequestModel(
    amount: "100",
    referenceNo: "referenceNo",
    domain: "domain",
    cardHolder: "cardHolder",
    pan: "pan",
    month: "month",
    year: "year",
    cvc: "cvc",
    instalment: 1));

// Secure payment
// 1. Get secure payment initial
var securePaymentInitialResponse = await paynetPaymentIntegration.SecurePaymentInitialAsync(new SecurePaymentInitialRequestModel(
    amount: "100",
    orderRefNo: "orderRefNo",
    domain: "domain",
    cardHolder: "cardHolder",
    pan: "pan",
    month: 1,
    year: 2021,
    cvc: "cvc",
    returnUrl: "returnUrl",
    instalment: 1));

// 2. Show 3ds html content to user
Console.WriteLine(securePaymentInitialResponse.HtmlContent);

// 3. After successfull 3d confirmation, secure payment charge
var securePaymentChargeRequest = await paynetPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
    sessionId: securePaymentInitialResponse.SessionId,
    tokenId: securePaymentInitialResponse.TokenId));

// Cancel payment
var cancelResponse = await paynetPaymentIntegration.CancelAsync(new CancellationRequestModel(
    xactId: "xactId",
    succeedUrl: "succeedUrl"
));

// Refund payment
var refundResponse = await paynetPaymentIntegration.RefundAsync(new RefundRequestModel(
    xactId: "xactId",
    amount: "100",
    succeedUrl: "succeedUrl"
));

Sipay

dotnet add package Integration.PaymentGateways.Sipay --version 1.0.0
using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;

var sipayPaymentIntegration = new SipayPaymentIntegration(
    merchantKey: "merchantKey",
    appKey: "appKey",
    appSecret: "appSecret",
    merchantId: 0,
    isInProduction: false
);

// Authorization is mandatory to further requests
await sipayPaymentIntegration.SetTokenAsync();

// Get installments
var installments = await sipayPaymentIntegration.CheckInstallmentsAsync(new CheckInstallmentRequestModel(
    creaditCard: "123456",
    amount: 100,
    currenyCode: "TRY"
));

// Non secure payment
var nonSecurePaymentResponse = await sipayPaymentIntegration.NonSecurePaymentAsync(new NonSecurePaymentRequestModel(
    ccHolderName: "John Doe",
    ccNo: "123456",
    expiryMonth: 12,
    expiryYear: 2022,
    cvv: 123,
    currencyCode: "TRY",
    installmentsNumber: 1,
    invoiceId: 1,
    invoiceDescription: "Invoice description",
    name: "John",
    surname: "Doe",
    total: 100,
    items: "items",
    cancelUrl: "https://cancelUrl.com",
    returnUrl: "https://returnUrl.com",
    hashKey: "hashKey",
    ip: "",
    orderType: 0
));

// Secure payment
// 1. Get secure payment hmtl content and show to user
var securePaymentInitialHtml = sipayPaymentIntegration.SecurePaymentInitial(new SecurePaymentInitialRequestModel(
    ccHolderName: "John Doe",
    ccNo: "123456",
    expiryMonth: 12,
    expiryYear: 2022,
    cvv: 123,
    currencyCode: "TRY",
    installmentsNumber: 1,
    invoiceId: "1",
    invoiceDescription: "Invoice description",
    name: "John",
    surname: "Doe",
    total: 100,
    items: "items",
    cancelUrl: "https://cancelUrl.com",
    returnUrl: "https://returnUrl.com",
    hashKey: "hashKey",
    orderType: 0,
    recurringPaymentNumber: 0,
    recurringPaymentCycle: "",
    recurringPaymentInterval: "",
    recurringWebHookKey: "",
    maturityPeriod: 0,
    paymentFrequency: 0
));

// 2. Show 3ds html content to user
Console.WriteLine(securePaymentInitialHtml);

// 3. After successfull 3d confirmation, secure payment charge
var securePaymentChargeRequest = await sipayPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
    invoiceId: "1",
    orderId: "1",
    status: "1",
    hashKey: ""));


// Cancel payment
var cancelResponse = await sipayPaymentIntegration.CancelAsync(new CancellationRequestModel(
    invoiceId: "",
    hashKey: "",
    refundTransactionId: "",
    refundWebhookKey: ""
));

// Refund payment
var refundResponse = await sipayPaymentIntegration.RefundAsync(new RefundRequestModel(
    invoiceId: "",
    amount: 100,
    hashKey: "",
    refundTransactionId: "",
    refundWebhookKey: ""
));