اذهب إلى المحتوى
  • 0

كيفية تقليل حقول الدفع في paypal

Marwan800

السؤال

السلام عليكم ورحمة الله وبركاته تحيه طيبه

استفسار لو تكرمتو ي اخوان

مثلا لو كنت اعمل تطبيق لجمع التبرعات على سبيل المثال وقمت باستخدام بوابة paypal

الدفع من خلال Smart Payment Buttons

صورة لتوضيح:

imageproxy.php?img=&key=e4ac65570db3469dimageproxy.php?img=&key=e4ac65570db3469d6019b4faf0d96_2021-02-03002400.thumb.png.0a747665f17e8cfa50b0505a6b750c85.png

هذا الزر الذي من خلاله نستطيع الدفع عن طريق الفيزا الى الباي بيال 

سوالي كيف ممكن ادفع عن طريق بيانات الفيزا بدون ظهور او اجبار المستخدم على تعبئة الحقول الاخرى

من غير المنطق ان اجعل المستخدم الذي اتى مثلا من اجل التبرع او شراء خدمه من تطبيقي ان يدخل بيانات شحن وهاتف نقال وعنوان الخ.. هو ليس في حاجه الى هذا البيانات لن ينقل شي 

ما هيا الطريقة لفعل ذلك ا ما هو الحل لتقليلل هذا الحقول الغير مطلوبه ؟

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 1

ممكن تجعل المستخدم يقوم بتعديل وحفظ البيانات مرة واحدة, ومن ثم تقوم في  واجهة الدفع بعرض فقط وسيلة الدفع بدون عرض فورم لتعبئة البيانات مثل بيانات العنوان والاسم و معلومات الشحن, فقط تقوم بجلب البيانات من model الخاص باليوزر بعد أن تحفظ البيانات بداخله مثلاً. 

طبعا يتم تمرير بيانات المستخدم من api الي بيرجع بيانات المستخدم إلى class model و عن طريق class model يمكن جلب البيانات. 

هناك طريقة أخرى هي فصل الواجهات فمثلا واجهة لتعبئة البيانات الشخصية تحتوي على الاسم والبريد الإلكتروني و باقي المعلومات, و من الواجهة الثانية تكون تعبئة معلومات وعنوان الشحن كاملا, و في اخر واجهة تعرض طريقة الدفع المختارة.

الفكرة هي استغلال البيانات التي تمررها لأي كلاس Model مسؤول عن أي واجهة. 

فمثلا في لغة فلاتر أقوم بعمل التالي 

عندي كلاس model لمعلومات الزبون أو العضو 

class CustomerDetailModel {
  int id;
  String firstName;
  String lastName;
  String email;
  Billing billing;
  Shipping shipping;

  CustomerDetailModel(
      {this.id, this.firstName, this.lastName, this.email, this.billing, this.shipping});

  CustomerDetailModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    firstName = json['first_name'];
    lastName = json['last_name'];
    email = json['email'];
    billing =
        json['billing'] != null ? new Billing.fromJson(json['billing']) : null;
    shipping = json['shipping'] != null
        ? new Shipping.fromJson(json['shipping'])
        : null;
  }
}

class Billing {
  String firstName;
  String lastName;
  String company;
  String address1;
  String address2;
  String city;
  String postcode;
  String country;
  String state;
  String email;
  String phone;

  Billing(
      {this.firstName,
      this.lastName,
      this.company,
      this.address1,
      this.address2,
      this.city,
      this.postcode,
      this.country,
      this.state,
      this.email,
      this.phone});

  Billing.fromJson(Map<String, dynamic> json) {
    firstName = json['first_name'];
    lastName = json['last_name'];
    company = json['company'];
    address1 = json['address_1'];
    address2 = json['address_2'];
    city = json['city'];
    postcode = json['postcode'];
    country = json['country'];
    state = json['state'];
    email = json['email'];
    phone = json['phone'];
  }

  Map<String, dynamic> toJson(){
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    data['company'] = this.company;
    data['address_1'] = this.address1;
    data['address_2'] = this.address2;
    data['city'] = this.city;
    data['postcode'] = this.postcode;
    data['country'] = this.country;
    data['state'] = this.state;
    data['email'] = this.email;
    data['phone'] = this.phone;
    return data;
  }
}

class Shipping {
  String firstName;
  String lastName;
  String company;
  String address1;
  String address2;
  String city;
  String postcode;
  String country;
  String state;

  Shipping(
      {this.firstName,
        this.lastName,
        this.company,
        this.address1,
        this.address2,
        this.city,
        this.postcode,
        this.country,
        this.state,});

  Shipping.fromJson(Map<String, dynamic> json) {
    firstName = json['first_name'];
    lastName = json['last_name'];
    company = json['company'];
    address1 = json['address_1'];
    address2 = json['address_2'];
    city = json['city'];
    postcode = json['postcode'];
    country = json['country'];
    state = json['state'];
  }

  Map<String, dynamic> toJson(){
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    data['company'] = this.company;
    data['address_1'] = this.address1;
    data['address_2'] = this.address2;
    data['city'] = this.city;
    data['postcode'] = this.postcode;
    data['country'] = this.country;
    data['state'] = this.state;
    return data;
  }
}

و عندما أريد استخدام البيانات التي تم تمريرها إلى كلاس Model في واجهة الدفع كالتالي

  

class OrderModel {
  OrderModel({
    this.id,
    this.parentId,
    this.number,
    this.orderKey,
    this.total,
    this.billing,
    this.shipping,
    this.paymentMethod,
    this.paymentMethodTitle,
    this.transactionId,
  });

  int id;
  int parentId;
  String number;
  String orderKey;
  String total;
  String totalTax;
  Ing billing;
  Ing shipping;
  String paymentMethod;
  String paymentMethodTitle;
  String transactionId;

  factory OrderModel.fromJson(Map<String, dynamic> json) => OrderModel(
        id: json["id"],
        parentId: json["parent_id"],
        number: json["number"],
        orderKey: json["order_key"],
        shippingTotal: json["shipping_total"],
        shippingTax: json["shipping_tax"],
        total: json["total"],
        totalTax: json["total_tax"],
        billing: Ing.fromJson(json["billing"]),
        shipping: Ing.fromJson(json["shipping"]),
        paymentMethod: json["payment_method"],
        paymentMethodTitle: json["payment_method_title"],
        transactionId: json["transaction_id"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "parent_id": parentId,
        "number": number,
        "order_key": orderKey,
        "shipping_total": shippingTotal,
        "shipping_tax": shippingTax,
        "total": total,
        "total_tax": totalTax,
        "billing": billing.toJson(),
        "shipping": shipping.toJson(),
        "payment_method": paymentMethod,
        "payment_method_title": paymentMethodTitle,
        "transaction_id": transactionId,
      };
}
void createOrder() async {
    if(_ordersModel.shipping == null){
      _ordersModel.shipping = this.customerDetailModel.shipping;
    }

    if(this.customerDetailModel.shipping != null){
      _ordersModel.shipping = this.customerDetailModel.shipping;
    }

	if(_ordersModel.billing == null){
      _ordersModel.billing = this.customerDetailModel.billing;
    }

    if(this.customerDetailModel.billing != null){
      _ordersModel.billing = this.customerDetailModel.billing;
    }

    if(ordersModel.lineItems == null){
      _ordersModel.lineItems = new List<LineItems>();
    }

}

جميع الأمثلة الموضحة مكتوبة بلغة Flutter

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ 8 دقائق مضت قال بلال زيادة:

ممكن تجعل المستخدم يقوم بتعديل وحفظ البيانات مرة واحدة, ومن ثم تقوم في  واجهة الدفع بعرض فقط وسيلة الدفع بدون عرض فورم لتعبئة البيانات مثل بيانات العنوان والاسم و معلومات الشحن, فقط تقوم بجلب البيانات من model الخاص باليوزر بعد أن تحفظ البيانات بداخله مثلاً. 

طبعا يتم تمرير بيانات المستخدم من api الي بيرجع بيانات المستخدم إلى class model و عن طريق class model يمكن جلب البيانات. 

هناك طريقة أخرى هي فصل الواجهات فمثلا واجهة لتعبئة البيانات الشخصية تحتوي على الاسم والبريد الإلكتروني و باقي المعلومات, و من الواجهة الثانية تكون تعبئة معلومات وعنوان الشحن كاملا, و في اخر واجهة تعرض طريقة الدفع المختارة.

الفكرة هي استغلال البيانات التي تمررها لأي كلاس Model مسؤول عن أي واجهة. 

فمثلا في لغة فلاتر أقوم بعمل التالي 

عندي كلاس model لمعلومات الزبون أو العضو 


class CustomerDetailModel {
  int id;
  String firstName;
  String lastName;
  String email;
  Billing billing;
  Shipping shipping;

  CustomerDetailModel(
      {this.id, this.firstName, this.lastName, this.email, this.billing, this.shipping});

  CustomerDetailModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    firstName = json['first_name'];
    lastName = json['last_name'];
    email = json['email'];
    billing =
        json['billing'] != null ? new Billing.fromJson(json['billing']) : null;
    shipping = json['shipping'] != null
        ? new Shipping.fromJson(json['shipping'])
        : null;
  }
}

class Billing {
  String firstName;
  String lastName;
  String company;
  String address1;
  String address2;
  String city;
  String postcode;
  String country;
  String state;
  String email;
  String phone;

  Billing(
      {this.firstName,
      this.lastName,
      this.company,
      this.address1,
      this.address2,
      this.city,
      this.postcode,
      this.country,
      this.state,
      this.email,
      this.phone});

  Billing.fromJson(Map<String, dynamic> json) {
    firstName = json['first_name'];
    lastName = json['last_name'];
    company = json['company'];
    address1 = json['address_1'];
    address2 = json['address_2'];
    city = json['city'];
    postcode = json['postcode'];
    country = json['country'];
    state = json['state'];
    email = json['email'];
    phone = json['phone'];
  }

  Map<String, dynamic> toJson(){
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    data['company'] = this.company;
    data['address_1'] = this.address1;
    data['address_2'] = this.address2;
    data['city'] = this.city;
    data['postcode'] = this.postcode;
    data['country'] = this.country;
    data['state'] = this.state;
    data['email'] = this.email;
    data['phone'] = this.phone;
    return data;
  }
}

class Shipping {
  String firstName;
  String lastName;
  String company;
  String address1;
  String address2;
  String city;
  String postcode;
  String country;
  String state;

  Shipping(
      {this.firstName,
        this.lastName,
        this.company,
        this.address1,
        this.address2,
        this.city,
        this.postcode,
        this.country,
        this.state,});

  Shipping.fromJson(Map<String, dynamic> json) {
    firstName = json['first_name'];
    lastName = json['last_name'];
    company = json['company'];
    address1 = json['address_1'];
    address2 = json['address_2'];
    city = json['city'];
    postcode = json['postcode'];
    country = json['country'];
    state = json['state'];
  }

  Map<String, dynamic> toJson(){
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    data['company'] = this.company;
    data['address_1'] = this.address1;
    data['address_2'] = this.address2;
    data['city'] = this.city;
    data['postcode'] = this.postcode;
    data['country'] = this.country;
    data['state'] = this.state;
    return data;
  }
}

و عندما أريد استخدام البيانات التي تم تمريرها إلى كلاس Model في واجهة الدفع كالتالي

  


class OrderModel {
  OrderModel({
    this.id,
    this.parentId,
    this.number,
    this.orderKey,
    this.total,
    this.billing,
    this.shipping,
    this.paymentMethod,
    this.paymentMethodTitle,
    this.transactionId,
  });

  int id;
  int parentId;
  String number;
  String orderKey;
  String total;
  String totalTax;
  Ing billing;
  Ing shipping;
  String paymentMethod;
  String paymentMethodTitle;
  String transactionId;

  factory OrderModel.fromJson(Map<String, dynamic> json) => OrderModel(
        id: json["id"],
        parentId: json["parent_id"],
        number: json["number"],
        orderKey: json["order_key"],
        shippingTotal: json["shipping_total"],
        shippingTax: json["shipping_tax"],
        total: json["total"],
        totalTax: json["total_tax"],
        billing: Ing.fromJson(json["billing"]),
        shipping: Ing.fromJson(json["shipping"]),
        paymentMethod: json["payment_method"],
        paymentMethodTitle: json["payment_method_title"],
        transactionId: json["transaction_id"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "parent_id": parentId,
        "number": number,
        "order_key": orderKey,
        "shipping_total": shippingTotal,
        "shipping_tax": shippingTax,
        "total": total,
        "total_tax": totalTax,
        "billing": billing.toJson(),
        "shipping": shipping.toJson(),
        "payment_method": paymentMethod,
        "payment_method_title": paymentMethodTitle,
        "transaction_id": transactionId,
      };
}

void createOrder() async {
    if(_ordersModel.shipping == null){
      _ordersModel.shipping = this.customerDetailModel.shipping;
    }

    if(this.customerDetailModel.shipping != null){
      _ordersModel.shipping = this.customerDetailModel.shipping;
    }

	if(_ordersModel.billing == null){
      _ordersModel.billing = this.customerDetailModel.billing;
    }

    if(this.customerDetailModel.billing != null){
      _ordersModel.billing = this.customerDetailModel.billing;
    }

    if(ordersModel.lineItems == null){
      _ordersModel.lineItems = new List<LineItems>();
    }

}

جميع الأمثلة الموضحة مكتوبة بلغة Flutter

اشكرك على التوضيح اخي

استفسار بس لو تكرمت

هل يمكني وضع قيم ثابته؟

بمعنى سوف اقوم بتعئبة الحقول الزايده في الخلفيه بدون تدخل المستخدم

وان لا يعلم بهن

هو فقط،سوف يشاهد بيانات الفيزا؟

 

برايك هذا الامر ينجح؟بحيث اني سوف اقوم بتثبيت بياناتي الشخصيه في كل الطلبات

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ 2 دقائق مضت قال Marwan800:

اشكرك على التوضيح اخي

استفسار بس لو تكرمت

هل يمكني وضع قيم ثابته؟

بمعنى سوف اقوم بتعئبة الحقول الزايده في الخلفيه بدون تدخل المستخدم

وان لا يعلم بهن

هو فقط،سوف يشاهد بيانات الفيزا؟

 

برايك هذا الامر ينجح؟بحيث اني سوف اقوم بتثبيت بياناتي الشخصيه في كل الطلبات

صحيح يمكن وضع قيم ثابتة ولا يمكن للعضو مشاهدة هذه البيانات, الأمر مبني على كيفية استخدامك للبيانات و هل تريد عرضها ام لا.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ 6 ساعات قال بلال زيادة:

صحيح يمكن وضع قيم ثابتة ولا يمكن للعضو مشاهدة هذه البيانات, الأمر مبني على كيفية استخدامك للبيانات و هل تريد عرضها ام لا.

اسعد الله صباحك اخوي

اشكرك على الافاده ولكن لو تكرمت هل لديك كود الربط بين الباي يبال الزر والكود الذي ف الاعلى؟

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ 2 ساعات قال Marwan800:

اسعد الله صباحك اخوي

اشكرك على الافاده ولكن لو تكرمت هل لديك كود الربط بين الباي يبال الزر والكود الذي ف الاعلى؟

يمكنك النظر إلى التوثيق الخاص لشركة paypal و قراءة كيفية ربط paypal مع التطبيق الخاص بك.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ 20 دقائق مضت قال بلال زيادة:

يمكنك النظر إلى التوثيق الخاص لشركة paypal و قراءة كيفية ربط paypal مع التطبيق الخاص بك.

والله ي غالي انا خبرتي شويه قليله في هذا الامر افتكرت لديك مثال على ذلك

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...